Package com.google.gwt.user.client.ui
Class FocusPanel
java.lang.Object
com.google.gwt.user.client.ui.UIObject
com.google.gwt.user.client.ui.Widget
com.google.gwt.user.client.ui.Panel
com.google.gwt.user.client.ui.SimplePanel
com.google.gwt.user.client.ui.FocusPanel
- All Implemented Interfaces:
HasAllDragAndDropHandlers
,HasAllFocusHandlers
,HasAllGestureHandlers
,HasAllKeyHandlers
,HasAllMouseHandlers
,HasAllTouchHandlers
,HasBlurHandlers
,HasClickHandlers
,HasDoubleClickHandlers
,HasDragEndHandlers
,HasDragEnterHandlers
,HasDragHandlers
,HasDragLeaveHandlers
,HasDragOverHandlers
,HasDragStartHandlers
,HasDropHandlers
,HasFocusHandlers
,HasGestureChangeHandlers
,HasGestureEndHandlers
,HasGestureStartHandlers
,HasKeyDownHandlers
,HasKeyPressHandlers
,HasKeyUpHandlers
,HasMouseDownHandlers
,HasMouseMoveHandlers
,HasMouseOutHandlers
,HasMouseOverHandlers
,HasMouseUpHandlers
,HasMouseWheelHandlers
,HasTouchCancelHandlers
,HasTouchEndHandlers
,HasTouchMoveHandlers
,HasTouchStartHandlers
,HasAttachHandlers
,HasHandlers
,EventListener
,AcceptsOneWidget
,Focusable
,HasFocus
,HasOneWidget
,HasVisibility
,HasWidgets
,HasWidgets.ForIsWidget
,IsWidget
,SourcesClickEvents
,SourcesFocusEvents
,SourcesKeyboardEvents
,SourcesMouseEvents
,SourcesMouseWheelEvents
,Iterable<Widget>
public class FocusPanel
extends SimplePanel
implements HasFocus, SourcesClickEvents, SourcesMouseEvents, SourcesMouseWheelEvents, HasAllDragAndDropHandlers, HasAllMouseHandlers, HasClickHandlers, HasDoubleClickHandlers, HasAllKeyHandlers, HasAllFocusHandlers, HasAllGestureHandlers, HasAllTouchHandlers
A simple panel that makes its contents focusable, and adds the ability to
catch mouse and keyboard events.
-
Nested Class Summary
Nested classes/interfaces inherited from class com.google.gwt.user.client.ui.UIObject
UIObject.DebugIdImpl, UIObject.DebugIdImplEnabled
Nested classes/interfaces inherited from interface com.google.gwt.user.client.ui.HasWidgets
HasWidgets.ForIsWidget
-
Field Summary
Modifier and TypeFieldDescription(package private) static final com.google.gwt.user.client.ui.impl.FocusImpl
Fields inherited from class com.google.gwt.user.client.ui.SimplePanel
widget
Fields inherited from class com.google.gwt.user.client.ui.Widget
eventsToSink
Fields inherited from class com.google.gwt.user.client.ui.UIObject
DEBUG_ID_PREFIX, MISSING_ELEMENT_ERROR, SETELEMENT_TWICE_ERROR
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionaddBlurHandler
(BlurHandler handler) Adds aBlurEvent
handler.addClickHandler
(ClickHandler handler) Adds aClickEvent
handler.void
addClickListener
(ClickListener listener) Deprecated.addDoubleClickHandler
(DoubleClickHandler handler) Adds aDoubleClickEvent
handler.addDragEndHandler
(DragEndHandler handler) Adds aDragEndEvent
handler.addDragEnterHandler
(DragEnterHandler handler) Adds aDragEnterEvent
handler.addDragHandler
(DragHandler handler) Adds aDragEvent
handler.addDragLeaveHandler
(DragLeaveHandler handler) Adds aDragLeaveEvent
handler.addDragOverHandler
(DragOverHandler handler) Adds aDragOverEvent
handler.addDragStartHandler
(DragStartHandler handler) Adds aDragStartEvent
handler.addDropHandler
(DropHandler handler) Adds aDropEvent
handler.addFocusHandler
(FocusHandler handler) Adds aFocusEvent
handler.void
addFocusListener
(FocusListener listener) Deprecated.Adds aGestureChangeEvent
handler.addGestureEndHandler
(GestureEndHandler handler) Adds aGestureEndEvent
handler.Adds aGestureStartEvent
handler.void
addKeyboardListener
(KeyboardListener listener) addKeyDownHandler
(KeyDownHandler handler) Adds aKeyDownEvent
handler.addKeyPressHandler
(KeyPressHandler handler) Adds aKeyPressEvent
handler.addKeyUpHandler
(KeyUpHandler handler) Adds aKeyUpEvent
handler.addMouseDownHandler
(MouseDownHandler handler) Adds aMouseDownEvent
handler.void
addMouseListener
(MouseListener listener) Deprecated.UseaddMouseOverHandler(com.google.gwt.event.dom.client.MouseOverHandler)
,addMouseMoveHandler(com.google.gwt.event.dom.client.MouseMoveHandler)
,addMouseDownHandler(com.google.gwt.event.dom.client.MouseDownHandler)
,addMouseUpHandler(com.google.gwt.event.dom.client.MouseUpHandler)
andaddMouseOutHandler(com.google.gwt.event.dom.client.MouseOutHandler)
insteadaddMouseMoveHandler
(MouseMoveHandler handler) Adds aMouseMoveEvent
handler.addMouseOutHandler
(MouseOutHandler handler) Adds aMouseOutEvent
handler.addMouseOverHandler
(MouseOverHandler handler) Adds aMouseOverEvent
handler.addMouseUpHandler
(MouseUpHandler handler) Adds aMouseUpEvent
handler.addMouseWheelHandler
(MouseWheelHandler handler) Adds aMouseWheelEvent
handler.void
addMouseWheelListener
(MouseWheelListener listener) Deprecated.addTouchCancelHandler
(TouchCancelHandler handler) Adds aTouchCancelEvent
handler.addTouchEndHandler
(TouchEndHandler handler) Adds aTouchEndEvent
handler.addTouchMoveHandler
(TouchMoveHandler handler) Adds aTouchMoveEvent
handler.addTouchStartHandler
(TouchStartHandler handler) Adds aTouchStartEvent
handler.int
Gets the widget's position in the tab index.void
removeClickListener
(ClickListener listener) Deprecated.Use theHandlerRegistration.removeHandler()
method on the object returned byaddClickHandler(com.google.gwt.event.dom.client.ClickHandler)
insteadvoid
removeFocusListener
(FocusListener listener) Deprecated.Use theHandlerRegistration.removeHandler()
method on the object returned byaddFocusHandler(com.google.gwt.event.dom.client.FocusHandler)
insteadvoid
removeKeyboardListener
(KeyboardListener listener) Deprecated.Use theHandlerRegistration.removeHandler()
method on the object returned by an add*Handler method insteadvoid
removeMouseListener
(MouseListener listener) Deprecated.Use theHandlerRegistration.removeHandler()
method on the object returned by an add*Handler method insteadvoid
removeMouseWheelListener
(MouseWheelListener listener) Deprecated.Use theHandlerRegistration.removeHandler()
method on the object returned byaddMouseWheelHandler(com.google.gwt.event.dom.client.MouseWheelHandler)
insteadvoid
setAccessKey
(char key) Sets the widget's 'access key'.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.SimplePanel
add, getContainerElement, getWidget, iterator, remove, setWidget, setWidget
Methods inherited from class com.google.gwt.user.client.ui.Panel
add, adopt, clear, doAttachChildren, doDetachChildren, orphan, remove
Methods inherited from class com.google.gwt.user.client.ui.Widget
addAttachHandler, addBitlessDomHandler, addDomHandler, addHandler, asWidget, asWidgetOrNull, createHandlerManager, delegateEvent, ensureHandlers, fireEvent, getHandlerCount, getHandlerManager, getLayoutData, getParent, isAttached, isOrWasAttached, onAttach, onBrowserEvent, onDetach, onLoad, onUnload, removeFromParent, replaceElement, setLayoutData, setParent, sinkEvents, unsinkEvents
Methods inherited from class com.google.gwt.user.client.ui.UIObject
addStyleDependentName, addStyleName, ensureDebugId, ensureDebugId, ensureDebugId, getAbsoluteLeft, getAbsoluteTop, getElement, getOffsetHeight, getOffsetWidth, getStyleElement, getStyleName, getStyleName, getStylePrimaryName, getStylePrimaryName, getTitle, isVisible, isVisible, onEnsureDebugId, removeStyleDependentName, removeStyleName, resolvePotentialElement, setElement, setElement, setHeight, setPixelSize, setSize, setStyleDependentName, setStyleName, setStyleName, setStyleName, setStyleName, setStylePrimaryName, setStylePrimaryName, setTitle, setVisible, setVisible, setWidth, sinkBitlessEvent, toString
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface com.google.gwt.event.shared.HasHandlers
fireEvent
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Field Details
-
impl
static final com.google.gwt.user.client.ui.impl.FocusImpl impl
-
-
Constructor Details
-
FocusPanel
public FocusPanel() -
FocusPanel
-
-
Method Details
-
addBlurHandler
Description copied from interface:HasBlurHandlers
Adds aBlurEvent
handler.- Specified by:
addBlurHandler
in interfaceHasBlurHandlers
- Parameters:
handler
- the blur handler- Returns:
HandlerRegistration
used to remove this handler
-
addClickHandler
Description copied from interface:HasClickHandlers
Adds aClickEvent
handler.- Specified by:
addClickHandler
in interfaceHasClickHandlers
- Parameters:
handler
- the click handler- Returns:
HandlerRegistration
used to remove this handler
-
addClickListener
Deprecated.Description copied from interface:SourcesClickEvents
Adds a listener interface to receive click events.- Specified by:
addClickListener
in interfaceSourcesClickEvents
- Parameters:
listener
- the listener interface to add
-
addDoubleClickHandler
Description copied from interface:HasDoubleClickHandlers
Adds aDoubleClickEvent
handler.- Specified by:
addDoubleClickHandler
in interfaceHasDoubleClickHandlers
- Parameters:
handler
- the double click handler- Returns:
HandlerRegistration
used to remove this handler
-
addDragEndHandler
Description copied from interface:HasDragEndHandlers
Adds aDragEndEvent
handler.- Specified by:
addDragEndHandler
in interfaceHasDragEndHandlers
- Parameters:
handler
- the drag end handler- Returns:
HandlerRegistration
used to remove this handler
-
addDragEnterHandler
Description copied from interface:HasDragEnterHandlers
Adds aDragEnterEvent
handler.- Specified by:
addDragEnterHandler
in interfaceHasDragEnterHandlers
- Parameters:
handler
- the drag end handler- Returns:
HandlerRegistration
used to remove this handler
-
addDragHandler
Description copied from interface:HasDragHandlers
Adds aDragEvent
handler.- Specified by:
addDragHandler
in interfaceHasDragHandlers
- Parameters:
handler
- the drag handler- Returns:
HandlerRegistration
used to remove this handler
-
addDragLeaveHandler
Description copied from interface:HasDragLeaveHandlers
Adds aDragLeaveEvent
handler.- Specified by:
addDragLeaveHandler
in interfaceHasDragLeaveHandlers
- Parameters:
handler
- the drag leave handler- Returns:
HandlerRegistration
used to remove this handler
-
addDragOverHandler
Description copied from interface:HasDragOverHandlers
Adds aDragOverEvent
handler.- Specified by:
addDragOverHandler
in interfaceHasDragOverHandlers
- Parameters:
handler
- the drag over handler- Returns:
HandlerRegistration
used to remove this handler
-
addDragStartHandler
Description copied from interface:HasDragStartHandlers
Adds aDragStartEvent
handler.- Specified by:
addDragStartHandler
in interfaceHasDragStartHandlers
- Parameters:
handler
- the drag start handler- Returns:
HandlerRegistration
used to remove this handler
-
addDropHandler
Description copied from interface:HasDropHandlers
Adds aDropEvent
handler.- Specified by:
addDropHandler
in interfaceHasDropHandlers
- Parameters:
handler
- the drop handler- Returns:
HandlerRegistration
used to remove this handler
-
addFocusHandler
Description copied from interface:HasFocusHandlers
Adds aFocusEvent
handler.- Specified by:
addFocusHandler
in interfaceHasFocusHandlers
- Parameters:
handler
- the focus handler- Returns:
HandlerRegistration
used to remove this handler
-
addFocusListener
Deprecated.Description copied from interface:SourcesFocusEvents
Adds a listener interface to receive focus events.- Specified by:
addFocusListener
in interfaceSourcesFocusEvents
- Parameters:
listener
- the listener interface to add
-
addGestureChangeHandler
Description copied from interface:HasGestureChangeHandlers
Adds aGestureChangeEvent
handler.- Specified by:
addGestureChangeHandler
in interfaceHasGestureChangeHandlers
- Parameters:
handler
- the gesture change handler- Returns:
HandlerRegistration
used to remove this handler
-
addGestureEndHandler
Description copied from interface:HasGestureEndHandlers
Adds aGestureEndEvent
handler.- Specified by:
addGestureEndHandler
in interfaceHasGestureEndHandlers
- Parameters:
handler
- the gesture end handler- Returns:
HandlerRegistration
used to remove this handler
-
addGestureStartHandler
Description copied from interface:HasGestureStartHandlers
Adds aGestureStartEvent
handler.- Specified by:
addGestureStartHandler
in interfaceHasGestureStartHandlers
- Parameters:
handler
- the gesture start handler- Returns:
HandlerRegistration
used to remove this handler
-
addKeyboardListener
Deprecated.Description copied from interface:SourcesKeyboardEvents
Adds a listener interface to receive keyboard events.- Specified by:
addKeyboardListener
in interfaceSourcesKeyboardEvents
- Parameters:
listener
- the listener interface to add
-
addKeyDownHandler
Description copied from interface:HasKeyDownHandlers
Adds aKeyDownEvent
handler.- Specified by:
addKeyDownHandler
in interfaceHasKeyDownHandlers
- Parameters:
handler
- the key down handler- Returns:
HandlerRegistration
used to remove this handler
-
addKeyPressHandler
Description copied from interface:HasKeyPressHandlers
Adds aKeyPressEvent
handler.- Specified by:
addKeyPressHandler
in interfaceHasKeyPressHandlers
- Parameters:
handler
- the key press handler- Returns:
HandlerRegistration
used to remove this handler
-
addKeyUpHandler
Description copied from interface:HasKeyUpHandlers
Adds aKeyUpEvent
handler.- Specified by:
addKeyUpHandler
in interfaceHasKeyUpHandlers
- Parameters:
handler
- the key up handler- Returns:
HandlerRegistration
used to remove this handler
-
addMouseDownHandler
Description copied from interface:HasMouseDownHandlers
Adds aMouseDownEvent
handler.- Specified by:
addMouseDownHandler
in interfaceHasMouseDownHandlers
- Parameters:
handler
- the mouse down handler- Returns:
HandlerRegistration
used to remove this handler
-
addMouseListener
Deprecated.UseaddMouseOverHandler(com.google.gwt.event.dom.client.MouseOverHandler)
,addMouseMoveHandler(com.google.gwt.event.dom.client.MouseMoveHandler)
,addMouseDownHandler(com.google.gwt.event.dom.client.MouseDownHandler)
,addMouseUpHandler(com.google.gwt.event.dom.client.MouseUpHandler)
andaddMouseOutHandler(com.google.gwt.event.dom.client.MouseOutHandler)
insteadDescription copied from interface:SourcesMouseEvents
Adds a listener interface to receive mouse events.- Specified by:
addMouseListener
in interfaceSourcesMouseEvents
- Parameters:
listener
- the listener interface to add
-
addMouseMoveHandler
Description copied from interface:HasMouseMoveHandlers
Adds aMouseMoveEvent
handler.- Specified by:
addMouseMoveHandler
in interfaceHasMouseMoveHandlers
- Parameters:
handler
- the mouse move handler- Returns:
HandlerRegistration
used to remove this handler
-
addMouseOutHandler
Description copied from interface:HasMouseOutHandlers
Adds aMouseOutEvent
handler.- Specified by:
addMouseOutHandler
in interfaceHasMouseOutHandlers
- Parameters:
handler
- the mouse out handler- Returns:
HandlerRegistration
used to remove this handler
-
addMouseOverHandler
Description copied from interface:HasMouseOverHandlers
Adds aMouseOverEvent
handler.- Specified by:
addMouseOverHandler
in interfaceHasMouseOverHandlers
- Parameters:
handler
- the mouse over handler- Returns:
HandlerRegistration
used to remove this handler
-
addMouseUpHandler
Description copied from interface:HasMouseUpHandlers
Adds aMouseUpEvent
handler.- Specified by:
addMouseUpHandler
in interfaceHasMouseUpHandlers
- Parameters:
handler
- the mouse up handler- Returns:
HandlerRegistration
used to remove this handler
-
addMouseWheelHandler
Description copied from interface:HasMouseWheelHandlers
Adds aMouseWheelEvent
handler.- Specified by:
addMouseWheelHandler
in interfaceHasMouseWheelHandlers
- Parameters:
handler
- the mouse wheel handler- Returns:
HandlerRegistration
used to remove this handler
-
addMouseWheelListener
Deprecated.Description copied from interface:SourcesMouseWheelEvents
Adds a listener interface to receive mouse events.- Specified by:
addMouseWheelListener
in interfaceSourcesMouseWheelEvents
- Parameters:
listener
- the listener interface to add
-
addTouchCancelHandler
Description copied from interface:HasTouchCancelHandlers
Adds aTouchCancelEvent
handler.- Specified by:
addTouchCancelHandler
in interfaceHasTouchCancelHandlers
- Parameters:
handler
- the touch cancel handler- Returns:
HandlerRegistration
used to remove this handler
-
addTouchEndHandler
Description copied from interface:HasTouchEndHandlers
Adds aTouchEndEvent
handler.- Specified by:
addTouchEndHandler
in interfaceHasTouchEndHandlers
- Parameters:
handler
- the touch end handler- Returns:
HandlerRegistration
used to remove this handler
-
addTouchMoveHandler
Description copied from interface:HasTouchMoveHandlers
Adds aTouchMoveEvent
handler.- Specified by:
addTouchMoveHandler
in interfaceHasTouchMoveHandlers
- Parameters:
handler
- the touch move handler- Returns:
HandlerRegistration
used to remove this handler
-
addTouchStartHandler
Description copied from interface:HasTouchStartHandlers
Adds aTouchStartEvent
handler.- Specified by:
addTouchStartHandler
in interfaceHasTouchStartHandlers
- Parameters:
handler
- the touch start handler- Returns:
HandlerRegistration
used to remove this handler
-
getTabIndex
public int getTabIndex()Description copied from interface:Focusable
Gets the widget's position in the tab index.- Specified by:
getTabIndex
in interfaceFocusable
- Returns:
- the widget's tab index
-
removeClickListener
Deprecated.Use theHandlerRegistration.removeHandler()
method on the object returned byaddClickHandler(com.google.gwt.event.dom.client.ClickHandler)
insteadDescription copied from interface:SourcesClickEvents
Removes a previously added listener interface.- Specified by:
removeClickListener
in interfaceSourcesClickEvents
- Parameters:
listener
- the listener interface to remove
-
removeFocusListener
Deprecated.Use theHandlerRegistration.removeHandler()
method on the object returned byaddFocusHandler(com.google.gwt.event.dom.client.FocusHandler)
insteadDescription copied from interface:SourcesFocusEvents
Removes a previously added listener interface.- Specified by:
removeFocusListener
in interfaceSourcesFocusEvents
- Parameters:
listener
- the listener interface to remove
-
removeKeyboardListener
Deprecated.Use theHandlerRegistration.removeHandler()
method on the object returned by an add*Handler method insteadDescription copied from interface:SourcesKeyboardEvents
Removes a previously added listener interface.- Specified by:
removeKeyboardListener
in interfaceSourcesKeyboardEvents
- Parameters:
listener
- the listener interface to remove
-
removeMouseListener
Deprecated.Use theHandlerRegistration.removeHandler()
method on the object returned by an add*Handler method insteadDescription copied from interface:SourcesMouseEvents
Removes a previously added listener interface.- Specified by:
removeMouseListener
in interfaceSourcesMouseEvents
- Parameters:
listener
- the listener interface to remove
-
removeMouseWheelListener
Deprecated.Use theHandlerRegistration.removeHandler()
method on the object returned byaddMouseWheelHandler(com.google.gwt.event.dom.client.MouseWheelHandler)
insteadDescription copied from interface:SourcesMouseWheelEvents
Removes a previously added listener interface.- Specified by:
removeMouseWheelListener
in interfaceSourcesMouseWheelEvents
- Parameters:
listener
- the listener interface to remove
-
setAccessKey
public void setAccessKey(char key) Description copied from interface:Focusable
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 interfaceFocusable
- Parameters:
key
- the widget's access key
-
setFocus
public void setFocus(boolean focused) Description copied from interface:Focusable
Explicitly focus/unfocus this widget. Only one widget can have focus at a time, and the widget that does will receive all keyboard events. NOTE: Most browsers fire FocusEvents asynchronously. Especially within GWT tests, you'll need to make your test asynchronous to properly do verifications. SeeGWTTestCase#delayTestFinish
for more information on how to do this. -
setTabIndex
public void setTabIndex(int index) Description copied from interface:Focusable
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 interfaceFocusable
- Parameters:
index
- the widget's tab index
-
addClickHandler(com.google.gwt.event.dom.client.ClickHandler)
instead