public class FocusManager
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static int |
FOCUS_HIDDEN
State of the focus on entry to waitFor: hidden, as in not visible.
|
static int |
FOCUS_INVALID
State of the focus on entry to waitFor: invalid
|
static boolean |
FOCUS_NOWRAP
Lookup mode for focusable widgets in frames: no wrap
|
static int |
FOCUS_UNDEF
State of the focus on entry to waitFor: undefined
|
static int |
FOCUS_VALID
State of the focus on entry to waitFor: valid
|
static boolean |
FOCUS_WRAP
Lookup mode for focusable widgets in frames: wrap
|
private boolean |
noFocusAdjustment
Do not adjust focus in WAIT-FOR if set
|
private ThinClient |
tc
Owner
ThinClient instance. |
private boolean |
tempFocusChange
Flag indicating that we are within a temporary focus change
|
Constructor and Description |
---|
FocusManager(ThinClient tc)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
adjustFocus()
Adjusts focus if it is either undefined or invalid and a trigger has
enabled at least one widget.
|
boolean |
focusChange(Widget widget,
boolean afterTab,
boolean direction)
Performs conditional focus change procedure to the next or previous
widget in the tab order.
|
boolean |
focusInvalidExplicit(Widget inFocus,
Widget toFocus,
EventList list)
Sets initial focus for the WAIT-FOR with invalid focus on entry
and an explicit FOCUS specification.
|
boolean |
focusInvalidImplicit(Widget inFocus)
Sets initial focus for the WAIT-FOR with invalid focus on entry
and no explicit FOCUS specification.
|
static int |
focusState(Widget inFocus)
Sets initial focus for the WAIT-FOR with valid focus on entry
and no explicit FOCUS specification.
|
boolean |
focusUndefExplicit(Widget toFocus,
EventList list,
int cop,
boolean explicit)
Sets initial focus for the WAIT-FOR with undefined focus on entry
and an explicit FOCUS specification.
|
boolean |
focusUndefImplicit(EventList list,
boolean hidden)
Sets initial focus for the WAIT-FOR with undefined or hidden focus on
entry and no explicit FOCUS specification.
|
boolean |
focusValidExplicit(Widget inFocus,
Widget toFocus,
EventList list,
int cop,
boolean hidden)
Sets initial focus for the WAIT-FOR with valid focus on entry
and an explicit FOCUS specification.
|
boolean |
focusValidImplicit(Widget inFocus)
Sets initial focus for the WAIT-FOR with valid focus on entry
and no explicit FOCUS specification.
|
Widget |
getFirstEnabledWidget()
Looks up the very first enabled widget among all displayed frames and menubar.
|
boolean |
isNoFocusAdjustment()
Get state of the
noFocusAdjustment flag. |
boolean |
isTempFocusChange()
Check if we are within a temporary focus change
|
(package private) boolean |
searchForFocusWithEntry(Widget start,
Widget toFocus)
Search for focus with ENTRY, starting from the specified widget,
without wrapping.
|
boolean |
searchForFocusWithoutEntry(Widget start)
Search for focus without ENTRY, starting from the specified widget,
with wrapping in its frame.
|
void |
setFocusOn(Widget widget)
Sets focus on the specified widget silently and unconditionally.
|
static void |
setInitialFocus(Widget widget)
Force the initial focus to a specific widget when entering an
interactive/editing mode.
|
static boolean |
tryFocusChange(Widget widget)
Initiates the focus change procedure by creating and handling a LEAVE
event and, if that event is not consumed by a trigger, proceeds with
the focus change.
|
static boolean |
tryFocusChange(Widget widget,
boolean doLeave,
boolean doEntry)
Initiates the focus change procedure by creating and handling a LEAVE
event and, if that event is not consumed by a trigger, proceeds with
the focus change.
|
(package private) boolean |
widgetLostFocusability(Widget inFocus,
Widget toFocus,
boolean state,
int focusState)
If the toFocus widget lost its focusability, then:
if the inFocus and toFocus widgets are both in the same frame,
search for focus starting from:
toFocus, if inFocus is invalid
inFocus, if inFocus is valid
else, focus is undefined if:
inFocus is invalid
inFocus is valid and still focusable
inFocus is valid, not focusable: focus first enabled and
visible widget on screen, without ENTRY.
|
public static final int FOCUS_UNDEF
public static final int FOCUS_INVALID
public static final int FOCUS_VALID
public static final int FOCUS_HIDDEN
private final ThinClient tc
ThinClient
instance.private boolean noFocusAdjustment
public static final boolean FOCUS_WRAP
public static final boolean FOCUS_NOWRAP
private boolean tempFocusChange
public FocusManager(ThinClient tc)
tc
- Reference to ThinClient
.public void adjustFocus()
public boolean isTempFocusChange()
true
if we are within a temporary focus changepublic void setFocusOn(Widget widget)
widget
- widget to set focus on; it should be a valid widget, but
can be disabledpublic Widget getFirstEnabledWidget()
null
public boolean focusInvalidImplicit(Widget inFocus)
inFocus
- widget in focustrue
if WAIT-FOR can proceedpublic boolean focusValidExplicit(Widget inFocus, Widget toFocus, EventList list, int cop, boolean hidden)
inFocus
- widget in focustoFocus
- candidate widget for receiving focuslist
- list of event to wait forcop
- currently executed operationhidden
- true
if this is the case of hidden focustrue
if WAIT-FOR can proceedpublic boolean focusUndefImplicit(EventList list, boolean hidden)
list
- list of event to wait forhidden
- true
if this is the case of hidden initial focustrue
if WAIT-FOR can proceedpublic boolean focusUndefExplicit(Widget toFocus, EventList list, int cop, boolean explicit)
toFocus
- candidate widget for receiving focuslist
- list of event to wait forcop
- currently executed operationexplicit
- when true
, it marks a real explicit focus; else, it
marks explicit focus generated due to previous pending focus, in
non-nested trigger mode.true
if WAIT-FOR can proceedpublic boolean focusInvalidExplicit(Widget inFocus, Widget toFocus, EventList list)
inFocus
- widget in focustoFocus
- candidate widget for receiving focuslist
- list of event to wait fortrue
if WAIT-FOR can proceedboolean widgetLostFocusability(Widget inFocus, Widget toFocus, boolean state, int focusState)
inFocus
- the focus before the ENTRY event was triggeredtoFocus
- the widget which had ENTRY eventstate
- previous state of this widget (focusable or not)focusState
- the state of the focused widget, as before the trigger was
invoked (valid or invalid).true
if this widget lost focusabilityboolean searchForFocusWithEntry(Widget start, Widget toFocus)
start
- the widget from which focus search starttoFocus
- If search reaches this widget, sending ENTRY will be skipped.true
if a widget was foundpublic boolean focusValidImplicit(Widget inFocus)
inFocus
- widget in focustrue
always to indicate successpublic static int focusState(Widget inFocus)
inFocus
- widget in focustrue
always to indicate successpublic boolean searchForFocusWithoutEntry(Widget start)
start
- the widget from which focus search starttrue
if a widget was foundpublic static boolean tryFocusChange(Widget widget)
widget
- Component
that is the candidate to receive focus.true
if focus change is successful.public static boolean tryFocusChange(Widget widget, boolean doLeave, boolean doEntry)
Conditionally issues ENTRY event that follows the focus change.
widget
- Component
that is the candidate to receive focus.doLeave
- true
means LEAVE event will be issueddoEntry
- true
means ENTRY event will be issuedtrue
if focus change is successful.public boolean focusChange(Widget widget, boolean afterTab, boolean direction)
widget
- Component
that is the reference widget, which is
currently retaining focus.afterTab
- flag indication if focus change was initiate by TAB/BACK-TABdirection
- The direction of focus change. If this parameter is set to
true
then next in Tab order widget is selected.true
if the focus change is successful.public boolean isNoFocusAdjustment()
noFocusAdjustment
flag.public static void setInitialFocus(Widget widget)
FOCUS_GAINED
but it will not generate a LEAVE
or FOCUS_LOST
since it is the initial focus set.
This processing will cause a repaint so it must be bracketed by invalidation processing in the caller.
widget
- The widget to receive focus (must not be null
).