Package com.ribs
Class RJHelper
- java.lang.Object
-
- com.ribs.RJHelper
-
- Direct Known Subclasses:
JButtonOrLabelHpr
,JComboBoxHpr
,JListHpr
,JMenuBarHpr
,JMenuItemHpr
,JPopupMenuHpr
,JProgressBarHpr
,JScrollPaneHpr
,JSeparatorHpr
,JSliderHpr
,JSpinnerHpr
,JSplitPaneHpr
,JTabbedPaneHpr
,JTableHpr
,JTextComponentHpr
,JTreeHpr
,RJColorWellHpr
,RJCustomViewHpr
,RJPanelHpr
,RJSwitchPaneHpr
,RJThumbWheelHpr
public class RJHelper extends java.lang.Object
This class is used to provide Ribs functionality to Swing JComponents.
-
-
Constructor Summary
Constructors Constructor Description RJHelper()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(javax.swing.JComponent aComponent, javax.swing.JComponent aChild)
Adds a child into the parent's component heirarchy.void
focusGained(javax.swing.JComponent aComponent, java.awt.event.FocusEvent fe)
Called by default focus listener when the component gains focus.void
focusLost(javax.swing.JComponent aComponent, java.awt.event.FocusEvent fe)
Called by the default focus listener when focus is lost on a component, but before any action is fired.void
fromXML(javax.swing.JComponent aComponent, RXArchiver anArchiver, RXElement anElement)
XML unarchival utility method.void
fromXMLDeep(javax.swing.JComponent aComponent, RXArchiver anArchiver, RXElement anElement)
XML unarchival utility method.javax.swing.JComponent
get(javax.swing.JComponent aComponent, java.lang.String aName)
Returns the given component or any of its children that have the give name.java.awt.event.ActionListener
getActionListener()
Returns an action listener suitable for many controls.java.lang.Boolean
getAutoscrolls(javax.swing.JComponent aComponent)
Returns whether a component autoscrolls if explicitly set, null otherwise.java.lang.String
getAutosizing(javax.swing.JComponent aComponent)
Returns the autosizing for the given component.java.awt.Color
getBackground(javax.swing.JComponent aComponent)
Returns the given component's background color if explicitly set, otherwise null.java.lang.String
getBindKey(javax.swing.JComponent aComponent)
Returns this component's bind key chain.java.lang.Boolean
getBooleanValue(javax.swing.JComponent aComponent)
Returns a component's value as a Boolean.boolean
getBoolValue(javax.swing.JComponent aComponent)
Returns a component's value as a boolean.java.lang.String
getCallback(javax.swing.JComponent aComponent)
Returns given component's callback method (respondUI is the default).javax.swing.event.ChangeListener
getChangeListener()
Returns a change listener suitable for some controls.java.awt.Color
getColorValue(javax.swing.JComponent aComponent)
Returns a component's value as color.javax.swing.JComponent
getComponent(javax.swing.JComponent aComponent, int anIndex)
Returns the Ribs-relevant child component at the given index.int
getComponentCount(javax.swing.JComponent aComponent)
Returns the Ribs-relevant child component count.float
getFloatValue(javax.swing.JComponent aComponent)
Returns a component's value as a float.java.awt.event.FocusListener
getFocusListener()
Returns a focus listener suitable for the occasional control.java.awt.Color
getForeground(javax.swing.JComponent aComponent)
Returns the given component's foreground color if explicitly set, otherwise null.int
getIntValue(javax.swing.JComponent aComponent)
Returns a component's value as an int.RJPanel
getMaster(javax.swing.JComponent aComponent)
Returns the top level panel of the rib file (the one that given component was loaded from).java.awt.Dimension
getMaximumSize(javax.swing.JComponent aComponent)
Returns null unless the maximum size has explicitly been set by the user, in which case it uses the component's maximum size.java.awt.Dimension
getMinimumSize(javax.swing.JComponent aComponent)
Returns null unless the minimum size has explicitly been set by the user, in which case it uses the component's minimum size.java.lang.Object
getOwner(javax.swing.JComponent aComponent)
Returns given component's owner.int
getRibHeight(javax.swing.JComponent aComponent)
Returns the original height of the given component as defined in the rib file.int
getRibWidth(javax.swing.JComponent aComponent)
Returns the original width of the given component as defined in the rib file.int
getRibX(javax.swing.JComponent aComponent)
Returns the original X of the given component as defined in the rib file.int
getRibY(javax.swing.JComponent aComponent)
Returns the original Y of the given component as defined in the rib file.boolean
getSendActionOnFocusLost(javax.swing.JComponent aComponent)
Returns whether this component sends action when it loses focus.java.lang.String
getStringValue(javax.swing.JComponent aComponent)
Returns a component's value as a string.java.lang.String
getSubstitutionClassString(javax.swing.JComponent aComponent)
Returns the subclass string for the given component.java.lang.Object
getValue(javax.swing.JComponent aComponent)
Returns a component's value.void
initInstance(javax.swing.JComponent aComponent)
Initializes the given instance (actually called the first time an owner is set).java.lang.Boolean
isOpaque(javax.swing.JComponent aComponent)
Returns component's opacity if explicitly set, null otherwise.java.lang.Object
newInstance(RXElement anElement)
Creates a new instance of class for given element.void
performBindKeyGet(javax.swing.JComponent aComponent)
Performs bind key get.void
performBindKeySet(javax.swing.JComponent aComponent)
Performs bind key set.void
sendAction(javax.swing.JComponent aComponent, RJAction anAction)
Sends action for the given component.void
setAutoscrolls(javax.swing.JComponent aComponent, java.lang.Boolean aValue)
Sets whether a component autoscrolls and client property (so we know it was explicitly set).void
setAutosizing(javax.swing.JComponent aComponent, java.lang.String aValue)
Sets the autosizing for the given component.void
setBackground(javax.swing.JComponent aComponent, java.awt.Color aColor)
Sets the given component's background color and client property (so we know it was explicitly set).void
setBindKey(javax.swing.JComponent aComponent, java.lang.String aBindKey)
Sets this component's bind key chain.void
setCallback(javax.swing.JComponent aComponent, java.lang.String aCallback)
Sets given component's callback method (respondUI is the default).void
setForeground(javax.swing.JComponent aComponent, java.awt.Color aColor)
Sets the given component's foreground color and client property (so we know it was explicitly set).void
setMaster(javax.swing.JComponent aComponent, RJPanel aMaster)
Sets the top level panel of this rib file (the one that the given component was loaded from).void
setMaximumSize(javax.swing.JComponent aComponent, java.awt.Dimension max)
Sets the maximum size for a component and records the fact that we've changed it.void
setMinimumSize(javax.swing.JComponent aComponent, java.awt.Dimension min)
Sets the minimum size for a component and records the fact that we've changed it.void
setOpaque(javax.swing.JComponent aComponent, java.lang.Boolean aValue)
Set component's opacity and client property (so we know it was explicitly set).void
setOwner(javax.swing.JComponent aComponent, java.lang.Object anOwner)
Sets given component's owner.void
setSendActionOnFocusLost(javax.swing.JComponent aComponent, boolean aValue)
Sets whether this text field sends action when it loses focus.void
setSubstitutionClassString(javax.swing.JComponent aComponent, java.lang.String aClassString)
Sets the subclass string for the given component.void
setValue(javax.swing.JComponent aComponent, boolean aValue)
Sets a component's value from given boolean.void
setValue(javax.swing.JComponent aComponent, float aValue)
Sets a component's value from given float.void
setValue(javax.swing.JComponent aComponent, int aValue)
Sets a component's value from given int.void
setValue(javax.swing.JComponent aComponent, java.awt.Color aValue)
Sets a component's value from given Color.void
setValue(javax.swing.JComponent aComponent, java.lang.Boolean aValue)
Sets a component's value from given Boolean.void
setValue(javax.swing.JComponent aComponent, java.lang.Object aValue)
Sets a component's value.void
setValue(javax.swing.JComponent aComponent, java.lang.String aValue)
Sets a component's value from given string.void
takeFloatValue(javax.swing.JComponent aComponent, javax.swing.JComponent aCaller)
A generic callback method for component to component callbacks.void
takeIntValue(javax.swing.JComponent aComponent, javax.swing.JComponent aCaller)
A generic callback method for component to component callbacks.void
testOutBeanBag(javax.swing.JComponent c)
RXElement
toXML(javax.swing.JComponent aComponent, RXArchiver anArchiver)
XML archival utility method.void
toXMLDeep(javax.swing.JComponent aComponent, RXArchiver anArchiver, RXElement anElement)
XML archival utility method.
-
-
-
Method Detail
-
newInstance
public java.lang.Object newInstance(RXElement anElement)
Creates a new instance of class for given element.
-
initInstance
public void initInstance(javax.swing.JComponent aComponent)
Initializes the given instance (actually called the first time an owner is set).
-
getComponentCount
public int getComponentCount(javax.swing.JComponent aComponent)
Returns the Ribs-relevant child component count.
-
getComponent
public javax.swing.JComponent getComponent(javax.swing.JComponent aComponent, int anIndex)
Returns the Ribs-relevant child component at the given index.
-
get
public javax.swing.JComponent get(javax.swing.JComponent aComponent, java.lang.String aName)
Returns the given component or any of its children that have the give name.
-
add
public void add(javax.swing.JComponent aComponent, javax.swing.JComponent aChild)
Adds a child into the parent's component heirarchy.
-
getOwner
public java.lang.Object getOwner(javax.swing.JComponent aComponent)
Returns given component's owner.
-
setOwner
public void setOwner(javax.swing.JComponent aComponent, java.lang.Object anOwner)
Sets given component's owner.
-
getMaster
public RJPanel getMaster(javax.swing.JComponent aComponent)
Returns the top level panel of the rib file (the one that given component was loaded from).
-
setMaster
public void setMaster(javax.swing.JComponent aComponent, RJPanel aMaster)
Sets the top level panel of this rib file (the one that the given component was loaded from).
-
getCallback
public java.lang.String getCallback(javax.swing.JComponent aComponent)
Returns given component's callback method (respondUI is the default).
-
setCallback
public void setCallback(javax.swing.JComponent aComponent, java.lang.String aCallback)
Sets given component's callback method (respondUI is the default).
-
getBindKey
public java.lang.String getBindKey(javax.swing.JComponent aComponent)
Returns this component's bind key chain.
-
setBindKey
public void setBindKey(javax.swing.JComponent aComponent, java.lang.String aBindKey)
Sets this component's bind key chain.
-
sendAction
public void sendAction(javax.swing.JComponent aComponent, RJAction anAction)
Sends action for the given component.
-
performBindKeyGet
public void performBindKeyGet(javax.swing.JComponent aComponent)
Performs bind key get.
-
performBindKeySet
public void performBindKeySet(javax.swing.JComponent aComponent)
Performs bind key set.
-
getSubstitutionClassString
public java.lang.String getSubstitutionClassString(javax.swing.JComponent aComponent)
Returns the subclass string for the given component.
-
setSubstitutionClassString
public void setSubstitutionClassString(javax.swing.JComponent aComponent, java.lang.String aClassString)
Sets the subclass string for the given component.
-
getAutosizing
public java.lang.String getAutosizing(javax.swing.JComponent aComponent)
Returns the autosizing for the given component.
-
setAutosizing
public void setAutosizing(javax.swing.JComponent aComponent, java.lang.String aValue)
Sets the autosizing for the given component.
-
getRibX
public int getRibX(javax.swing.JComponent aComponent)
Returns the original X of the given component as defined in the rib file.
-
getRibY
public int getRibY(javax.swing.JComponent aComponent)
Returns the original Y of the given component as defined in the rib file.
-
getRibWidth
public int getRibWidth(javax.swing.JComponent aComponent)
Returns the original width of the given component as defined in the rib file.
-
getRibHeight
public int getRibHeight(javax.swing.JComponent aComponent)
Returns the original height of the given component as defined in the rib file.
-
setMinimumSize
public void setMinimumSize(javax.swing.JComponent aComponent, java.awt.Dimension min)
Sets the minimum size for a component and records the fact that we've changed it.
-
getMinimumSize
public java.awt.Dimension getMinimumSize(javax.swing.JComponent aComponent)
Returns null unless the minimum size has explicitly been set by the user, in which case it uses the component's minimum size. Note that some components may not let you change minimum size. What you do in that situation, I'm not sure.
-
setMaximumSize
public void setMaximumSize(javax.swing.JComponent aComponent, java.awt.Dimension max)
Sets the maximum size for a component and records the fact that we've changed it.
-
getMaximumSize
public java.awt.Dimension getMaximumSize(javax.swing.JComponent aComponent)
Returns null unless the maximum size has explicitly been set by the user, in which case it uses the component's maximum size.
-
getValue
public java.lang.Object getValue(javax.swing.JComponent aComponent)
Returns a component's value.
-
setValue
public void setValue(javax.swing.JComponent aComponent, java.lang.Object aValue)
Sets a component's value.
-
getStringValue
public java.lang.String getStringValue(javax.swing.JComponent aComponent)
Returns a component's value as a string.
-
setValue
public void setValue(javax.swing.JComponent aComponent, java.lang.String aValue)
Sets a component's value from given string.
-
getBooleanValue
public java.lang.Boolean getBooleanValue(javax.swing.JComponent aComponent)
Returns a component's value as a Boolean.
-
setValue
public void setValue(javax.swing.JComponent aComponent, java.lang.Boolean aValue)
Sets a component's value from given Boolean.
-
getBoolValue
public boolean getBoolValue(javax.swing.JComponent aComponent)
Returns a component's value as a boolean.
-
setValue
public void setValue(javax.swing.JComponent aComponent, boolean aValue)
Sets a component's value from given boolean.
-
getIntValue
public int getIntValue(javax.swing.JComponent aComponent)
Returns a component's value as an int.
-
setValue
public void setValue(javax.swing.JComponent aComponent, int aValue)
Sets a component's value from given int.
-
getFloatValue
public float getFloatValue(javax.swing.JComponent aComponent)
Returns a component's value as a float.
-
setValue
public void setValue(javax.swing.JComponent aComponent, float aValue)
Sets a component's value from given float.
-
getColorValue
public java.awt.Color getColorValue(javax.swing.JComponent aComponent)
Returns a component's value as color.
-
setValue
public void setValue(javax.swing.JComponent aComponent, java.awt.Color aValue)
Sets a component's value from given Color.
-
getActionListener
public java.awt.event.ActionListener getActionListener()
Returns an action listener suitable for many controls.
-
getChangeListener
public javax.swing.event.ChangeListener getChangeListener()
Returns a change listener suitable for some controls.
-
getFocusListener
public java.awt.event.FocusListener getFocusListener()
Returns a focus listener suitable for the occasional control.
-
getAutoscrolls
public java.lang.Boolean getAutoscrolls(javax.swing.JComponent aComponent)
Returns whether a component autoscrolls if explicitly set, null otherwise.
-
setAutoscrolls
public void setAutoscrolls(javax.swing.JComponent aComponent, java.lang.Boolean aValue)
Sets whether a component autoscrolls and client property (so we know it was explicitly set).
-
getForeground
public java.awt.Color getForeground(javax.swing.JComponent aComponent)
Returns the given component's foreground color if explicitly set, otherwise null.
-
setForeground
public void setForeground(javax.swing.JComponent aComponent, java.awt.Color aColor)
Sets the given component's foreground color and client property (so we know it was explicitly set).
-
getBackground
public java.awt.Color getBackground(javax.swing.JComponent aComponent)
Returns the given component's background color if explicitly set, otherwise null.
-
setBackground
public void setBackground(javax.swing.JComponent aComponent, java.awt.Color aColor)
Sets the given component's background color and client property (so we know it was explicitly set).
-
isOpaque
public java.lang.Boolean isOpaque(javax.swing.JComponent aComponent)
Returns component's opacity if explicitly set, null otherwise.
-
setOpaque
public void setOpaque(javax.swing.JComponent aComponent, java.lang.Boolean aValue)
Set component's opacity and client property (so we know it was explicitly set).
-
focusGained
public void focusGained(javax.swing.JComponent aComponent, java.awt.event.FocusEvent fe)
Called by default focus listener when the component gains focus.
-
focusLost
public void focusLost(javax.swing.JComponent aComponent, java.awt.event.FocusEvent fe)
Called by the default focus listener when focus is lost on a component, but before any action is fired.
-
getSendActionOnFocusLost
public boolean getSendActionOnFocusLost(javax.swing.JComponent aComponent)
Returns whether this component sends action when it loses focus.
-
setSendActionOnFocusLost
public void setSendActionOnFocusLost(javax.swing.JComponent aComponent, boolean aValue)
Sets whether this text field sends action when it loses focus.
-
takeIntValue
public void takeIntValue(javax.swing.JComponent aComponent, javax.swing.JComponent aCaller)
A generic callback method for component to component callbacks.
-
takeFloatValue
public void takeFloatValue(javax.swing.JComponent aComponent, javax.swing.JComponent aCaller)
A generic callback method for component to component callbacks.
-
toXML
public RXElement toXML(javax.swing.JComponent aComponent, RXArchiver anArchiver)
XML archival utility method.
-
toXMLDeep
public void toXMLDeep(javax.swing.JComponent aComponent, RXArchiver anArchiver, RXElement anElement)
XML archival utility method.
-
fromXML
public void fromXML(javax.swing.JComponent aComponent, RXArchiver anArchiver, RXElement anElement)
XML unarchival utility method.
-
fromXMLDeep
public void fromXMLDeep(javax.swing.JComponent aComponent, RXArchiver anArchiver, RXElement anElement)
XML unarchival utility method.
-
testOutBeanBag
public void testOutBeanBag(javax.swing.JComponent c)
-
-