com.google.gwt.user.client.ui
Class FocusWidget

java.lang.Object
  extended bycom.google.gwt.user.client.ui.UIObject
      extended bycom.google.gwt.user.client.ui.Widget
          extended bycom.google.gwt.user.client.ui.FocusWidget
All Implemented Interfaces:
EventListener, HasFocus, SourcesClickEvents, SourcesFocusEvents, SourcesKeyboardEvents
Direct Known Subclasses:
ButtonBase, Frame, ListBox, TextBoxBase

public abstract class FocusWidget
extends Widget
implements SourcesClickEvents, SourcesFocusEvents, HasFocus

Abstract base class for most widgets that can receive keyboard focus.


Field Summary
 
Fields inherited from class java.lang.Object
typeId, typeName
 
Constructor Summary
protected FocusWidget(Element elem)
          Creates a new focus component that wraps the specified browser element.
 
Method Summary
 void addClickListener(ClickListener listener)
          Adds a listener interface to receive click events.
 void addFocusListener(FocusListener listener)
          Adds a listener interface to receive mouse events.
 void addKeyboardListener(KeyboardListener listener)
          Adds a listener interface to receive keyboard events.
 int getTabIndex()
          Gets the widget's position in the tab index.
 boolean isEnabled()
          Gets whether this widget is enabled.
 void onBrowserEvent(Event event)
          Fired whenever a browser event is received.
 void removeClickListener(ClickListener listener)
          Removes a previously added listener interface.
 void removeFocusListener(FocusListener listener)
          Removes a previously added listener interface.
 void removeKeyboardListener(KeyboardListener listener)
          Removes a previously added listener interface.
 void setAccessKey(char key)
          Sets the widget's 'access key'.
 void setEnabled(boolean enabled)
          Sets whether this widget is enabled.
 void setFocus(boolean focused)
          Explicitly focus/unfocus this widget.
 void setTabIndex(int index)
          Sets the widget's position in the tab index.
 
Methods inherited from class com.google.gwt.user.client.ui.Widget
getParent, isAttached, onAttach, onDetach, onLoad
 
Methods inherited from class com.google.gwt.user.client.ui.UIObject
addStyleName, getAbsoluteLeft, getAbsoluteTop, getElement, getOffsetHeight, getOffsetWidth, getStyleName, isVisible, isVisible, removeStyleName, setElement, setHeight, setPixelSize, setSize, setStyleName, setStyleName, setVisible, setVisible, setWidth, sinkEvents, toString, unsinkEvents
 
Methods inherited from class java.lang.Object
equals, finalize, hashCode
 

Constructor Detail

FocusWidget

protected FocusWidget(Element elem)
Creates a new focus component that wraps the specified browser element.

Method Detail

addClickListener

public void addClickListener(ClickListener listener)
Description copied from interface: SourcesClickEvents
Adds a listener interface to receive click events.

Specified by:
addClickListener in interface SourcesClickEvents
Parameters:
listener - the listener interface to add

addFocusListener

public void addFocusListener(FocusListener listener)
Description copied from interface: SourcesFocusEvents
Adds a listener interface to receive mouse events.

Specified by:
addFocusListener in interface SourcesFocusEvents
Parameters:
listener - the listener interface to add

addKeyboardListener

public void addKeyboardListener(KeyboardListener listener)
Description copied from interface: SourcesKeyboardEvents
Adds a listener interface to receive keyboard events.

Specified by:
addKeyboardListener in interface SourcesKeyboardEvents
Parameters:
listener - the listener interface to add

getTabIndex

public int getTabIndex()
Description copied from interface: HasFocus
Gets the widget's position in the tab index.

Specified by:
getTabIndex in interface HasFocus
Returns:
the widget's tab index

isEnabled

public boolean isEnabled()
Gets whether this widget is enabled.

Returns:
true if the widget is enabled

onBrowserEvent

public void onBrowserEvent(Event event)
Description copied from interface: EventListener
Fired whenever a browser event is received.

Specified by:
onBrowserEvent in interface EventListener
Overrides:
onBrowserEvent in class Widget

removeClickListener

public void removeClickListener(ClickListener listener)
Description copied from interface: SourcesClickEvents
Removes a previously added listener interface.

Specified by:
removeClickListener in interface SourcesClickEvents
Parameters:
listener - the listener interface to remove

removeFocusListener

public void removeFocusListener(FocusListener listener)
Description copied from interface: SourcesFocusEvents
Removes a previously added listener interface.

Specified by:
removeFocusListener in interface SourcesFocusEvents
Parameters:
listener - the listener interface to remove

removeKeyboardListener

public void removeKeyboardListener(KeyboardListener listener)
Description copied from interface: SourcesKeyboardEvents
Removes a previously added listener interface.

Specified by:
removeKeyboardListener in interface SourcesKeyboardEvents
Parameters:
listener - the listener interface to remove

setAccessKey

public void setAccessKey(char key)
Description copied from interface: HasFocus
Sets the widget's 'access key'. This key is used (in conjunction with a browser-specific modifier key) to automatically focus the widget.

Specified by:
setAccessKey in interface HasFocus
Parameters:
key - the widget's access key

setEnabled

public void setEnabled(boolean enabled)
Sets whether this widget is enabled.

Parameters:
enabled - true to enable the widget, false to disable it

setFocus

public void setFocus(boolean focused)
Description copied from interface: HasFocus
Explicitly focus/unfocus this widget. Only one widget can have focus at a time, and the widget that does will receive all keyboard events.

Specified by:
setFocus in interface HasFocus
Parameters:
focused - whether this widget should take focus or release it

setTabIndex

public void setTabIndex(int index)
Description copied from interface: HasFocus
Sets the widget's position in the tab index. If more than one widget has the same tab index, each such widget will receive focus in an arbitrary order. Setting the tab index to -1 will cause this widget to be removed from the tab order.

Specified by:
setTabIndex in interface HasFocus
Parameters:
index - the widget's tab index


This javadoc distribution was not produced by Google. The official documentation is here.