001: /**********************************************************************************
002: * $URL: https://source.sakaiproject.org/svn/velocity/tags/sakai_2-4-1/tool/src/java/org/sakaiproject/cheftool/menu/MenuDivider.java $
003: * $Id: MenuDivider.java 7247 2006-03-29 21:09:51Z 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.menu;
021:
022: import java.util.List;
023: import java.util.Vector;
024:
025: import org.sakaiproject.cheftool.api.MenuItem;
026:
027: /**
028: * <p>
029: * MenuDivider is a menu item that makes a visible divider in the menu.
030: * </p>
031: */
032: public class MenuDivider implements MenuItem {
033: /**
034: * Construct a menu divider.
035: */
036: public MenuDivider() {
037: } // MenuDivider
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: public boolean getIsContainer() {
045: return false;
046:
047: } // getIsContainer
048:
049: /**
050: * Is this item a divider ?
051: *
052: * @return true if this MenuItem is a divider, false if not.
053: */
054: public boolean getIsDivider() {
055: return true;
056:
057: } // getIsDivider
058:
059: /**
060: * Access the display title for the item.
061: *
062: * @return The display title for the item.
063: */
064: public String getTitle() {
065: return "-";
066:
067: } // getTitle
068:
069: /**
070: * Access the icon name for the item (or null if no icon).
071: *
072: * @return The icon name for the item (or null if no icon).
073: */
074: public String getIcon() {
075: return null;
076:
077: } // getIcon
078:
079: /**
080: * Access the enabled flag for the item.
081: *
082: * @return True if the item is enabled, false if not.
083: */
084: public boolean getIsEnabled() {
085: return true;
086:
087: } // getIsEnabled
088:
089: /**
090: * 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 "").
091: *
092: * @return The action string for this item.
093: */
094: public String getAction() {
095: return "";
096:
097: } // getAction
098:
099: /**
100: * 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 "").
101: *
102: * @return The full URL string for this item.
103: */
104: public String getUrl() {
105: return "";
106:
107: } // getUrl
108:
109: /**
110: * Access the form name whose values will be used when this item is selected.
111: *
112: * @return The form name whose values will be used when this item is selected.
113: */
114: public String getForm() {
115: return null;
116:
117: } // getForm
118:
119: /**
120: * Access the sub-items of the item. Note: if !isContainer(), there will be no sub-items (will return EmptyIterator).
121: *
122: * @return The sub-items of the item.
123: */
124: public List getItems() {
125: return new Vector();
126:
127: } // getItems
128:
129: /**
130: * Access one sub-items of the item. Note: if !isContainer(), there will be no sub-items (will return null).
131: *
132: * @param index
133: * The index position (0 based) for the sub-item to get.
134: * @return The sub-item of the item.
135: */
136: public MenuItem getItem(int index) {
137: return null;
138:
139: } // getItem
140:
141: /**
142: * Access the checked status of this item. Possible values:
143: *
144: * @see MenuItem
145: * @return The the checked status of this item.
146: */
147: public int getChecked() {
148: return CHECKED_NA;
149:
150: } // getChecked
151:
152: /**
153: * Count the sub-items of the item. Note: if !isContainer(), the count is 0.
154: *
155: * @return The count of sub-items of the item.
156: */
157: public int size() {
158: return 0;
159:
160: } // size
161:
162: /**
163: * Check if there are any sub-items. Note: if !isContainer(), this is empty.
164: *
165: * @return true of there are no sub-items, false if there are.
166: */
167: public boolean isEmpty() {
168: return true;
169:
170: } // isEmpty
171:
172: /**
173: * Access the is-field (not a button) flag.
174: *
175: * @return True if the item is a field, false if not.
176: */
177: public boolean getIsField() {
178: return false;
179:
180: } // getIsField
181:
182: } // MenuDivider
|