MenuItemExtension
From OpenKM Documentation
Contents
Constructors
MenuItemExtension(String imageURL, String text, Command cmd)
Normal menuitem
A menuitem that has a menu bar. Normally used to submenu entry.
Normally used to define the main menuItem. Menu root that has other menu options as child.
Example
public class MainMenuExample {
private MenuItemExtension exampleMenu;
private MenuBarExtension subMenuExample;
private MenuBarExtension subMenuExample2;
private MenuItemExtension subMenuItem;
private MenuItemExtension option1;
private MenuItemExtension option2;
private MenuItemExtension option3;
private MenuItemExtension option4;
/**
* MainMenuExample
*/
public MainMenuExample() {
// All menu items
option1 = new MenuItemExtension("img/box.png", "Option 1", option1Action);
option2 = new MenuItemExtension("img/box.png", "Option 2", option2Action);
option3 = new MenuItemExtension("img/box.png", "Option 3", option3Action);
option4 = new MenuItemExtension("img/box.png", "Option 4", option4Action);
// Secondary submenu
subMenuExample2 = new MenuBarExtension();
subMenuExample2.addItem(option3);
subMenuExample2.addItem(option4);
subMenuItem = new MenuItemExtension("img/box.png","Sub menu", subMenuExample2); // is a secondary submenu
// Principal submenu
subMenuExample = new MenuBarExtension();
subMenuExample.addItem(option1);
subMenuExample.addItem(option2);
subMenuExample.addItem(subMenuItem);
// Principal menuitem
exampleMenu = new MenuItemExtension("New Menu", subMenuExample); // is not a secondary submenu
}
public MenuItemExtension getNewMenu() {
return exampleMenu;
}
/**
* option1Action
*/
Command option1Action = new Command() {
public void execute() {
Window.alert("option1 action");
}
};
/**
* option2Action
*/
Command option2Action = new Command() {
public void execute() {
Window.alert("option2 action");
}
};
/**
* option3Action
*/
Command option3Action = new Command() {
public void execute() {
Window.alert("option3 action");
}
};
/**
* option4Action
*/
Command option4Action = new Command() {
public void execute() {
Window.alert("option4 action");
}
};
}