Package org.sakaiproject.cheftool.menu
Class MenuEntry
- java.lang.Object
-
- org.sakaiproject.cheftool.menu.MenuEntry
-
- All Implemented Interfaces:
org.sakaiproject.cheftool.api.MenuItem
public class MenuEntry extends Object implements org.sakaiproject.cheftool.api.MenuItem
MenuEntry is a clickable entry in a menu.
-
-
Field Summary
Fields Modifier and Type Field Description protected Stringm_accessibilitylabelThe acessibility label for the entry.protected Stringm_actionThe action string for the entry.protected intm_checkedThe checked status (@see MenuItem for values).protected booleanm_currentThe current flag for the entry.protected booleanm_enabledThe enabled flag for the entry.protected Stringm_formThe form name string for the entry.protected Stringm_iconThe icon name for the entry.protected Stringm_titleThe display title for the entry.protected Stringm_urlThe full URL string for the entry.
-
Constructor Summary
Constructors Constructor Description MenuEntry(String title, boolean enabled, String action)Construct a menu.MenuEntry(String title, String action)Construct a menu.MenuEntry(String title, String icon, boolean enabled, int checked, String action)Construct a menu.MenuEntry(String title, String icon, boolean enabled, int checked, String action, String form)Construct a menu.MenuEntry(String title, String accessibilityLabel, boolean enabled, String action)MenuEntry(String title, String accessibilityLabel, String action)Construct a menu.MenuEntry(String title, String accessibilityLabel, String icon, boolean enabled, int checked, String action)Construct a menu.MenuEntry(String title, String accessibilityLabel, String icon, boolean enabled, int checked, String action, String form)Construct a menu.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringgetAccessibilityLabel()StringgetAction()Access the action string for this item; what to do when the user clicks.intgetChecked()Access the checked status of this item.StringgetForm()Access the form name whose values will be used when this item is selected.StringgetIcon()Access the icon name for the item (or null if no icon).booleangetIschecked()Access the checked status of this item.booleangetIsContainer()Does this item act as a container for other items?booleangetIsCurrent()booleangetIsDivider()Is this item a divider ?booleangetIsEnabled()Access the enabled flag for the item.booleangetIsField()Access the is-field (not a button) flag.org.sakaiproject.cheftool.api.MenuItemgetItem(int index)Access one sub-items of the item.List<org.sakaiproject.cheftool.api.MenuItem>getItems()Access the sub-items of the item.StringgetTitle()Access the display title for the item.StringgetUrl()Access the full URL string for this item; what to do when the user clicks.booleanisEmpty()Check if there are any sub-items.voidsetIsCurrent(boolean current)If you set this to true, this menu item will be displayed as the current selected item.MenuEntrysetUrl(String url)Set the full URL of the entry.intsize()Count the sub-items of the item.
-
-
-
Field Detail
-
m_title
protected String m_title
The display title for the entry.
-
m_icon
protected String m_icon
The icon name for the entry.
-
m_enabled
protected boolean m_enabled
The enabled flag for the entry.
-
m_current
protected boolean m_current
The current flag for the entry.
-
m_action
protected String m_action
The action string for the entry.
-
m_url
protected String m_url
The full URL string for the entry.
-
m_form
protected String m_form
The form name string for the entry.
-
m_checked
protected int m_checked
The checked status (@see MenuItem for values).
-
m_accessibilitylabel
protected String m_accessibilitylabel
The acessibility label for the entry.
-
-
Constructor Detail
-
MenuEntry
public MenuEntry(String title, String accessibilityLabel, String icon, boolean enabled, int checked, String action, String form)
Construct a menu.
-
MenuEntry
public MenuEntry(String title, String icon, boolean enabled, int checked, String action)
Construct a menu.
-
MenuEntry
public MenuEntry(String title, String accessibilityLabel, String icon, boolean enabled, int checked, String action)
Construct a menu.
-
MenuEntry
public MenuEntry(String title, String accessibilityLabel, String action)
Construct a menu.
-
MenuEntry
public MenuEntry(String title, String accessibilityLabel, boolean enabled, String action)
-
-
Method Detail
-
setUrl
public MenuEntry setUrl(String url)
Set the full URL of the entry. To create an entry with a URL, create one first with a "" action, then call this.- Parameters:
url- The full URL for the entry.- Returns:
- This, for convenience.
-
getIsContainer
public boolean getIsContainer()
Does this item act as a container for other items?- Specified by:
getIsContainerin interfaceorg.sakaiproject.cheftool.api.MenuItem- Returns:
- true if this MenuItem is a container for other items, false if not.
-
getIsDivider
public boolean getIsDivider()
Is this item a divider ?- Specified by:
getIsDividerin interfaceorg.sakaiproject.cheftool.api.MenuItem- Returns:
- true if this MenuItem is a divider, false if not.
-
getTitle
public String getTitle()
Access the display title for the item.- Specified by:
getTitlein interfaceorg.sakaiproject.cheftool.api.MenuItem- Returns:
- The display title for the item.
-
getIcon
public String getIcon()
Access the icon name for the item (or null if no icon).- Specified by:
getIconin interfaceorg.sakaiproject.cheftool.api.MenuItem- Returns:
- The icon name for the item (or null if no icon).
-
getIsEnabled
public boolean getIsEnabled()
Access the enabled flag for the item.- Specified by:
getIsEnabledin interfaceorg.sakaiproject.cheftool.api.MenuItem- 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 ""). Note: if the entry is not enabled, this will return "".- Specified by:
getActionin interfaceorg.sakaiproject.cheftool.api.MenuItem- 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 "").- Specified by:
getUrlin interfaceorg.sakaiproject.cheftool.api.MenuItem- 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.- Specified by:
getFormin interfaceorg.sakaiproject.cheftool.api.MenuItem- Returns:
- The form name whose values will be used when this item is selected.
-
getItems
public List<org.sakaiproject.cheftool.api.MenuItem> getItems()
Access the sub-items of the item. Note: if !isContainer(), there will be no sub-items (will return EmptyIterator).- Specified by:
getItemsin interfaceorg.sakaiproject.cheftool.api.MenuItem- Returns:
- The sub-items of the item.
-
getItem
public org.sakaiproject.cheftool.api.MenuItem getItem(int index)
Access one sub-items of the item. Note: if !isContainer(), there will be no sub-items (will return null).- Specified by:
getItemin interfaceorg.sakaiproject.cheftool.api.MenuItem- Parameters:
index- The index position (0 based) for the sub-item to get.- Returns:
- The sub-item of the item.
-
getChecked
public int getChecked()
Access the checked status of this item. Possible values:- Specified by:
getCheckedin interfaceorg.sakaiproject.cheftool.api.MenuItem- Returns:
- The checked status of this item.
- See Also:
MenuItem
-
getIschecked
public boolean getIschecked()
Access the checked status of this item.- Returns:
- True if item is checked, false otherwise.
-
size
public int size()
Count the sub-items of the item. Note: if !isContainer(), the count is 0.- Specified by:
sizein interfaceorg.sakaiproject.cheftool.api.MenuItem- 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.- Specified by:
isEmptyin interfaceorg.sakaiproject.cheftool.api.MenuItem- Returns:
- true of there are no sub-items, false if there are.
-
getIsField
public boolean getIsField()
Access the is-field (not a button) flag.- Specified by:
getIsFieldin interfaceorg.sakaiproject.cheftool.api.MenuItem- Returns:
- True if the item is a field, false if not.
-
getIsCurrent
public boolean getIsCurrent()
- Specified by:
getIsCurrentin interfaceorg.sakaiproject.cheftool.api.MenuItem
-
setIsCurrent
public void setIsCurrent(boolean current)
If you set this to true, this menu item will be displayed as the current selected item.
-
getAccessibilityLabel
public String getAccessibilityLabel()
- Specified by:
getAccessibilityLabelin interfaceorg.sakaiproject.cheftool.api.MenuItem
-
-