List of usage examples for com.google.gwt.user.client.ui MenuBar clearItems
public void clearItems()
From source file:com.goodow.web.ui.client.nav.MenuBarUi.java
License:Apache License
private void setMenuData(final MenuBar parentBar, final TreeNodeProxy parentNode) { List<TreeNodeProxy> childNodes = parentNode.getChildren(); if (childNodes == null) { return;//from w w w. j a v a2 s . c o m } parentBar.clearItems(); for (final TreeNodeProxy childNode : childNodes) { Command command = new Command() { @Override public void execute() { TreeNodePlace place = placeProvider.get().setPath(childNode.getPath()); placeController.goTo(place); } }; parentBar.addItem(childNode.getName(), command); parentBar.addSeparator(); } // for (final TreeNode childNode : childNodes) { // if (childNode.getChildren() == null || childNode.getChildren().isEmpty()) { // Command command = new Command() { // public void execute() { // TreeNodePlace place = placeProvider.get(); // place.setMenuId(childNode.getId()); // placeController.goTo(place); // } // }; // parentBar.addItem(childNode.getName(), command); // } else { // MenuBar childBar = new MenuBar(true); // childBar.setAnimationEnabled(true); // // setMenuData(childBar, childNode); // parentBar.addItem(childNode.getName(), childBar); // parentBar.addSeparator(); // } // } }
From source file:org.pentaho.mantle.client.ui.xul.MantleController.java
License:Open Source License
/** * Loads an arbitrary <code>FilePickList</code> into a menu * /*from w w w .jav a2 s . com*/ * @param pickMenu * The XulMenuBar to host the menu entries * @param filePickList * The files to list in natural order */ private void refreshPickListMenu(XulMenubar pickMenu, final AbstractFilePickList<? extends IFilePickItem> filePickList, PickListType type) { final MenuBar menuBar = (MenuBar) pickMenu.getManagedObject(); menuBar.clearItems(); final String menuClearMessage = Messages.getString(type.getMenuItemKey()); final String clearMessage = Messages.getString(type.getMessageKey()); if (filePickList.size() > 0) { for (IFilePickItem filePickItem : filePickList.getFilePickList()) { final String text = filePickItem.getFullPath(); menuBar.addItem(filePickItem.getTitle(), new Command() { public void execute() { SolutionBrowserPanel.getInstance().openFile(text, COMMAND.RUN); } }); } menuBar.addSeparator(); menuBar.addItem(menuClearMessage, new Command() { public void execute() { // confirm the clear GwtConfirmBox warning = new GwtConfirmBox(); warning.setHeight(117); warning.setMessage(clearMessage); warning.setTitle(menuClearMessage); warning.setAcceptLabel(Messages.getString("clearRecentAcceptButtonLabel")); warning.setCancelLabel(Messages.getString("clearRecentCancelButtonLabel")); warning.addDialogCallback(new XulDialogCallback<String>() { public void onClose(XulComponent sender, Status returnCode, String retVal) { if (returnCode == Status.ACCEPT) { filePickList.clear(); } } public void onError(XulComponent sender, Throwable t) { } }); warning.show(); } }); } else { menuBar.addItem(Messages.getString("empty"), new Command() { //$NON-NLS-1$ public void execute() { // Do nothing } }); } }
From source file:org.pentaho.pat.client.ui.panels.TopMenu.java
License:Open Source License
public void setup() { this.clearItems(); // Create a menu bar this.setAnimationEnabled(true); if (!Pat.isPlugin()) { final MenuBar fileMenu = createFileMenu(); this.addItem(new MenuItem(Pat.CONSTANTS.file(), fileMenu)); }/* w ww .ja v a2 s . com*/ final MenuBar conMenu = createConnectionMenu(); conMenu.setAnimationEnabled(true); final MenuItem conItem = new MenuItem(Pat.CONSTANTS.connections(), conMenu); this.addItem(conItem); final MenuBar cubeMenu = createCubesMenu(); cubeMenu.setAnimationEnabled(true); cubeMenu.setAutoOpen(true); final MenuItem cubeItem = new MenuItem(Pat.CONSTANTS.cubes(), cubeMenu); this.addItem(cubeItem); // Create the help menu MenuBar helpMenu = new MenuBar(true); helpMenu.clearItems(); this.addItem(new MenuItem(Pat.CONSTANTS.help(), helpMenu)); helpMenu.addItem("Donate", new Command() { public void execute() { Pat.openDonation(); } }); helpMenu.addItem(Pat.CONSTANTS.about(), new Command() { public void execute() { AboutWindow.display(); } }); }