Class UIFocusEvent
- All Implemented Interfaces:
IMessageBox
The UI Focus Event is fired when the UI focus changes for a component, or when connected to the panel, for every child item in it.
A focus change is two events: a focus lost to the component that had the focus, then a focus gained to the component that receives it. In each, getSource() is the component the event is about and getOpposite() is the other one: for a focus gained the component that lost the focus, for a focus lost the component that gains it. The opposite is null when the focus came from nothing (the first focus) or goes to nothing, and when the other focus component is not an UI component.
- Author:
- Christopher Mindus
Nested Class Summary
Nested classes/interfaces inherited from interface IMessageBox
IMessageBox.IconField Summary
Fields inherited from interface IMessageBox
ICON_ERROR, ICON_INFORMATION, ICON_MAP, ICON_NONE, ICON_QUESTION, ICON_WARNINGConstructor Summary
ConstructorsConstructorDescriptionUIFocusEvent(UIComp source, UIComp opposite, boolean isFocusGained) Constructs the event for a change without a trigger source.UIFocusEvent(UIComp source, UIComp opposite, boolean isFocusGained, GProp<?> trigger) Constructs the event for a change event with a property being the trigger source, e.g.Method Summary
Modifier and TypeMethodDescriptionGets the opposite component for the focus operation, i.e.Gets the UI component that is the source of the event, i.e.GProp<?> Gets the trigger property being the source of the event.booleanReturns if this is the focus gained operation.booleanReturns if this is the focus lost operation.protected StringGets the parameter string.Methods inherited from class UIBaseEvent
getAppSessionGyro, getClientSessionGyro, getContainerFirstUIComponent, getContainerFirstUIComponentNull, getFirstUIComponent, getFirstUIComponentNull, getPanelUIComponent, getPanelUIComponentNull, getUIPanel, getVirtualSpaceMethods inherited from class BaseEvent
getAction, getAction2, getActionNull, getActionNull2, getField, getField2, getFieldNull, getFieldNull2, getGroup, getGroup2, getGroupNull, getGroupNull2, getTable, getTable2, getTableNull, getTableNull2, getTime, getVirtualizedVirtualSpace, getVSComponent, getVSComponent2, getVSComponentNull, getVSComponentNull2, messageBox, toStringMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface IMessageBox
messageBox, messageBox, messageBox
Constructor Details
UIFocusEvent
Constructs the event for a change without a trigger source.- Parameters:
source- The source.opposite- The opposite component: the one losing focus for a focus gained, the one gaining focus for a focus lost, null for none.isFocusGained- Flag indicating focus was gained.- Throws:
NullPointerException- If the source is null.
UIFocusEvent
Constructs the event for a change event with a property being the trigger source, e.g. an UIButton or UICheckBox.- Parameters:
source- The source.opposite- The opposite component: the one losing focus for a focus gained, the one gaining focus for a focus lost, null for none.isFocusGained- Flag indicating focus was gained.trigger- The trigger property.
Method Details
getTrigger
Gets the trigger property being the source of the event.- Returns:
- An instance of e.g. an UIButton, UICheckBox, a VS component or null if the trigger is not a property.
getSource
Gets the UI component that is the source of the event, i.e. the item that gains or loses focus.getOpposite
Gets the opposite component for the focus operation, i.e. if the operation is FocusGained, the opposite component is the one losing focus, and if the operation is FocusLost, the opposite component is the component gaining focus.The opposite may belong to another panel than the source, and may already be disposed of (the focus moves away from a component that is disposed of).
- Returns:
- The opposite component, or
nullwhen the focus came from nothing or goes to nothing, or from or to a focus component that is not an UI component.
isFocusGained
public boolean isFocusGained()Returns if this is the focus gained operation.- Returns:
trueif this is focus gained,falsefor focus lost.
isFocusLost
public boolean isFocusLost()Returns if this is the focus lost operation.- Returns:
trueif this is focus lost,falsefor focus gained.
paramString
Gets the parameter string.- Overrides:
paramStringin classBaseEvent<UIComp>