com.google.gwt.user.client.ui
Class KeyboardListenerCollection
java.lang.Object
java.util.AbstractCollection
java.util.AbstractList
java.util.ArrayList
com.google.gwt.user.client.ui.KeyboardListenerCollection
- All Implemented Interfaces:
- java.lang.Cloneable, java.util.Collection, java.util.List, java.util.RandomAccess, java.io.Serializable
- Direct Known Subclasses:
- DelegatingKeyboardListenerCollection
- public class KeyboardListenerCollection
- extends java.util.ArrayList
A helper class for implementers of the SourcesKeyboardEvents interface. This
subclass of assumes that all objects added to it will be of
type KeyboardListener
.
- See Also:
- Serialized Form
Fields inherited from class java.util.AbstractList |
modCount |
Method Summary |
void |
fireKeyboardEvent(Widget sender,
Event event)
Automatically fires the appropriate keyboard event to all listeners. |
void |
fireKeyDown(Widget sender,
char keyCode,
int modifiers)
Fires a keyDown event to all listeners. |
void |
fireKeyPress(Widget sender,
char key,
int modifiers)
Fires a keyDown event to all listeners. |
void |
fireKeyUp(Widget sender,
char keyCode,
int modifiers)
Fires a keyDown event to all listeners. |
static int |
getKeyboardModifiers(Event event)
Gets the keyboard modifiers associated with a DOMEvent. |
Methods inherited from class java.util.ArrayList |
add, add, addAll, addAll, clear, clone, contains, ensureCapacity, get, indexOf, isEmpty, lastIndexOf, remove, removeRange, set, size, toArray, toArray, trimToSize |
Methods inherited from class java.util.AbstractList |
equals, hashCode, iterator, listIterator, listIterator, subList |
Methods inherited from class java.util.AbstractCollection |
containsAll, remove, removeAll, retainAll, 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, iterator, listIterator, listIterator, remove, removeAll, retainAll, subList |
KeyboardListenerCollection
public KeyboardListenerCollection()
getKeyboardModifiers
public static int getKeyboardModifiers(Event event)
- Gets the keyboard modifiers associated with a DOMEvent.
- Parameters:
event
- the event.
- Returns:
- the modifiers as defined in
KeyboardListener
.
fireKeyboardEvent
public void fireKeyboardEvent(Widget sender,
Event event)
- Automatically fires the appropriate keyboard event to all listeners. If the
given event is not a keyboard event, no action will be performed.
- Parameters:
sender
- the widget sending the event.event
- the Event received by the widget.
fireKeyDown
public void fireKeyDown(Widget sender,
char keyCode,
int modifiers)
- Fires a keyDown event to all listeners.
- Parameters:
sender
- the widget sending the event.keyCode
- the keyCode to send with the event.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
.
fireKeyPress
public void fireKeyPress(Widget sender,
char key,
int modifiers)
- Fires a keyDown event to all listeners.
- Parameters:
sender
- the widget sending the event.key
- the key to send with the event.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
.
fireKeyUp
public void fireKeyUp(Widget sender,
char keyCode,
int modifiers)
- Fires a keyDown event to all listeners.
- Parameters:
sender
- the widget sending the event.keyCode
- the keyCode to send with the event.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
.