vmm3d.actions
Class ActionList
- java.lang.Object
-
- vmm3d.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 asExhibit.getActionsForView(View)andView.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
Constructors Constructor and Description ActionList()Create an unnamed ActionList.ActionList(java.lang.String name)Create an ActionList with a specfied name.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description voidadd(ActionItem object)Adds an ActionItem to the list of items in this ActionList.voidaddAll(ActionList list)Add all the ActionItems in list to this ActionList.ActionItemgetItem(int i)Gets the i-th ActionItem in this ActionList.intgetItemCount()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.StringgetName()Get the name of this ActionList.voidremove(ActionItem object)Removes a specified ActionItem from this ActionList.voidsetName(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.
-
-
-
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 typeAbstractActionVMM,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:
getMenuItemsin interfaceActionItem
-
-
DMelt 3.0 © DataMelt by jWork.ORG