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 for
Widget
s to implementFocusable
.Since:
7.0.3
Author:
Vaadin Ltd
-
-
Constructor Summary
Constructors Constructor Description FocusUtil()
-
Method Summary
All Methods Modifier and Type Method Description static void
focusOnFirstFocusableElement(com.google.gwt.dom.client.Element parent)
Moves the focus to the first focusable child of given parent element.
static void
focusOnLastFocusableElement(com.google.gwt.dom.client.Element parent)
Moves the focus to the last focusable child of given parent element.
static com.google.gwt.dom.client.Element[]
getFocusableChildren(com.google.gwt.dom.client.Element parent)
Finds all the focusable children of given parent element.
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 property.
static 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/unfocusfocus
- 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 widgetReturns:
the widget's tab index
-
getFocusableChildren
public static com.google.gwt.dom.client.Element[] getFocusableChildren(com.google.gwt.dom.client.Element parent)
Finds all the focusable children of given parent element.
Parameters:
parent
- the parent elementReturns:
array of focusable children
Since:
8.1.7
-
focusOnFirstFocusableElement
public static void focusOnFirstFocusableElement(com.google.gwt.dom.client.Element parent)
Moves the focus to the first focusable child of given parent element.
Parameters:
parent
- the parent elementSince:
8.1.7
-
focusOnLastFocusableElement
public static void focusOnLastFocusableElement(com.google.gwt.dom.client.Element parent)
Moves the focus to the last focusable child of given parent element.
Parameters:
parent
- the parent elementSince:
8.1.7
-
-