use of java.awt.Menu in project processdash by dtuma.
the class ScriptMenuReplicator method addMenuItems.
private void addMenuItems(Menu destMenu, List menuItems, int pos) {
for (Object item : menuItems) {
if (item instanceof String) {
String dataPath = (String) item;
destMenu.insert(new ScriptMenuSeparator(), ++pos);
destMenu.insert(new ScriptMenuHeader(dataPath), ++pos);
} else if (item instanceof ScriptID) {
ScriptID script = (ScriptID) item;
destMenu.insert(new ScriptMenuItem(script), ++pos);
} else if (item instanceof List) {
Menu submenu = new ScriptMenuSubmenu();
destMenu.insert(submenu, ++pos);
addMenuItems(submenu, (List) item, -1);
} else {
System.out.println("Warning! Unrecognized menu item type " + item);
}
}
}
Aggregations