Difference between revisions of "UIMenuConstants"
From OpenKM Documentation
Line 7: | Line 7: | ||
<source lang="java"> | <source lang="java"> | ||
public class SubMenuMessage { | public class SubMenuMessage { | ||
− | |||
private MenuItemExtension messageMenu; | private MenuItemExtension messageMenu; | ||
private MenuBarExtension subMenuMessage; | private MenuBarExtension subMenuMessage; | ||
Line 44: | Line 43: | ||
</source> | </source> | ||
− | [[Category: | + | [[Category: Extension Guide]] |
Latest revision as of 13:39, 2 December 2010
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");
}
};
}