All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class xu.xu_MenuItemElement

java.lang.Object
   |
   +----com.sun.java.swing.tree.DefaultMutableTreeNode
           |
           +----xg.xg_Node
                   |
                   +----xg.xg_Element
                           |
                           +----xu.xu_MenuItemElement

public class xu_MenuItemElement
extends xg_Element
An XML element to represent a Swing menu item.


Variable Index

 o CheckBoxTypeName
If Type="Checkbox", we create a JCheckBoxMenuItem.
 o IdAttName
The name of the attribute which holds the ID of this menu item.
 o LabelAttName
The name of the attribute which holds the label to put on this menu item.
 o NormalTypeName
If Type="Normal", we create a plain JMenuItem.
 o RadioTypeName
If Type="Radio", we create a JRadioButtonMenuItem.
 o RegisteredName
The element type name normally used in XML for this sort of element.
 o StateAttName
The name of the attribute which holds the type of this menu item.
 o StateTrueValue
If a checkbox or radio button menu item has a State attribute with this value, its state will be set to true.
 o TheMenuItem
The menu item created by this element.
 o TypeAttName
The name of the attribute which holds the type of this menu item.

Constructor Index

 o xu_MenuItemElement()
Construct a menu item element with no name.
 o xu_MenuItemElement(String)
Construct a menu item with a name.

Method Index

 o createCheckBoxMenuItem(Action)
Create a check box menu item.
 o createMenuItem(String, Action)

Create a menu item.

 o createNormalMenuItem(String, Action)
Create a normal menu item (an instance of xu_MenuItem, which is basically just a JMenuItem - although it holds the attributes of this element).
 o createRadioMenuItem(Action)
Create a radio button menu item.
 o getAction(String)

Get from the parent document (if there is one) the named action.

 o getMenuItem()
Get the menu item created by this element.
 o getState()
Get the logical value of the "State" attribute.
 o getSummaryString()
Get a summary descriptive string suitable for display in the tree view or elsewhere.
 o setActionState(Action)
Retrieve the boolean 'State' attribute, and set the state of the InputAction if it is an xu_CheckBoxAction.
 o setItemIcon(Action)

Set this menu item's icon image from the icon image in its action (if the action has one).

 o toString()
Return a string representation of the element (intended for use as debug output).
 o verify()

Verify that this node is correct (ie.

Variables

 o TheMenuItem
 protected JMenuItem TheMenuItem
The menu item created by this element.

 o RegisteredName
 public static final String RegisteredName
The element type name normally used in XML for this sort of element.

 o IdAttName
 public static final String IdAttName
The name of the attribute which holds the ID of this menu item.

 o LabelAttName
 public static final String LabelAttName
The name of the attribute which holds the label to put on this menu item.

 o TypeAttName
 public static final String TypeAttName
The name of the attribute which holds the type of this menu item.

 o NormalTypeName
 public static final String NormalTypeName
If Type="Normal", we create a plain JMenuItem. (This is the default if the 'Type' attribute is omitted.)

 o CheckBoxTypeName
 public static final String CheckBoxTypeName
If Type="Checkbox", we create a JCheckBoxMenuItem.

 o RadioTypeName
 public static final String RadioTypeName
If Type="Radio", we create a JRadioButtonMenuItem.

 o StateAttName
 public static final String StateAttName
The name of the attribute which holds the type of this menu item.

 o StateTrueValue
 public static final String StateTrueValue
If a checkbox or radio button menu item has a State attribute with this value, its state will be set to true.

Constructors

 o xu_MenuItemElement
 public xu_MenuItemElement()
Construct a menu item element with no name.

 o xu_MenuItemElement
 public xu_MenuItemElement(String InputNodeName)
Construct a menu item with a name.

Parameters:
InputNodeName - The name of the element

Methods

 o verify
 public void verify() throws xg_VerificationException

Verify that this node is correct (ie. internally correct and/or consistent with other nodes - such as its parent). The node is OK iff it has a 'Name' attribute, has a valid 'Type' attribute ("Normal", "CheckBox" or "Radio" - defaulting to "Normal" if this attribute is omitted), it lives inside a "FrameConfig", and it has a 'Label' attribute.

Throws: xg_VerificationException
Description of verification problem
Overrides:
verify in class xg_Node
 o getAction
 public Action getAction(String InputActionName)

Get from the parent document (if there is one) the named action.

Parameters:
InputActionName - The name of the required action
 o createMenuItem
 protected void createMenuItem(String InputItemName,
                               Action InputAction) throws xg_VerificationException

Create a menu item. The 'Type' attribute determines whether we should create a normal, checkbox or radio button item (defaulting to normal if the 'Type' attribute is omitted).

Parameters:
InputItemName - The name of the menu item
InputAction - The action associated with this menu item (if there is one).
Throws: xg_VerificationException
Description of verification problem
 o createNormalMenuItem
 protected void createNormalMenuItem(String InputItemName,
                                     Action InputAction)
Create a normal menu item (an instance of xu_MenuItem, which is basically just a JMenuItem - although it holds the attributes of this element).

Parameters:
InputItemName - The name of the menu item
InputAction - The action associated with this menu item (if any).
 o createCheckBoxMenuItem
 protected void createCheckBoxMenuItem(Action InputAction)
Create a check box menu item.

Parameters:
InputAction - The action associated with this menu item (if any).
 o createRadioMenuItem
 protected void createRadioMenuItem(Action InputAction)
Create a radio button menu item.

Parameters:
InputAction - The action associated with this menu item (if any).
 o setActionState
 protected boolean setActionState(Action InputAction)
Retrieve the boolean 'State' attribute, and set the state of the InputAction if it is an xu_CheckBoxAction.

Parameters:
InputAction - The action associated with this menu item (if any).
 o setItemIcon
 protected void setItemIcon(Action InputAction)

Set this menu item's icon image from the icon image in its action (if the action has one).

Parameters:
InputAction - The action from which to obtain the image
 o getState
 public boolean getState()
Get the logical value of the "State" attribute. It is true if it exists and has the value "true", and false otherwise

Returns:
true if 'State="true"'; false otherwise
 o getMenuItem
 public JMenuItem getMenuItem()
Get the menu item created by this element.

Returns:
The menu item itself
 o getSummaryString
 public String getSummaryString()
Get a summary descriptive string suitable for display in the tree view or elsewhere.

Returns:
A description suitable for display in the tree view
Overrides:
getSummaryString in class xg_Node
 o toString
 public String toString()
Return a string representation of the element (intended for use as debug output).

Returns:
String representing the node's name.
Overrides:
toString in class xg_Element

All Packages  Class Hierarchy  This Package  Previous  Next  Index