001 /** 002 * Copyright 2010 The Kuali Foundation Licensed under the 003 * Educational Community License, Version 2.0 (the "License"); you may 004 * not use this file except in compliance with the License. You may 005 * obtain a copy of the License at 006 * 007 * http://www.osedu.org/licenses/ECL-2.0 008 * 009 * Unless required by applicable law or agreed to in writing, 010 * software distributed under the License is distributed on an "AS IS" 011 * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express 012 * or implied. See the License for the specific language governing 013 * permissions and limitations under the License. 014 */ 015 016 package org.kuali.student.common.ui.client.widgets.menus; 017 018 import java.util.List; 019 020 import com.google.gwt.user.client.ui.Composite; 021 022 023 /** 024 * KSMenu is the abstract class which is used to describe widgets which are menu based in ks-commons. 025 * 026 * @author Kuali Student Team 027 * 028 */ 029 public abstract class KSMenu extends Composite { 030 public static enum MenuImageLocation{LEFT, RIGHT}; 031 032 protected List<KSMenuItemData> items; 033 034 /** 035 * Sets the list of KSMenuItemData to be used in this menu and populates it. 036 * 037 * @param items list of KSMenuItemData to be used and populated into the menu 038 */ 039 public void setItems(List<KSMenuItemData> items) { 040 this.items = items; 041 populateMenu(); 042 } 043 044 /** 045 * Gets the list of KSMenuItemData used in this menu. 046 * 047 * @return the list of KSMenuItemData used to in this Menu. 048 */ 049 public List<KSMenuItemData> getItems() { 050 return this.items; 051 } 052 053 protected abstract void populateMenu(); 054 055 public abstract boolean selectMenuItem(String[] hierarchy); 056 057 /** 058 * Deselects the current selected menu item 059 * 060 * @return 061 */ 062 public abstract void clearSelected(); 063 }