Package com.vaadin.client.ui
Class FocusUtil
- java.lang.Object
-
- com.vaadin.client.ui.FocusUtil
-
public class FocusUtil extends Object
A helper class used to make it easier forWidget
s to implementFocusable
.- Since:
- 7.0.3
- Version:
- Author:
- Vaadin Ltd
-
-
Constructor Summary
Constructors Constructor Description FocusUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
focusOnFirstFocusableElement(com.google.gwt.dom.client.Element parent)
Focus on the first focusable child Element of a parent Element.static void
focusOnLastFocusableElement(com.google.gwt.dom.client.Element parent)
Focus on the last focusable child Element of a parent Element.static com.google.gwt.dom.client.Element[]
getFocusableChildren(com.google.gwt.dom.client.Element parent)
Get all the child elements of a parent that are focusable.static int
getTabIndex(com.google.gwt.user.client.ui.Widget focusable)
Gets the widget's position in the tab index.static void
setAccessKey(com.google.gwt.user.client.ui.Widget focusable, char key)
Sets the access key propertystatic void
setFocus(com.google.gwt.user.client.ui.Widget focusable, boolean focus)
Explicitly focus/unfocus the given widget.static void
setTabIndex(com.google.gwt.user.client.ui.Widget focusable, int tabIndex)
Sets the widget's position in the tab index.
-
-
-
Method Detail
-
setAccessKey
public static void setAccessKey(com.google.gwt.user.client.ui.Widget focusable, char key)
Sets the access key property- Parameters:
focusable
- The widget for which we want to set the access key.key
- The access key to set
-
setFocus
public static void setFocus(com.google.gwt.user.client.ui.Widget focusable, boolean focus)
Explicitly focus/unfocus the given widget. Only one widget can have focus at a time, and the widget that does will receive all keyboard events.- Parameters:
focusable
- the widget to focus/unfocusfocused
- whether this widget should take focus or release it
-
setTabIndex
public static void setTabIndex(com.google.gwt.user.client.ui.Widget focusable, int tabIndex)
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 the widget to be removed from the tab order.- Parameters:
focusable
- The widgettabIndex
- the widget's tab index
-
getTabIndex
public static int getTabIndex(com.google.gwt.user.client.ui.Widget focusable)
Gets the widget's position in the tab index.- Parameters:
focusable
- The widget- Returns:
- the widget's tab index
-
getFocusableChildren
public static com.google.gwt.dom.client.Element[] getFocusableChildren(com.google.gwt.dom.client.Element parent)
Get all the child elements of a parent that are focusable.- Parameters:
parent
- The parent element whose children to search.- Returns:
- Array of child Elements that are focusable.
- Since:
- 7.7.12
-
focusOnFirstFocusableElement
public static void focusOnFirstFocusableElement(com.google.gwt.dom.client.Element parent)
Focus on the first focusable child Element of a parent Element.- Parameters:
parent
- The parent element to scan for a focusable child.- Since:
- 7.7.12
-
focusOnLastFocusableElement
public static void focusOnLastFocusableElement(com.google.gwt.dom.client.Element parent)
Focus on the last focusable child Element of a parent Element.- Parameters:
parent
- The parent element to scan for a focusable child.- Since:
- 7.7.12
-
-