Package com.ribs.helpers
Class JMenuItemHpr
- java.lang.Object
-
- com.ribs.RJHelper
-
- com.ribs.helpers.JMenuItemHpr
-
public class JMenuItemHpr extends RJHelper
A RJHelper implementation for JMenuItem (with specific support for subclasses: JMenu, JCheckBoxMenuItem).
-
-
Constructor Summary
Constructors Constructor Description JMenuItemHpr()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
fromXML(javax.swing.JComponent aComponent, RXArchiver anArchiver, RXElement anElement)
XML unarchival.boolean
getBoolValue(javax.swing.JComponent aComponent)
Returns whether menu item is selected (or state if check box menu item).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 the menu item's text as an int.java.lang.String
getImageName(javax.swing.JComponent aComponent)
Returns the image name for this button's icon.int
getIntValue(javax.swing.JComponent aComponent)
Returns the menu item's text as an int.static javax.swing.KeyStroke
getKeyStroke(java.lang.String aString)
This utility method tries to get a keystroke from a string and tries to be more forgiving than KeyStroke.getKeyStroke().static java.lang.String
getKeyText(javax.swing.KeyStroke aKeyStroke)
This utility method returns key text for a key stroke and tries to make it more conforming.java.lang.String
getStringValue(javax.swing.JComponent aComponent)
Returns the menu item's text.void
initInstance(javax.swing.JComponent aComponent)
Initializes the given instance (actually called the first time an owner is set).java.lang.Object
newInstance(RXElement anElement)
Creates a new instance of class for given element.void
setImageName(javax.swing.JComponent aComponent, java.lang.String aName)
Sets the image name for this button's icon and tries to set the icon by asking Ribs for the named icon.void
setValue(javax.swing.JComponent aComponent, boolean aValue)
Sets whether the menu item is selected (or state if check box menu item).void
setValue(javax.swing.JComponent aComponent, java.lang.String aValue)
Sets the menu item's text.RXElement
toXML(javax.swing.JComponent aComponent, RXArchiver anArchiver)
XML archival.-
Methods inherited from class com.ribs.RJHelper
add, focusGained, focusLost, fromXMLDeep, get, getActionListener, getAutoscrolls, getAutosizing, getBackground, getBindKey, getBooleanValue, getCallback, getChangeListener, getColorValue, getFocusListener, getForeground, getMaster, getMaximumSize, getMinimumSize, getOwner, getRibHeight, getRibWidth, getRibX, getRibY, getSendActionOnFocusLost, getSubstitutionClassString, getValue, isOpaque, performBindKeyGet, performBindKeySet, sendAction, setAutoscrolls, setAutosizing, setBackground, setBindKey, setCallback, setForeground, setMaster, setMaximumSize, setMinimumSize, setOpaque, setOwner, setSendActionOnFocusLost, setSubstitutionClassString, setValue, setValue, setValue, setValue, setValue, takeFloatValue, takeIntValue, testOutBeanBag, toXMLDeep
-
-
-
-
Method Detail
-
newInstance
public java.lang.Object newInstance(RXElement anElement)
Creates a new instance of class for given element.- Overrides:
newInstance
in classRJHelper
-
initInstance
public void initInstance(javax.swing.JComponent aComponent)
Initializes the given instance (actually called the first time an owner is set).- Overrides:
initInstance
in classRJHelper
-
getComponentCount
public int getComponentCount(javax.swing.JComponent aComponent)
Returns the Ribs-relevant child component count.- Overrides:
getComponentCount
in classRJHelper
-
getComponent
public javax.swing.JComponent getComponent(javax.swing.JComponent aComponent, int anIndex)
Returns the Ribs-relevant child component at the given index.- Overrides:
getComponent
in classRJHelper
-
getImageName
public java.lang.String getImageName(javax.swing.JComponent aComponent)
Returns the image name for this button's icon.
-
setImageName
public void setImageName(javax.swing.JComponent aComponent, java.lang.String aName)
Sets the image name for this button's icon and tries to set the icon by asking Ribs for the named icon.
-
getStringValue
public java.lang.String getStringValue(javax.swing.JComponent aComponent)
Returns the menu item's text.- Overrides:
getStringValue
in classRJHelper
-
setValue
public void setValue(javax.swing.JComponent aComponent, java.lang.String aValue)
Sets the menu item's text.
-
getBoolValue
public boolean getBoolValue(javax.swing.JComponent aComponent)
Returns whether menu item is selected (or state if check box menu item).- Overrides:
getBoolValue
in classRJHelper
-
setValue
public void setValue(javax.swing.JComponent aComponent, boolean aValue)
Sets whether the menu item is selected (or state if check box menu item).
-
getIntValue
public int getIntValue(javax.swing.JComponent aComponent)
Returns the menu item's text as an int.- Overrides:
getIntValue
in classRJHelper
-
getFloatValue
public float getFloatValue(javax.swing.JComponent aComponent)
Returns the menu item's text as an int.- Overrides:
getFloatValue
in classRJHelper
-
toXML
public RXElement toXML(javax.swing.JComponent aComponent, RXArchiver anArchiver)
XML archival.
-
fromXML
public void fromXML(javax.swing.JComponent aComponent, RXArchiver anArchiver, RXElement anElement)
XML unarchival.
-
getKeyText
public static java.lang.String getKeyText(javax.swing.KeyStroke aKeyStroke)
This utility method returns key text for a key stroke and tries to make it more conforming.
-
getKeyStroke
public static javax.swing.KeyStroke getKeyStroke(java.lang.String aString)
This utility method tries to get a keystroke from a string and tries to be more forgiving than KeyStroke.getKeyStroke().
-
-