Class DelegatingKeyboardListenerCollection
- All Implemented Interfaces:
KeyboardListener,Serializable,Cloneable,Iterable<KeyboardListener>,Collection<KeyboardListener>,EventListener,List<KeyboardListener>,RandomAccess,SequencedCollection<KeyboardListener>
KeyboardListenerCollection used to correctly hook up event listeners
to the composite's wrapped widget.
For example, Composite widgets often need to listen to events
generated on their wrapped widget. Upon the firing of a wrapped widget's
event, the composite widget must fire its own listeners with itself as the
source of the event. To use a DelegatingKeyboardListenerCollection,
simply use the DelegatingKeyboardListenerCollection instead of a
KeyboardListenerCollection. For example, in SuggestBox, the
following code is used to listen to keyboard events on the SuggestBox
underlying widget.
public void addKeyboardListener(KeyboardListener listener) {
if (keyboardListeners == null) {
keyboardListeners = new DelegatingKeyboardListenerCollection(this, box);
}
keyboardListeners.add(listener);
}
- See Also:
-
Field Summary
Fields inherited from class java.util.AbstractList
modCountFields inherited from interface com.google.gwt.user.client.ui.KeyboardListener
KEY_ALT, KEY_BACKSPACE, KEY_CTRL, KEY_DELETE, KEY_DOWN, KEY_END, KEY_ENTER, KEY_ESCAPE, KEY_HOME, KEY_LEFT, KEY_PAGEDOWN, KEY_PAGEUP, KEY_RIGHT, KEY_SHIFT, KEY_TAB, KEY_UP, MODIFIER_ALT, MODIFIER_CTRL, MODIFIER_META, MODIFIER_SHIFT -
Constructor Summary
ConstructorsConstructorDescriptionDelegatingKeyboardListenerCollection(Widget owner, SourcesKeyboardEvents delegatedTo) Deprecated.Constructor forDelegatingKeyboardListenerCollection. -
Method Summary
Modifier and TypeMethodDescriptionvoidDeprecated.Fired when the user depresses a physical key.voidonKeyPress(Widget sender, char keyCode, int modifiers) Deprecated.Fired when a keyboard action generates a character.voidDeprecated.Fired when the user releases a physical key.Methods inherited from class com.google.gwt.user.client.ui.KeyboardListenerCollection
fireKeyboardEvent, fireKeyDown, fireKeyPress, fireKeyUp, getKeyboardModifiersMethods inherited from class java.util.ArrayList
add, add, addAll, addAll, addFirst, addLast, clear, clone, contains, ensureCapacity, equals, forEach, get, getFirst, getLast, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, removeFirst, removeIf, removeLast, removeRange, replaceAll, retainAll, set, size, sort, spliterator, subList, toArray, toArray, trimToSizeMethods inherited from class java.util.AbstractCollection
containsAll, toStringMethods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Collection
parallelStream, stream, toArrayMethods inherited from interface java.util.List
containsAll, reversed
-
Constructor Details
-
DelegatingKeyboardListenerCollection
Deprecated.Constructor forDelegatingKeyboardListenerCollection.- Parameters:
owner- owner of listenersdelegatedTo- source of events
-
-
Method Details
-
onKeyDown
Deprecated.Description copied from interface:KeyboardListenerFired when the user depresses a physical key.- Specified by:
onKeyDownin interfaceKeyboardListener- Parameters:
sender- the widget that was focused when the event occurred.keyCode- the physical key that was depressed. Constants for this value are defined in this interface with the KEY prefix.modifiers- the modifier keys pressed at when the event occurred. This value is a combination of the bits defined byKeyboardListener.MODIFIER_SHIFT,KeyboardListener.MODIFIER_CTRL, andKeyboardListener.MODIFIER_ALT
-
onKeyPress
Deprecated.Description copied from interface:KeyboardListenerFired when a keyboard action generates a character. This occurs after onKeyDown and onKeyUp are fired for the physical key that was pressed.It should be noted that many browsers do not generate keypress events for non-printing keyCode values, such as
KeyboardListener.KEY_ENTERor arrow keys. These keyCodes can be reliably captured either withKeyboardListener.onKeyDown(Widget, char, int)orKeyboardListener.onKeyUp(Widget, char, int).- Specified by:
onKeyPressin interfaceKeyboardListener- Parameters:
sender- the widget that was focused when the event occurred.keyCode- the Unicode character that was generated by the keyboard action.modifiers- the modifier keys pressed at when the event occurred. This value is a combination of the bits defined byKeyboardListener.MODIFIER_SHIFT,KeyboardListener.MODIFIER_CTRL, andKeyboardListener.MODIFIER_ALT
-
onKeyUp
Deprecated.Description copied from interface:KeyboardListenerFired when the user releases a physical key.- Specified by:
onKeyUpin interfaceKeyboardListener- Parameters:
sender- the widget that was focused when the event occurred.keyCode- the physical key that was released. Constants for this value are defined in this interface with the KEY prefix.modifiers- the modifier keys pressed at when the event occurred. This value is a combination of the bits defined byKeyboardListener.MODIFIER_SHIFT,KeyboardListener.MODIFIER_CTRL, andKeyboardListener.MODIFIER_ALT
-
Widget.delegateEvent(com.google.gwt.user.client.ui.Widget, com.google.gwt.event.shared.GwtEvent<?>)instead