org.sakaiproject.cheftool.menu
Interface MenuItem

All Known Implementing Classes:
Menu, MenuDivider, MenuEntry, MenuField

public interface MenuItem

MenuItem is the interface for all the objects that can live on a menu.

Version:
$Revision: 632 $
Author:
University of Michigan, CHEF Software Development Team

Field Summary
static int CHECKED_FALSE
           
static int CHECKED_NA
          Checked status values.
static int CHECKED_TRUE
           
static String STATE_MENU
           
 
Method Summary
 String getAction()
          Access the action string for this item; what to do when the user clicks.
 int getChecked()
          Access the checked status of this item.
 String getForm()
          Access the form name whose values will be used when this item is selected.
 String getIcon()
          Access the icon name for the item (or null if no icon).
 boolean getIsContainer()
          Does this item act as a container for other items?
 boolean getIsDivider()
          Is this item a divider ?
 boolean getIsEnabled()
          Access the enabled flag for the item.
 boolean getIsField()
          Access the is-field (not a button) flag.
 MenuItem getItem(int index)
          Access one sub-items of the item.
 List getItems()
          Access the sub-items of the item.
 String getTitle()
          Access the display title for the item.
 String getUrl()
          Access the full URL string for this item; what to do when the user clicks.
 boolean isEmpty()
          Check if there are any sub-items.
 int size()
          Count the sub-items of the item.
 

Field Detail

CHECKED_NA

public static final int CHECKED_NA
Checked status values.

See Also:
Constant Field Values

CHECKED_FALSE

public static final int CHECKED_FALSE
See Also:
Constant Field Values

CHECKED_TRUE

public static final int CHECKED_TRUE
See Also:
Constant Field Values

STATE_MENU

public static final String STATE_MENU
See Also:
Constant Field Values
Method Detail

getIsContainer

public boolean getIsContainer()
Does this item act as a container for other items?

Returns:
true if this MenuItem is a container for other items, false if not.

getIsDivider

public boolean getIsDivider()
Is this item a divider ?

Returns:
true if this MenuItem is a divider, false if not.

getTitle

public String getTitle()
Access the display title for the item.

Returns:
The display title for the item.

getIcon

public String getIcon()
Access the icon name for the item (or null if no icon).

Returns:
The icon name for the item (or null if no icon).

getIsEnabled

public boolean getIsEnabled()
Access the enabled flag for the item.

Returns:
True if the item is enabled, false if not.

getAction

public String getAction()
Access the action string for this item; what to do when the user clicks. Note: if getIsMenu(), there will not be an action string (will return "").

Returns:
The action string for this item.

getUrl

public String getUrl()
Access the full URL string for this item; what to do when the user clicks. Note: this if defined overrides getAction() which should be "". Note: if getIsMenu(), there will not be a URL string (will return "").

Returns:
The full URL string for this item.

getForm

public String getForm()
Access the form name whose values will be used when this item is selected.

Returns:
The form name whose values will be used when this item is selected, or null if there is none.

getChecked

public int getChecked()
Access the checked status of this item. Possible values are (see above) CHECKED_NA, CHECKED_FALSE, CHECKED_TRUE

Returns:
The the checked status of this item.

getItems

public List getItems()
Access the sub-items of the item. Note: if !isContainer(), there will be no sub-items (will return EmptyIterator).

Returns:
The sub-items of the item.

size

public int size()
Count the sub-items of the item. Note: if !isContainer(), the count is 0.

Returns:
The count of sub-items of the item.

isEmpty

public boolean isEmpty()
Check if there are any sub-items. Note: if !isContainer(), this is empty.

Returns:
true of there are no sub-items, false if there are.

getItem

public MenuItem getItem(int index)
Access one sub-items of the item. Note: if !isContainer(), there will be no sub-items (will return null).

Parameters:
index - The index position (0 based) for the sub-item to get.
Returns:
The sub-item of the item.

getIsField

public boolean getIsField()
Access the is-field (not a button) flag.

Returns:
True if the item is a field, false if not.