    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.

##

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

##

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

##

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

  Create a menu item.

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).
createRadioMenuItem(Action)
  Create a radio button menu item.
getAction(String)

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

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

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

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

  Verify that this node is correct (ie.

##

TheMenuItem

     protected JMenuItem TheMenuItem

  The menu item created by this element.

RegisteredName

     public static final String RegisteredName

  The element type name normally used in XML for this sort of element.

IdAttName

     public static final String IdAttName

  The name of the attribute which holds the ID of this menu item.

LabelAttName

     public static final String LabelAttName

  The name of the attribute which holds the label to put on this menu item.

TypeAttName

     public static final String TypeAttName

  The name of the attribute which holds the type of this menu item.

NormalTypeName

     public static final String NormalTypeName

  If Type="Normal", we create a plain JMenuItem. (This is the default if the 'Type' attribute is omitted.)

CheckBoxTypeName

     public static final String CheckBoxTypeName

  If Type="Checkbox", we create a JCheckBoxMenuItem.

RadioTypeName

     public static final String RadioTypeName

  If Type="Radio", we create a JRadioButtonMenuItem.

StateAttName

     public static final String StateAttName

  The name of the attribute which holds the type of this menu item.

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.

##

xu_MenuItemElement

     public xu_MenuItemElement()

  Construct a menu item element with no name.

xu_MenuItemElement

     public xu_MenuItemElement(String InputNodeName)

  Construct a menu item with a name.

  Parameters:
    InputNodeName - The name of the element

##

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

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

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

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).

createCheckBoxMenuItem

     protected void createCheckBoxMenuItem(Action InputAction)

  Create a check box menu item.

  Parameters:
    InputAction - The action associated with this menu item (if any).

createRadioMenuItem

     protected void createRadioMenuItem(Action InputAction)

  Create a radio button menu item.

  Parameters:
    InputAction - The action associated with this menu item (if any).

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).

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

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

getMenuItem

     public JMenuItem getMenuItem()

  Get the menu item created by this element.

  Returns:
    The menu item itself

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

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