UIMenuConstants

From OpenKM Documentation
Jump to: navigation, search

UIMenuConstant class defines contants to be used in OpenKM extensions to identify some menus where add own menu extensions.

If menu location is not defined in extension, by default is set value NEW_MENU location. That means it'll be created as new menu into main menu desktop view.

Example

How adding new submenu in default tools menu:

public class SubMenuMessage {
	private MenuItemExtension messageMenu;
	private MenuBarExtension subMenuMessage;
	private MenuItemExtension sendNewMessage;
 
	/**
	 * SubMenuMessage
	 */
	public SubMenuMessage() {
		// All menu items
		sendNewMessage = new MenuItemExtension("img/icon/actions/new_message.png", "New message", sendMessage);
 
		// Principal submenu
		subMenuMessage = new MenuBarExtension();
		subMenuMessage.addItem(sendNewMessage);
		messageMenu = new MenuItemExtension("img/icon/actions/message.png", "Message", subMenuMessage);
		messageMenu.setMenuLocation(UIMenuConstants.MAIN_MENU_TOOLS);
	}
 
         /**
	 * @return
	 */
	public MenuItemExtension getMenu() {
		return messageMenu;
	}
 
	/**
	 * option1Action
	 */
	Command sendMessage = new Command() {
		public void execute() {
			Window.alert("some action");
		}
	};
}