Package com.inductiveautomation.snap.ui
Class UIOwner<EVENT extends UIEvent,UITYPE>
- java.lang.Object
-
- com.inductiveautomation.snap.ui.UIOwner<EVENT,UITYPE>
-
- Direct Known Subclasses:
RMViewerOwner,SwingOwner
public abstract class UIOwner<EVENT extends UIEvent,UITYPE> extends java.lang.ObjectA base controller class class that manages a SwingPanel usually loaded from a rib file.
-
-
Field Summary
Fields Modifier and Type Field Description static UIEvent.TypeDragDropstatic UIEvent.TypeDragEnterUIEvent.Type[]DragEventsstatic UIEvent.TypeDragExitstatic UIEvent.TypeDragOverUIEvent.Type[]KeyEventsstatic UIEvent.TypeKeyFinishedstatic UIEvent.TypeKeyPressedstatic UIEvent.TypeKeyReleasedstatic UIEvent.TypeKeyTypedstatic UIEvent.TypeMouseClickedstatic UIEvent.TypeMouseDraggedstatic UIEvent.TypeMouseEnteredUIEvent.Type[]MouseEventsstatic UIEvent.TypeMouseExitedstatic UIEvent.TypeMouseFinishedstatic UIEvent.TypeMouseMovedstatic UIEvent.TypeMousePressedstatic UIEvent.TypeMouseReleased
-
Constructor Summary
Constructors Constructor Description UIOwner()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract voidaddKeyActionEvent(java.lang.String aName, java.lang.String aKey)Configures an ActionEvent to be sent to owner for given name and key description (in KeyStroke string format).voidaddNodeBinding(java.lang.Object anObj, java.lang.String aPropertyName, java.lang.String aKeyPath)Adds a binding to a UI node.protected abstract UITYPEcreateUI()Creates the UI panel.voiddisableEvents(java.lang.Object anObj, UIEvent.Type... theTypes)Enables events on given object.voidenableEvents(java.lang.Object anObj, UIEvent.Type... theTypes)Enables events on given object.protected java.lang.ObjectgetBindingModelValue(Binding aBinding)Returns the key value for a given binding.protected java.lang.ObjectgetBindingNodeValue(Binding aBinding)Returns the UI node value for the given binding.java.util.Map<java.lang.String,java.lang.String>getConversionMap(java.lang.String aName)Returns a named map to perform value conversions.protected java.lang.ObjectgetConversionMapKey(java.lang.String aConversionMapName, java.lang.Object aValue)Converts a UI node value to binder object value using conversion key map.java.util.Map<java.lang.String,java.util.Map>getConversionMaps()Returns the map of maps, each of which is used to perform value conversions.java.lang.ObjectgetConversionMapValue(java.lang.String aConversionMapName, java.lang.Object aKey)Converts a binder object value to UI node using conversion key map.java.lang.ObjectgetFirstFocus()Returns the first focus UI node for when window/dialog is made visible.java.lang.ObjectgetModelValue(java.lang.String aKey)Returns the model value for given key expression from this UIOwner.protected UITYPEgetNode(java.lang.Object anObj)Returns the specific UI child node for given object (name, event or node).UITYPEgetNode(java.lang.String aName)Returns the specific UI child node with the given name.<T extends UITYPE>
TgetNode(java.lang.String aName, java.lang.Class<T> aClass)Returns the specific UI child node with the given name as the given class.java.lang.StringgetNodeAction(java.lang.Object anObj)Returns a node action.booleangetNodeBoolValue(java.lang.Object anObj)Returns the boolean value for a given name or UI node.floatgetNodeFloatValue(java.lang.Object anObj)Returns the float value for a given name or UI node.protected abstract UIHelpergetNodeHelper(java.lang.Object anObj)Returns the helper for a given UI node.intgetNodeIntValue(java.lang.Object anObj)Returns the int value for a given name or UI node.java.lang.StringgetNodeItemDisplayKey(java.lang.Object anObj, java.lang.String aKey)Returns the display key for given name or UI node.java.util.ListgetNodeItems(java.lang.Object anObj)Returns the items for a given name or UI node.intgetNodeSelectedIndex(java.lang.Object anObj)Returns the selected index for given name or UI node.java.lang.ObjectgetNodeSelectedItem(java.lang.Object anObj)Returns the selected item for given name or UI node.java.lang.StringgetNodeStringValue(java.lang.Object anObj)Returns the string value for a given name or UI node.java.lang.StringgetNodeText(java.lang.Object anObj)Returns the text value for a given name or UI node.java.lang.ObjectgetNodeValue(java.lang.Object anObj)Returns the object value for a given name or UI node.UITYPEgetUI()Returns the main UI node.<T extends UITYPE>
TgetUI(java.lang.Class<T> aClass)Returns the main UI node with the given name as the given class.protected UIHelpergetUIHpr()Returns the helper for a given object.protected voidinitUI()Initializes the UI panel.protected voidinitUI(java.lang.Object anObj)Initialize UI.protected abstract booleanisEventThread()Returns whether current thread is event thread.voidisNodeEnabled(java.lang.Object anObj)Returns whether given name or UI node is enabled.booleanisNodeValueAdjusting(java.lang.Object anObj)Returns whether given name or UI node is currently being modified.booleanisSendEventDisabled()Returns whether Ribs' send event facility is disabled (so controls can be updated without triggering response).booleanisUISet()Returns whether UI has been set.protected voidprocessResetUI()Called to reset bindings and resetUI().protected voidprocessRespondUI(EVENT anEvent)Called to invoke respondUI().abstract voidrequestFocus(java.lang.Object anObj)Focuses given UI node (name or node).voidresetLater()Resets UI later.protected voidresetNodeBindings(java.lang.Object anObj)Reset bindings for UI node (recurses for children).protected voidresetUI()Reset UI controls.protected voidrespondUI(EVENT anEvent)Respond to UI controls.abstract voidrunLater(java.lang.Runnable aRunnable)Runs the given runnable in the next event.voidrunLaterDelayed(int aDelay, java.lang.Runnable aRunnable)Runs the runnable after the given delay in milliseconds.voidrunLaterOnce(java.lang.String aName, java.lang.Runnable aRunnable)Invokes the given runnable for name once (cancels unexecuted previous runLater registered with same name).voidsendEvent(EVENT anEvent)Sends an event for a UI node.abstract voidsendEvent(java.lang.Object anObj)Sends an event for a UI node (name or node).protected voidsendNodeAction(java.lang.Object anObj, java.lang.String anAction)Sends a node action.protected voidsetBindingModelValue(Binding aBinding)Sets the key value for the given binding from the UI node.protected voidsetBindingNodeValue(Binding aBinding)Sets the UI node value for the given binding from the key value.voidsetFirstFocus(java.lang.Object anObj)Sets the first focus UI node.voidsetModelValue(java.lang.String aKey, java.lang.Object aValue)Sets the model value for given key expression and value for this UIOwner.voidsetNodeAction(java.lang.Object anObj, java.lang.String anAction)Sets a node action.voidsetNodeEnabled(java.lang.Object anObj, boolean aValue)Sets whether given name or UI node is enabled.voidsetNodeItemDisplayKey(java.lang.Object anObj, java.lang.String aKey)Sets the display key for given name or UI node.voidsetNodeItems(java.lang.Object anObj, java.lang.Object... theItems)Sets the items for a given name or UI node.voidsetNodeItems(java.lang.Object anObj, java.util.List theItems)Sets the items for a given name or UI node.voidsetNodeSelectedIndex(java.lang.Object anObj, int aValue)Sets the selected index for given name or UI node.voidsetNodeSelectedItem(java.lang.Object anObj, java.lang.Object anItem)Sets the selected item for given name or UI node.voidsetNodeText(java.lang.Object anObj, java.lang.String aValue)Sets the object value for a given name or UI node.voidsetNodeValue(java.lang.Object anObj, java.lang.Object aValue)Sets the object value for a given name or UI node.booleansetSendEventDisabled(boolean aFlag)Sets whether Ribs' send event facility is disabled (so controls can be updated without triggering response).
-
-
-
Field Detail
-
KeyPressed
public static final UIEvent.Type KeyPressed
-
KeyReleased
public static final UIEvent.Type KeyReleased
-
KeyTyped
public static final UIEvent.Type KeyTyped
-
KeyFinished
public static final UIEvent.Type KeyFinished
-
MousePressed
public static final UIEvent.Type MousePressed
-
MouseDragged
public static final UIEvent.Type MouseDragged
-
MouseReleased
public static final UIEvent.Type MouseReleased
-
MouseClicked
public static final UIEvent.Type MouseClicked
-
MouseFinished
public static final UIEvent.Type MouseFinished
-
MouseEntered
public static final UIEvent.Type MouseEntered
-
MouseMoved
public static final UIEvent.Type MouseMoved
-
MouseExited
public static final UIEvent.Type MouseExited
-
DragEnter
public static final UIEvent.Type DragEnter
-
DragOver
public static final UIEvent.Type DragOver
-
DragExit
public static final UIEvent.Type DragExit
-
DragDrop
public static final UIEvent.Type DragDrop
-
KeyEvents
public UIEvent.Type[] KeyEvents
-
MouseEvents
public UIEvent.Type[] MouseEvents
-
DragEvents
public UIEvent.Type[] DragEvents
-
-
Method Detail
-
isUISet
public boolean isUISet()
Returns whether UI has been set.
-
getUI
public UITYPE getUI()
Returns the main UI node.
-
getUI
public <T extends UITYPE> T getUI(java.lang.Class<T> aClass)
Returns the main UI node with the given name as the given class.
-
createUI
protected abstract UITYPE createUI()
Creates the UI panel.
-
initUI
protected void initUI()
Initializes the UI panel.
-
initUI
protected void initUI(java.lang.Object anObj)
Initialize UI.
-
resetUI
protected void resetUI()
Reset UI controls.
-
respondUI
protected void respondUI(EVENT anEvent)
Respond to UI controls.
-
resetLater
public void resetLater()
Resets UI later.
-
processResetUI
protected void processResetUI()
Called to reset bindings and resetUI().
-
processRespondUI
protected void processRespondUI(EVENT anEvent)
Called to invoke respondUI().
-
getNode
public UITYPE getNode(java.lang.String aName)
Returns the specific UI child node with the given name.
-
getNode
protected UITYPE getNode(java.lang.Object anObj)
Returns the specific UI child node for given object (name, event or node).
-
getNode
@Nullable public <T extends UITYPE> T getNode(java.lang.String aName, java.lang.Class<T> aClass)
Returns the specific UI child node with the given name as the given class.
-
getNodeValue
public java.lang.Object getNodeValue(java.lang.Object anObj)
Returns the object value for a given name or UI node.
-
setNodeValue
public void setNodeValue(java.lang.Object anObj, java.lang.Object aValue)Sets the object value for a given name or UI node.
-
getNodeStringValue
public java.lang.String getNodeStringValue(java.lang.Object anObj)
Returns the string value for a given name or UI node.
-
getNodeBoolValue
public boolean getNodeBoolValue(java.lang.Object anObj)
Returns the boolean value for a given name or UI node.
-
getNodeIntValue
public int getNodeIntValue(java.lang.Object anObj)
Returns the int value for a given name or UI node.
-
getNodeFloatValue
public float getNodeFloatValue(java.lang.Object anObj)
Returns the float value for a given name or UI node.
-
getNodeText
public java.lang.String getNodeText(java.lang.Object anObj)
Returns the text value for a given name or UI node.
-
setNodeText
public void setNodeText(java.lang.Object anObj, java.lang.String aValue)Sets the object value for a given name or UI node.
-
getNodeItems
public java.util.List getNodeItems(java.lang.Object anObj)
Returns the items for a given name or UI node.
-
setNodeItems
public void setNodeItems(java.lang.Object anObj, java.util.List theItems)Sets the items for a given name or UI node.
-
setNodeItems
public void setNodeItems(java.lang.Object anObj, java.lang.Object... theItems)Sets the items for a given name or UI node.
-
getNodeItemDisplayKey
public java.lang.String getNodeItemDisplayKey(java.lang.Object anObj, java.lang.String aKey)Returns the display key for given name or UI node.
-
setNodeItemDisplayKey
public void setNodeItemDisplayKey(java.lang.Object anObj, java.lang.String aKey)Sets the display key for given name or UI node.
-
getNodeSelectedIndex
public int getNodeSelectedIndex(java.lang.Object anObj)
Returns the selected index for given name or UI node.
-
setNodeSelectedIndex
public void setNodeSelectedIndex(java.lang.Object anObj, int aValue)Sets the selected index for given name or UI node.
-
getNodeSelectedItem
public java.lang.Object getNodeSelectedItem(java.lang.Object anObj)
Returns the selected item for given name or UI node.
-
setNodeSelectedItem
public void setNodeSelectedItem(java.lang.Object anObj, java.lang.Object anItem)Sets the selected item for given name or UI node.
-
isNodeEnabled
public void isNodeEnabled(java.lang.Object anObj)
Returns whether given name or UI node is enabled.
-
setNodeEnabled
public void setNodeEnabled(java.lang.Object anObj, boolean aValue)Sets whether given name or UI node is enabled.
-
isNodeValueAdjusting
public boolean isNodeValueAdjusting(java.lang.Object anObj)
Returns whether given name or UI node is currently being modified.
-
getNodeHelper
protected abstract UIHelper getNodeHelper(java.lang.Object anObj)
Returns the helper for a given UI node.
-
getNodeAction
public java.lang.String getNodeAction(java.lang.Object anObj)
Returns a node action.
-
setNodeAction
public void setNodeAction(java.lang.Object anObj, java.lang.String anAction)Sets a node action.
-
sendNodeAction
protected void sendNodeAction(java.lang.Object anObj, java.lang.String anAction)Sends a node action.
-
addNodeBinding
public void addNodeBinding(java.lang.Object anObj, java.lang.String aPropertyName, java.lang.String aKeyPath)Adds a binding to a UI node.
-
resetNodeBindings
protected void resetNodeBindings(java.lang.Object anObj)
Reset bindings for UI node (recurses for children).
-
getBindingNodeValue
protected java.lang.Object getBindingNodeValue(Binding aBinding)
Returns the UI node value for the given binding.
-
setBindingNodeValue
protected void setBindingNodeValue(Binding aBinding)
Sets the UI node value for the given binding from the key value.
-
getBindingModelValue
protected java.lang.Object getBindingModelValue(Binding aBinding)
Returns the key value for a given binding.
-
setBindingModelValue
protected void setBindingModelValue(Binding aBinding)
Sets the key value for the given binding from the UI node.
-
getFirstFocus
public java.lang.Object getFirstFocus()
Returns the first focus UI node for when window/dialog is made visible.
-
setFirstFocus
public void setFirstFocus(java.lang.Object anObj)
Sets the first focus UI node.
-
requestFocus
public abstract void requestFocus(java.lang.Object anObj)
Focuses given UI node (name or node).
-
getConversionMaps
public java.util.Map<java.lang.String,java.util.Map> getConversionMaps()
Returns the map of maps, each of which is used to perform value conversions.
-
getConversionMap
public java.util.Map<java.lang.String,java.lang.String> getConversionMap(java.lang.String aName)
Returns a named map to perform value conversions.
-
getConversionMapKey
protected java.lang.Object getConversionMapKey(java.lang.String aConversionMapName, java.lang.Object aValue)Converts a UI node value to binder object value using conversion key map.
-
getConversionMapValue
public java.lang.Object getConversionMapValue(java.lang.String aConversionMapName, java.lang.Object aKey)Converts a binder object value to UI node using conversion key map.
-
enableEvents
public void enableEvents(java.lang.Object anObj, UIEvent.Type... theTypes)Enables events on given object.
-
disableEvents
public void disableEvents(java.lang.Object anObj, UIEvent.Type... theTypes)Enables events on given object.
-
sendEvent
public abstract void sendEvent(java.lang.Object anObj)
Sends an event for a UI node (name or node).
-
sendEvent
public void sendEvent(EVENT anEvent)
Sends an event for a UI node.
-
isSendEventDisabled
public boolean isSendEventDisabled()
Returns whether Ribs' send event facility is disabled (so controls can be updated without triggering response).
-
setSendEventDisabled
public boolean setSendEventDisabled(boolean aFlag)
Sets whether Ribs' send event facility is disabled (so controls can be updated without triggering response).
-
addKeyActionEvent
public abstract void addKeyActionEvent(java.lang.String aName, java.lang.String aKey)Configures an ActionEvent to be sent to owner for given name and key description (in KeyStroke string format).- See Also:
KeyStroke
-
runLater
public abstract void runLater(java.lang.Runnable aRunnable)
Runs the given runnable in the next event.
-
runLaterDelayed
public void runLaterDelayed(int aDelay, java.lang.Runnable aRunnable)Runs the runnable after the given delay in milliseconds.
-
runLaterOnce
public void runLaterOnce(java.lang.String aName, java.lang.Runnable aRunnable)Invokes the given runnable for name once (cancels unexecuted previous runLater registered with same name).
-
isEventThread
protected abstract boolean isEventThread()
Returns whether current thread is event thread.
-
getUIHpr
protected UIHelper getUIHpr()
Returns the helper for a given object.
-
getModelValue
public java.lang.Object getModelValue(java.lang.String aKey)
Returns the model value for given key expression from this UIOwner.
-
setModelValue
public void setModelValue(java.lang.String aKey, java.lang.Object aValue)Sets the model value for given key expression and value for this UIOwner.
-
-