com.google.gwt.user.client.ui
Class DelegatingClickListenerCollection
java.lang.Object
java.util.AbstractCollection
java.util.AbstractList
java.util.ArrayList
com.google.gwt.user.client.ui.ClickListenerCollection
com.google.gwt.user.client.ui.DelegatingClickListenerCollection
- All Implemented Interfaces:
- ClickListener, java.lang.Cloneable, java.util.Collection, java.util.EventListener, java.util.List, java.util.RandomAccess, java.io.Serializable
- public class DelegatingClickListenerCollection
- extends ClickListenerCollection
- implements ClickListener
ClickListenerCollection
used to correctly hook up listeners which
need to listen to events from another source.
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 DelegatingClickListenerCollection
,
simply use the DelegatingClickListenerCollection
instead of a
ClickListenerCollection
. For example, in SuggestBox
, the
following code is used to listen to click events on the SuggestBox
's
underlying widget.
public void addClickListener(ClickListener listener) {
if (clickListeners == null) {
clickListeners = new DelegatingClickListenerCollection(this, box);
}
clickListeners.add(listener);
}
- See Also:
- Serialized Form
Fields inherited from class java.util.AbstractList |
modCount |
Method Summary |
void |
onClick(Widget sender)
Fired when the user clicks on a widget. |
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 |
DelegatingClickListenerCollection
public DelegatingClickListenerCollection(Widget owner,
SourcesClickEvents delegatedTo)
- Constructor for
DelegatingClickListenerCollection
.
- Parameters:
owner
- owner of listenersdelegatedTo
- source of events
onClick
public void onClick(Widget sender)
- Description copied from interface:
ClickListener
- Fired when the user clicks on a widget.
- Specified by:
onClick
in interface ClickListener
- Parameters:
sender
- the widget sending the event.