Package com.inductiveautomation.snap.ui
Class UIHelper<T>
- java.lang.Object
-
- com.inductiveautomation.snap.ui.UIHelper<T>
-
- Direct Known Subclasses:
RMViewerOwnerHpr
,SwingHelper
public abstract class UIHelper<T> extends java.lang.Object
A class to provide utility methods for UI components.
-
-
Constructor Summary
Constructors Constructor Description UIHelper()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
addBinding(T anObj, Binding aBinding)
Adds the individual binding at the given index to given UI node.void
enableEvents(T anObj, UIEvent.Type... theTypes)
Called to enable events.java.lang.String
getAction(T anObj)
Returns the action for a node.Binding
getBinding(T anObj, int anIndex)
Returns the individual binding at the given index for given UI node.Binding
getBinding(T anObj, java.lang.String aPropertyName)
Returns the individual binding for the given property name.int
getBindingCount(T anObj)
Returns the number of bindings associated with given UI node.abstract java.lang.Object
getChild(T anObj, int anIndex)
Returns the individual child object for given object and index.java.lang.Object
getChild(T anObj, java.lang.String aName)
Returns first child with matching name, recursively, depth first.abstract int
getChildCount(T anObj)
Returns the number of children for given object.abstract UIHelper
getHelper(java.lang.Object anObj)
Returns the Helper object for a given object.java.lang.String
getItemDisplayKey(T anObj)
Sets the display key for UI node item.java.util.List
getItems(T anObj)
Returns the items for an object.protected java.lang.Object
getKeyValue(java.lang.Object anObj, java.lang.String aKey)
Returns a key value.abstract java.lang.String
getName(T anObj)
Returns the name of the given object.abstract UIOwner
getOwner(T anObj)
Returns given component's owner.abstract java.lang.Object
getParent(T anObj)
Returns the parent object for given object.java.lang.String
getPropertyNameMapped(T anObj, java.lang.String aPropertyName)
Returns a mapped property name name.java.util.List<java.lang.String>
getPropertyNames(T anObj)
Returns the property names for helper's instance class.protected java.util.List<java.lang.String>
getPropertyNamesImpl(T anObj)
Returns the property names for helper's instance class.int
getSelectedIndex(T anObj)
Returns the selected index property of given object.int[]
getSelectedIndexes(T anObj)
int[]
getSelectedIndexs(T anObj)
Returns the selected index property of given object.java.lang.Object
getSelectedItem(T anObj)
Returns the selected object property of given object.java.lang.String
getText(T anObj)
Returns the text property of given object.java.lang.Object
getValue(T anObj, java.lang.String aPropertyName)
Returns an object's value for given property name.void
initUI(T anObj, UIOwner anOwner)
Initializes the given object to send Events to target.void
initUIDeep(T anObj, UIOwner anOwner)
Initializes the given object and its children to send Events to target.boolean
isEnabled(T anObj)
Returns whether given UI node is enabled.abstract boolean
isEnabled(T anObj, UIEvent.Type aType)
Returns whether given event is enabled.boolean
isPropertyName(T anObj, java.lang.String aPropertyName)
Returns whether a given property name is valid for given object.boolean
isValueAdjusting(T anObj)
Returns whether UI node value is adjusting.Binding
removeBinding(T anObj, int anIndex)
Removes the binding at the given index from given UI node.boolean
removeBinding(T anObj, java.lang.String aPropertyName)
Removes the binding with given property name from given UI node.void
setAction(T anObj, java.lang.String anAction)
Sets the action for a node.void
setEnabled(T anObj, boolean aValue)
Sets whether given UI node is enabled.abstract void
setEnabled(T anObj, UIEvent.Type aType, boolean aValue)
Returns whether given event is enabled.void
setItemDisplayKey(T anObj, java.lang.String aKey)
Sets the display key for UI node item.void
setItems(T anObj, java.lang.Object[] theItems)
Sets the items for an object.void
setItems(T anObj, java.util.List theItems)
Sets the items for an object.protected void
setKeyValue(java.lang.Object anObj, java.lang.String aKey, java.lang.Object aValue)
Sets a KeyValue.abstract void
setOwner(T anObj, UIOwner anOwner)
Sets given component's owner.void
setSelectedIndex(T anObj, int anIndex)
Sets the selected index property of given object to given value.void
setSelectedIndexes(T anObj, int[] theIndexes)
Sets the selected index property of given object to given value.void
setSelectedItem(T anObj, java.lang.Object aValue)
Sets the selected object property of given object to given value.void
setText(T anObj, java.lang.String aString)
Sets the text property of given object to given string.void
setValue(T anObj, java.lang.String aPropertyName, java.lang.Object aValue)
Sets an object's value for given property name.
-
-
-
Method Detail
-
getName
public abstract java.lang.String getName(T anObj)
Returns the name of the given object.
-
initUI
public void initUI(T anObj, UIOwner anOwner)
Initializes the given object to send Events to target.
-
initUIDeep
public void initUIDeep(T anObj, UIOwner anOwner)
Initializes the given object and its children to send Events to target.
-
getParent
public abstract java.lang.Object getParent(T anObj)
Returns the parent object for given object.
-
getChildCount
public abstract int getChildCount(T anObj)
Returns the number of children for given object.
-
getChild
public abstract java.lang.Object getChild(T anObj, int anIndex)
Returns the individual child object for given object and index.
-
getChild
public java.lang.Object getChild(T anObj, java.lang.String aName)
Returns first child with matching name, recursively, depth first.
-
isPropertyName
public boolean isPropertyName(T anObj, java.lang.String aPropertyName)
Returns whether a given property name is valid for given object.
-
getPropertyNames
public java.util.List<java.lang.String> getPropertyNames(T anObj)
Returns the property names for helper's instance class.
-
getPropertyNamesImpl
protected java.util.List<java.lang.String> getPropertyNamesImpl(T anObj)
Returns the property names for helper's instance class.
-
getPropertyNameMapped
public java.lang.String getPropertyNameMapped(T anObj, java.lang.String aPropertyName)
Returns a mapped property name name.
-
getAction
public java.lang.String getAction(T anObj)
Returns the action for a node.
-
setAction
public void setAction(T anObj, java.lang.String anAction)
Sets the action for a node.
-
getBindingCount
public int getBindingCount(T anObj)
Returns the number of bindings associated with given UI node.
-
getBinding
public Binding getBinding(T anObj, int anIndex)
Returns the individual binding at the given index for given UI node.
-
getBinding
public Binding getBinding(T anObj, java.lang.String aPropertyName)
Returns the individual binding for the given property name.
-
addBinding
public void addBinding(T anObj, Binding aBinding)
Adds the individual binding at the given index to given UI node.
-
removeBinding
public Binding removeBinding(T anObj, int anIndex)
Removes the binding at the given index from given UI node.
-
removeBinding
public boolean removeBinding(T anObj, java.lang.String aPropertyName)
Removes the binding with given property name from given UI node.
-
getValue
public java.lang.Object getValue(T anObj, java.lang.String aPropertyName)
Returns an object's value for given property name.
-
setValue
public void setValue(T anObj, java.lang.String aPropertyName, java.lang.Object aValue)
Sets an object's value for given property name.
-
getText
public java.lang.String getText(T anObj)
Returns the text property of given object.
-
setText
public void setText(T anObj, java.lang.String aString)
Sets the text property of given object to given string.
-
getItems
public java.util.List getItems(T anObj)
Returns the items for an object.
-
setItems
public void setItems(T anObj, java.util.List theItems)
Sets the items for an object.
-
setItems
public void setItems(T anObj, java.lang.Object[] theItems)
Sets the items for an object.
-
getItemDisplayKey
public java.lang.String getItemDisplayKey(T anObj)
Sets the display key for UI node item.
-
setItemDisplayKey
public void setItemDisplayKey(T anObj, java.lang.String aKey)
Sets the display key for UI node item.
-
getSelectedIndex
public int getSelectedIndex(T anObj)
Returns the selected index property of given object.
-
setSelectedIndex
public void setSelectedIndex(T anObj, int anIndex)
Sets the selected index property of given object to given value.
-
getSelectedIndexs
public int[] getSelectedIndexs(T anObj)
Returns the selected index property of given object.Kept in case someone is using reflection with the misspelling
-
getSelectedIndexes
public int[] getSelectedIndexes(T anObj)
-
setSelectedIndexes
public void setSelectedIndexes(T anObj, int[] theIndexes)
Sets the selected index property of given object to given value.
-
getSelectedItem
public java.lang.Object getSelectedItem(T anObj)
Returns the selected object property of given object.
-
setSelectedItem
public void setSelectedItem(T anObj, java.lang.Object aValue)
Sets the selected object property of given object to given value.
-
isValueAdjusting
public boolean isValueAdjusting(T anObj)
Returns whether UI node value is adjusting.
-
isEnabled
public boolean isEnabled(T anObj)
Returns whether given UI node is enabled.
-
setEnabled
public void setEnabled(T anObj, boolean aValue)
Sets whether given UI node is enabled.
-
isEnabled
public abstract boolean isEnabled(T anObj, UIEvent.Type aType)
Returns whether given event is enabled.
-
setEnabled
public abstract void setEnabled(T anObj, UIEvent.Type aType, boolean aValue)
Returns whether given event is enabled.
-
getKeyValue
protected java.lang.Object getKeyValue(java.lang.Object anObj, java.lang.String aKey)
Returns a key value.
-
setKeyValue
protected void setKeyValue(java.lang.Object anObj, java.lang.String aKey, java.lang.Object aValue)
Sets a KeyValue.
-
enableEvents
public void enableEvents(T anObj, UIEvent.Type... theTypes)
Called to enable events.
-
getHelper
public abstract UIHelper getHelper(java.lang.Object anObj)
Returns the Helper object for a given object.
-
-