vmm.actions
Class ActionList

java.lang.Object
  extended by vmm.actions.ActionList
All Implemented Interfaces:
ActionItem

public class ActionList
extends java.lang.Object
implements ActionItem

A simple class that is meant to represent a submenu (or a list of items in a menu) when used with methods such as Exhibit.getActionsForView(View) and View.getViewCommands(). The name of an ActionList is meant to be used as a name for a submenu that contains commands corresponding to all the items in the ActionList.


Constructor Summary
ActionList()
          Create an unnamed ActionList.
ActionList(java.lang.String name)
          Create an ActionList with a specfied name.
 
Method Summary
 void add(ActionItem object)
          Adds an ActionItem to the list of items in this ActionList.
 void addAll(ActionList list)
          Add all the ActionItems in list to this ActionList.
 ActionItem getItem(int i)
          Gets the i-th ActionItem in this ActionList.
 int getItemCount()
          Gets the number of items that have been added to this ActionList.
 java.util.ArrayList<ActionItem> getItems()
          Returns a list containing all the ActionItems that have been added to this ActionList.
 javax.swing.JMenuItem[] getMenuItems()
          If this ActionList is unnamed then the retunn value is an array containing JMenuItems created by the individual ActionItems in the ActionList.
 java.lang.String getName()
          Get the name of this ActionList.
 void remove(ActionItem object)
          Removes a specified ActionItem from this ActionList.
 void setName(java.lang.String name)
          Sets the name of this ActionList which, if non-null, is meant to be used as a name for the submenu.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ActionList

public ActionList()
Create an unnamed ActionList.


ActionList

public ActionList(java.lang.String name)
Create an ActionList with a specfied name.

Parameters:
name -
Method Detail

add

public void add(ActionItem object)
Adds an ActionItem to the list of items in this ActionList. The object added can be of type AbstractActionVMM, ToggleAction, <@link ActionRadioGroup}, ActionList, or any other object that implements ActionItem. Null values are allowed and are meant to r epresent separators in a mwnu.


remove

public void remove(ActionItem object)
Removes a specified ActionItem from this ActionList. If the item does not occur in the list, nothing is done and no error occurs. (If the item occurs more than once, only the first occurrence is removed.)

Parameters:
object - the object to be removed

setName

public void setName(java.lang.String name)
Sets the name of this ActionList which, if non-null, is meant to be used as a name for the submenu.


getName

public java.lang.String getName()
Get the name of this ActionList.


getItemCount

public int getItemCount()
Gets the number of items that have been added to this ActionList.


getItem

public ActionItem getItem(int i)
Gets the i-th ActionItem in this ActionList. Will throw an exception if i is less than zero or greater than or equal to the number of items in the list.


getItems

public java.util.ArrayList<ActionItem> getItems()
Returns a list containing all the ActionItems that have been added to this ActionList. (The returned ArrayList is newly allocated and no reference is kept to it.)


addAll

public void addAll(ActionList list)
Add all the ActionItems in list to this ActionList.

Parameters:
list - list of items to be added; if null, nothing is done

getMenuItems

public javax.swing.JMenuItem[] getMenuItems()
If this ActionList is unnamed then the retunn value is an array containing JMenuItems created by the individual ActionItems in the ActionList. If this ActionList has a non-null name with non-zero length, then the return value is an array containing a single item, which is a JMenu that in turn contains all the JMenuItems the JMenuItems from the individual ActionItems; the name of the JMenu is the name of the ActionList.

Specified by:
getMenuItems in interface ActionItem