var lo = new MenuBarItem({ label: "Logout" }); domStyle.set(lo.domNode, 'float', 'right');
/** Handle closing of all popup windows. */ public void onCloseMenu() { selectedMenuBarItem.setNormalState(); selectedMenuBarItem = null; lockLayer = null; }
/** {@inheritDoc} */ public void setEnabled(boolean enabled) { this.enabled = enabled; updateEnabledState(); }
case Event.ONMOUSEOVER: if (selectedMenuBarItem != null && item != selectedMenuBarItem) { if (item.onMouseDown()) { openPopupMenu(item); item.onMouseOver(); break; item.onMouseOut(); break; if (item.onMouseDown()) { openPopupMenu(item);
/** Create and add new item in menu. */ private void add(Action action, PresentationFactory presentationFactory) { Presentation presentation = presentationFactory.getPresentation(action); if (action instanceof ActionGroup) { ActionGroup group = (ActionGroup) action; table.setText(0, menuBarItems.size(), presentation.getText()); Element element = table.getCellFormatter().getElement(0, menuBarItems.size()); MenuBarItem item = new MenuBarItem( group, actionManager, managerProvider, presentationFactory, element, this, keyBindingAgent, resources.menuCss()); item.onMouseOut(); menuBarItems.put(element, item); action2barItem.put(group, item); } else if (action instanceof CustomComponentAction) { Widget widget = ((CustomComponentAction) action).createCustomComponent(presentation); table.setWidget(0, menuBarItems.size(), widget); Element element = table.getCellFormatter().getElement(0, menuBarItems.size()); menuBarItems.put(element, null); } }
@Override public void onActionSelected(Action action) { if (action2barItem.containsKey(action)) { MenuBarItem item = action2barItem.get(action); if (selectedMenuBarItem != null && selectedMenuBarItem != item) { selectedMenuBarItem.setNormalState(); selectedMenuBarItem.closePopupMenu(); } selectedMenuBarItem = item; } else { lockLayer.close(); lockLayer = null; } }
public void update() { setEnabled(Utils.hasVisibleChildren(group, presentationFactory, actionManager)); } }
private void expandActionGroup( List<Action> newVisibleActions, ActionManager actionManager, ActionGroup mainActionGroup) { final Action[] children = mainActionGroup.getChildren(null); for (final Action action : children) { final Presentation presentation = presentationFactory.getPresentation(action); final ActionEvent e = new ActionEvent(presentation, actionManager); action.update(e); if (presentation.isVisible()) { // add only visible items newVisibleActions.add(action); } if (action2barItem.containsKey(action)) { action2barItem.get(action).update(); } } }
/** * Open Popup Menu. * * @param item popup menu item. */ public void openPopupMenu(MenuBarItem item) { if (lockLayer == null) { int top = getAbsoluteTop() + getOffsetHeight(); lockLayer = new MenuLockLayer(this, top); } item.openPopupMenu(lockLayer); }
@Override public void onActionSelected(Action action) { if (action2barItem.containsKey(action)) { MenuBarItem item = action2barItem.get(action); if (selectedMenuBarItem != null && selectedMenuBarItem != item) { selectedMenuBarItem.setNormalState(); selectedMenuBarItem.closePopupMenu(); } selectedMenuBarItem = item; } else { lockLayer.close(); lockLayer = null; } }
public MenuBarItem( ActionGroup group, ActionManager actionManager, Provider<PerspectiveManager> managerProvider, PresentationFactory presentationFactory, Element element, ActionSelectedHandler handler, KeyBindingAgent keyBindingAgent, MenuResources.Css css) { this.group = group; this.actionManager = actionManager; this.managerProvider = managerProvider; this.presentationFactory = presentationFactory; this.element = element; this.actionSelectedHandler = handler; this.keyBindingAgent = keyBindingAgent; this.css = css; Presentation presentation = presentationFactory.getPresentation(group); title = presentation.getText(); element.setInnerText(presentation.getText()); setEnabled(Utils.hasVisibleChildren(group, presentationFactory, actionManager)); }
private void expandActionGroup( List<Action> newVisibleActions, ActionManager actionManager, ActionGroup mainActionGroup) { final Action[] children = mainActionGroup.getChildren(null); for (final Action action : children) { final Presentation presentation = presentationFactory.getPresentation(action); final ActionEvent e = new ActionEvent(presentation, actionManager); action.update(e); if (presentation.isVisible()) { // add only visible items newVisibleActions.add(action); } if (action2barItem.containsKey(action)) { action2barItem.get(action).update(); } } }
var lo = new MenuBarItem({ label: "Logout" }); domStyle.set(lo.domNode, 'float', 'right');
/** Handle closing of all popup windows. */ public void onCloseMenu() { selectedMenuBarItem.setNormalState(); selectedMenuBarItem = null; lockLayer = null; }
pMenuBar.addChild(new MenuBarItem({ label: "File" });
/** {@inheritDoc} */ @Override public void onActionSelected(Action action) { setNormalState(); actionSelectedHandler.onActionSelected(action); }