public MenuItem setAction(Object object, String method) { // System.out.println(this.name); action = new Action(object, method); if (shortcut != null) { shortcut.action = action; } menu.layout(); return this; }
public MenuItem setShortcut(String s) { shortcut = UIPlatform.getInstance().getAppContext(nearestMenu.canvas).shortcuts().createShortcut(s); if (action != null) { shortcut.action = action; } else { shortcut.action = new Action(this, "performAction"); } menu.layout(); return this; }
public MenuItem add(MenuItem item) { items.add(item); /* * Add this item to the zSortedList and re-sort. */ zSortedItems.add(item); zSort(); /* * Set the sub-item's parent to this item, and its menu to our menu. */ item.setParent(this); // item.setMenu(menu); /* * Layout the entire menu so things look nice. */ if (menu != null) menu.layout(); return item; }
public MenuItem setCondition(Object object, String method) throws Exception { this.condition = new ConditionChecker(object, method); menu.layout(); return this; }
public void remove(MenuItem item) { items.remove(item); zSortedItems.remove(item); zSort(); if (menu != null) menu.layout(); }