001: /**********************************************************************************
002: * $URL: https://source.sakaiproject.org/svn/velocity/tags/sakai_2-4-1/tool-api/src/java/org/sakaiproject/cheftool/api/MenuItem.java $
003: * $Id: MenuItem.java 6782 2006-03-18 02:48:14Z ggolden@umich.edu $
004: ***********************************************************************************
005: *
006: * Copyright (c) 2003, 2004, 2005 2006 The Sakai Foundation.
007: *
008: * Licensed under the Educational Community License, Version 1.0 (the "License");
009: * you may not use this file except in compliance with the License.
010: * You may obtain a copy of the License at
011: *
012: * http://www.opensource.org/licenses/ecl1.php
013: *
014: * Unless required by applicable law or agreed to in writing, software
015: * distributed under the License is distributed on an "AS IS" BASIS,
016: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
017: * See the License for the specific language governing permissions and
018: * limitations under the License.
019: *
020: **********************************************************************************/package org.sakaiproject.cheftool.api;
021:
022: import java.util.List;
023:
024: /**
025: * <p>
026: * MenuItem is the interface for all the objects that can live on a menu.
027: * </p>
028: */
029: public interface MenuItem {
030: /** Checked status values. */
031: final static int CHECKED_NA = 0;
032:
033: final static int CHECKED_FALSE = 1;
034:
035: final static int CHECKED_TRUE = 2;
036:
037: final static String STATE_MENU = "menu";
038:
039: /**
040: * Does this item act as a container for other items?
041: *
042: * @return true if this MenuItem is a container for other items, false if not.
043: */
044: boolean getIsContainer();
045:
046: /**
047: * Is this item a divider ?
048: *
049: * @return true if this MenuItem is a divider, false if not.
050: */
051: boolean getIsDivider();
052:
053: /**
054: * Access the display title for the item.
055: *
056: * @return The display title for the item.
057: */
058: String getTitle();
059:
060: /**
061: * Access the icon name for the item (or null if no icon).
062: *
063: * @return The icon name for the item (or null if no icon).
064: */
065: String getIcon();
066:
067: /**
068: * Access the enabled flag for the item.
069: *
070: * @return True if the item is enabled, false if not.
071: */
072: boolean getIsEnabled();
073:
074: /**
075: * 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 "").
076: *
077: * @return The action string for this item.
078: */
079: String getAction();
080:
081: /**
082: * 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 "").
083: *
084: * @return The full URL string for this item.
085: */
086: String getUrl();
087:
088: /**
089: * Access the form name whose values will be used when this item is selected.
090: *
091: * @return The form name whose values will be used when this item is selected, or null if there is none.
092: */
093: String getForm();
094:
095: /**
096: * Access the checked status of this item. Possible values are (see above) CHECKED_NA, CHECKED_FALSE, CHECKED_TRUE
097: *
098: * @return The the checked status of this item.
099: */
100: int getChecked();
101:
102: /**
103: * Access the sub-items of the item. Note: if !isContainer(), there will be no sub-items (will return EmptyIterator).
104: *
105: * @return The sub-items of the item.
106: */
107: List getItems();
108:
109: /**
110: * Count the sub-items of the item. Note: if !isContainer(), the count is 0.
111: *
112: * @return The count of sub-items of the item.
113: */
114: int size();
115:
116: /**
117: * Check if there are any sub-items. Note: if !isContainer(), this is empty.
118: *
119: * @return true of there are no sub-items, false if there are.
120: */
121: boolean isEmpty();
122:
123: /**
124: * Access one sub-items of the item. Note: if !isContainer(), there will be no sub-items (will return null).
125: *
126: * @param index
127: * The index position (0 based) for the sub-item to get.
128: * @return The sub-item of the item.
129: */
130: MenuItem getItem(int index);
131:
132: /**
133: * Access the is-field (not a button) flag.
134: *
135: * @return True if the item is a field, false if not.
136: */
137: boolean getIsField();
138: }
|