Google Web Toolkit
Search Google Code:

# Class DelegatingFocusListenerCollection

public class DelegatingFocusListenerCollection
extends FocusListenerCollection
implements FocusListener
FocusListenerCollection 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 DelegatingFocusListenerCollection, simply use the DelegatingFocusListenerCollection instead of a FocusListenerCollection. For example, in SuggestBox, the following code is used to listen to focus events on the SuggestBox's underlying widget.

      public void addFocusListener(FocusListener listener) {
        if (focusListeners == null) {
          focusListeners = new DelegatingFocusListenerCollection(this, box);
        }
        focusListeners.add(listener);
      }

## Constructors

DelegatingFocusListenerCollection(Widget, SourcesFocusEvents) | Constructor for DelegatingFocusListenerCollection

## Methods

onFocus(Widget) | Fired when a widget receives keyboard focus.
onLostFocus(Widget) | Fired when a widget loses keyboard focus.

## Constructor Detail

### DelegatingFocusListenerCollection

public DelegatingFocusListenerCollection(Widget owner, SourcesFocusEvents delegatedTo)
Constructor for DelegatingFocusListenerCollection. *

#### Parameters

owner
  owner of listeners
delegatedTo
  source of events

## Method Detail

### onFocus

public void onFocus(Widget sender)
Fired when a widget receives keyboard focus.

#### Parameters

sender
  the widget receiving focus.

### onLostFocus

public void onLostFocus(Widget sender)
Fired when a widget loses keyboard focus.

#### Parameters

sender
  the widget losing focus.