|
GWT Tk 0.2.3 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectasquare.gwt.tk.client.ui.behavior.FocusModel
public class FocusModel
A primitive focus model. Tracks the widgets in a focus cycle and which widget should be focused.
| Constructor Summary | |
|---|---|
FocusModel()
|
|
| Method Summary | |
|---|---|
void |
add(HasFocus widget)
Add a widget to the model. |
void |
add(HasFocus[] widgets)
Add widgets to the model in bulk. |
void |
addListener(FocusModelListener listener)
|
void |
clear()
Remove all widgets from the model. |
int |
getCurrentIndex()
Get the index corresponding to the currently focused widget. |
HasFocus |
getFocusWidget()
Get the widget which is focused. |
int |
getIndexOf(HasFocus widget)
Get the index of the specified widget in the model. |
HasFocus |
getNextWidget()
Get the widget after the currently focused widget. |
HasFocus |
getNextWidget(boolean forward)
Get the next widget in the cycle. |
HasFocus |
getPreviousWidget()
Get the widget previous to the currently focused widget. |
int |
getSize()
Get the number of widgets in the model. |
HasFocus |
getWidgetAt(int index)
Get the widget at the specified index. |
void |
insert(HasFocus widget,
int index)
Inserts a widget into to the model at the specified index. |
void |
remove(HasFocus widget)
Removes a widget from the model. |
void |
removeListener(FocusModelListener listener)
|
void |
setFocusWidget(HasFocus widget)
Set the widget which is focused. |
protected boolean |
shouldAdd(HasFocus widget)
Determines whether the specified Widget can be added to the model. |
protected boolean |
shouldFocus(HasFocus w)
Determines whether the specified Widget can receive focus. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public FocusModel()
| Method Detail |
|---|
public void addListener(FocusModelListener listener)
public void removeListener(FocusModelListener listener)
public int getSize()
public void clear()
public void add(HasFocus[] widgets)
widgets - an array of 0 or more widgets
IllegalArgumentException - if widgets is null
IllegalArgumentException - if an element is null
IllegalArgumentException - if an element is already present in the modelshouldAdd(HasFocus)public void add(HasFocus widget)
widget - a widget
IllegalArgumentException - if widget is null
IllegalArgumentException - if widget is already present in the modelshouldAdd(HasFocus)
public void insert(HasFocus widget,
int index)
widget - a widgetindex - an integer greater than 0 and less than or equal to number of
widgets in the model
IllegalArgumentException - if widget is null
IllegalArgumentException - if widget is already present in the model
IndexOutOfBoundsException - if index < 0 || index > getSize()shouldAdd(HasFocus)protected boolean shouldAdd(HasFocus widget)
widget - a widget which is candidate to be added to the model
true if widget.getTabIndex() >= 0public int getCurrentIndex()
0 and
getSize(), or -1 if no
widget is focusedpublic int getIndexOf(HasFocus widget)
widget - a widget
-1 if widget is
not present in the model
IllegalArgumentException - if widget is
nullpublic HasFocus getWidgetAt(int index)
index - an integer greater than 0 and less than or equal to number of
widgets in the model
IndexOutOfBoundsException - if index is out of rangepublic void remove(HasFocus widget)
widget - public HasFocus getFocusWidget()
null if no widget is focusedpublic void setFocusWidget(HasFocus widget)
widget - a widget in the model, or null
IllegalArgumentException - if widget is not
present in the model and not nullpublic HasFocus getNextWidget(boolean forward)
(widget.getTabIndex() < 0 || ! widget.isEnabled()).
forward - true to cycle forward, false to cycle backward
null no if focusable widget is available
IllegalStateException - if the model is emptypublic HasFocus getNextWidget()
IllegalStateException - if the model is emptypublic HasFocus getPreviousWidget()
IllegalStateException - if the model is emptyprotected boolean shouldFocus(HasFocus w)
w - a widget in this model which is candidate for focus
true unless w is a disabled
FocusWidget
|
GWT Tk 0.2.3 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||