|
GWT 0.0.0 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.util.AbstractCollection<E>
java.util.AbstractList<E>
java.util.ArrayList<KeyboardListener>
com.google.gwt.user.client.ui.KeyboardListenerCollection
com.google.gwt.user.client.ui.DelegatingKeyboardListenerCollection
Widget.delegateEvent(com.google.gwt.user.client.ui.Widget, com.google.gwt.event.shared.GwtEvent>)
instead
@Deprecated public class DelegatingKeyboardListenerCollection
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); }
Field Summary |
---|
Fields inherited from class java.util.AbstractList |
---|
modCount |
Fields 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 | |
---|---|
DelegatingKeyboardListenerCollection(Widget owner,
SourcesKeyboardEvents delegatedTo)
Deprecated. Constructor for DelegatingKeyboardListenerCollection . |
Method Summary | |
---|---|
void |
onKeyDown(Widget sender,
char keyCode,
int modifiers)
Deprecated. Fired when the user depresses a physical key. |
void |
onKeyPress(Widget sender,
char keyCode,
int modifiers)
Deprecated. Fired when a keyboard action generates a character. |
void |
onKeyUp(Widget sender,
char keyCode,
int modifiers)
Deprecated. Fired when the user releases a physical key. |
Methods inherited from class com.google.gwt.user.client.ui.KeyboardListenerCollection |
---|
fireKeyboardEvent, fireKeyDown, fireKeyPress, fireKeyUp, getKeyboardModifiers |
Methods inherited from class java.util.ArrayList |
---|
add, add, addAll, addAll, clear, clone, contains, ensureCapacity, get, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, removeRange, retainAll, set, size, subList, toArray, toArray, trimToSize |
Methods inherited from class java.util.AbstractList |
---|
equals, hashCode |
Methods inherited from class java.util.AbstractCollection |
---|
containsAll, toString |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface java.util.List |
---|
containsAll, equals, hashCode |
Constructor Detail |
---|
public DelegatingKeyboardListenerCollection(Widget owner, SourcesKeyboardEvents delegatedTo)
DelegatingKeyboardListenerCollection
.
owner
- owner of listenersdelegatedTo
- source of eventsMethod Detail |
---|
public void onKeyDown(Widget sender, char keyCode, int modifiers)
KeyboardListener
onKeyDown
in interface KeyboardListener
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 by
KeyboardListener.MODIFIER_SHIFT
,
KeyboardListener.MODIFIER_CTRL
, and
KeyboardListener.MODIFIER_ALT
public void onKeyPress(Widget sender, char keyCode, int modifiers)
KeyboardListener
It should be noted that many browsers do not generate keypress events for
non-printing keyCode values, such as KeyboardListener.KEY_ENTER
or
arrow keys. These keyCodes can be reliably captured either with
KeyboardListener.onKeyDown(Widget, char, int)
or
KeyboardListener.onKeyUp(Widget, char, int)
.
onKeyPress
in interface KeyboardListener
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 by
KeyboardListener.MODIFIER_SHIFT
,
KeyboardListener.MODIFIER_CTRL
, and
KeyboardListener.MODIFIER_ALT
public void onKeyUp(Widget sender, char keyCode, int modifiers)
KeyboardListener
onKeyUp
in interface KeyboardListener
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 by
KeyboardListener.MODIFIER_SHIFT
,
KeyboardListener.MODIFIER_CTRL
, and
KeyboardListener.MODIFIER_ALT
|
GWT 0.0.0 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |