1 /**
2 * Copyright 2010 The Kuali Foundation Licensed under the
3 * Educational Community License, Version 2.0 (the "License"); you may
4 * not use this file except in compliance with the License. You may
5 * obtain a copy of the License at
6 *
7 * http://www.osedu.org/licenses/ECL-2.0
8 *
9 * Unless required by applicable law or agreed to in writing,
10 * software distributed under the License is distributed on an "AS IS"
11 * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
12 * or implied. See the License for the specific language governing
13 * permissions and limitations under the License.
14 */
15
16 package org.kuali.student.common.ui.client.widgets.menus;
17
18 import java.util.List;
19
20 import com.google.gwt.user.client.ui.Composite;
21
22
23 /**
24 * KSMenu is the abstract class which is used to describe widgets which are menu based in ks-commons.
25 *
26 * @author Kuali Student Team
27 *
28 */
29 public abstract class KSMenu extends Composite {
30 public static enum MenuImageLocation{LEFT, RIGHT};
31
32 protected List<KSMenuItemData> items;
33
34 /**
35 * Sets the list of KSMenuItemData to be used in this menu and populates it.
36 *
37 * @param items list of KSMenuItemData to be used and populated into the menu
38 */
39 public void setItems(List<KSMenuItemData> items) {
40 this.items = items;
41 populateMenu();
42 }
43
44 /**
45 * Gets the list of KSMenuItemData used in this menu.
46 *
47 * @return the list of KSMenuItemData used to in this Menu.
48 */
49 public List<KSMenuItemData> getItems() {
50 return this.items;
51 }
52
53 protected abstract void populateMenu();
54
55 public abstract boolean selectMenuItem(String[] hierarchy);
56
57 /**
58 * Deselects the current selected menu item
59 *
60 * @return
61 */
62 public abstract void clearSelected();
63 }