List of usage examples for com.google.gwt.user.client.ui MenuBar addItem
public MenuItem addItem(String text, MenuBar popup)
From source file:accelerator.client.view.desktop.DesktopMainMenuView.java
License:Open Source License
@UiHandler("createButton") void onCreateButtonClick(ClickEvent e) { final PopupPanel popup = new PopupPanel(true, false); MenuBar menu = new MenuBar(true); menu.addItem("?", new Command() { public void execute() { popup.hide();//from w w w .j a va 2s. c om ProjectDialogBox dlg = new ProjectDialogBox(); dlg.setHandler(new ProjectDialogBox.Handler() { public void onOk(Project input) { handler.createProject(input); } }); dlg.center(); } }); menu.addItem("?", new Command() { public void execute() { popup.hide(); TagDialogBox dlg = new TagDialogBox(); dlg.setHandler(new TagDialogBox.Handler() { public void onOk(Tag input) { handler.createTag(input); } }); dlg.center(); } }); popup.setWidget(menu); popup.setPopupPositionAndShow(new PositionCallback() { public void setPosition(int offsetWidth, int offsetHeight) { int left = createButton.getAbsoluteLeft(); int top = createButton.getAbsoluteTop() - offsetHeight; popup.setPopupPosition(left, top); } }); }
From source file:ch.takoyaki.email.html.client.MenuBarBuilder.java
License:Open Source License
public void constructMenu() { MenuBar fileMenu = new MenuBar(true); fileMenu.addSeparator();// w ww . j a v a2 s .c o m fileMenu.addItem("Close", new CloseTabCommand(tab)); fileMenu.addItem("Close all", new CloseAllTabsCommand(tab)); fileMenu.addSeparator(); fileMenu.addItem("Open from file system", new OpenFromFileSystemCommand(fservice, tab)); fileMenu.addSeparator(); fileMenu.addItem("Save as zip", new DownloadAsZipCommand(fservice)); MenuBar exportMenu = new MenuBar(true); exportMenu.addItem("Single HTML", new DownloadHtmlCommand(contentRenderer, fservice)); exportMenu.addItem("EML File", new DownloadEmlCommand(contentRenderer, fservice)); menu = new MenuBar(); menu.addSeparator(); menu.addItem("File", fileMenu); menu.addSeparator(); menu.addItem("Export", exportMenu); menu.addSeparator(); }
From source file:com.colinalworth.xmlview.client.XmlTreeViewModel.java
License:Apache License
/** * /*from w w w. j av a 2 s . com*/ * @param validator */ public XmlTreeViewModel(XmlValidator validator) { final MenuBar subMenu = new MenuBar(true); subMenu.addItem(i18n.delete(), new DeleteElementCommand()); subMenu.addSeparator(); subMenu.addItem(i18n.addElement(), new NewElementCommand()); subMenu.addItem(i18n.addAttr(), new NewAttrCommand()); subMenu.addItem(i18n.addText(), new NewTextCommand()); contextMenu = new XmlEditContextMenu(); contextMenu.setWidget(subMenu); contextMenu.addCloseHandler(new CloseHandler<PopupPanel>() { @Override public void onClose(CloseEvent<PopupPanel> event) { subMenu.selectItem(null); } }); nodeCell = new ElementCell(validator, contextMenu); refreshAccess = new HashMap<Node, ValueUpdater<Node>>(); }
From source file:com.gmail.cjbooms.thesis.pythonappengine.client.menus.MainMenuWidget.java
License:Open Source License
private MenuBar createAppEngineMenu() { MenuBar appEngineMenu = new MenuBar(true); appEngineMenu.addItem("Deploy", deployDialog.openMenuDialog()); return appEngineMenu; }
From source file:com.gmail.cjbooms.thesis.pythonappengine.client.menus.MainMenuWidget.java
License:Open Source License
private MenuBar createGITMenu() { MenuBar gitMenu = new MenuBar(true); gitMenu.addItem("Clone", gitCloneDialogWidget.openDialogForGITCloneCommand()); gitMenu.addItem("Commit", gitCommitDialogWidget.openDialogForGitCommitChangesCommand()); gitMenu.addItem("Push", gitPushDialogWidget.openMenuDialog()); return gitMenu; }
From source file:com.gmail.cjbooms.thesis.pythonappengine.client.menus.MainMenuWidget.java
License:Open Source License
private MenuBar createProjectMenu() { MenuBar projectMenu = new MenuBar(true); projectMenu.addItem("New Project", createNewProjectDialogWidget.openDialogForNewProjectCommand()); projectMenu.addItem("Delete Project", createBlankCommand()); projectMenu.addItem("Synch Project", createBlankCommand()); return projectMenu; }
From source file:com.gmail.cjbooms.thesis.pythonappengine.client.menus.MainMenuWidget.java
License:Open Source License
private MenuBar createFileMenu() { MenuBar fileMenu = new MenuBar(true); fileMenu.addItem("New File", newFileDialog.openMenuDialog()); fileMenu.addItem("Delete File", createBlankCommand()); fileMenu.addItem("Upload File", createBlankCommand()); fileMenu.addItem("Refresh", createBlankCommand()); fileMenu.addSeparator();/*www. j a v a2 s . c om*/ fileMenu.addItem("Exit", createBlankCommand()); return fileMenu; }
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;/* w w w . j a v a2s . 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:com.google.gwt.examples.MenuBarExample.java
License:Apache License
public void onModuleLoad() { // Make a command that we will execute from all leaves. Command cmd = new Command() { public void execute() { Window.alert("You selected a menu item!"); }//from w w w . ja v a2 s . c o m }; // Make some sub-menus that we will cascade from the top menu. MenuBar fooMenu = new MenuBar(true); fooMenu.addItem("the", cmd); fooMenu.addItem("foo", cmd); fooMenu.addItem("menu", cmd); MenuBar barMenu = new MenuBar(true); barMenu.addItem("the", cmd); barMenu.addItem("bar", cmd); barMenu.addItem("menu", cmd); MenuBar bazMenu = new MenuBar(true); bazMenu.addItem("the", cmd); bazMenu.addItem("baz", cmd); bazMenu.addItem("menu", cmd); // Make a new menu bar, adding a few cascading menus to it. MenuBar menu = new MenuBar(); menu.addItem("foo", fooMenu); menu.addItem("bar", barMenu); menu.addItem("baz", bazMenu); // Add it to the root panel. RootPanel.get().add(menu); }
From source file:com.google.gwt.sample.kitchensink.client.Layouts.java
License:Apache License
public Layouts() { HTML contents = new HTML("This is a <code>ScrollPanel</code> contained at " + "the center of a <code>DockPanel</code>. " + "By putting some fairly large contents " + "in the middle and setting its size explicitly, it becomes a " + "scrollable area within the page, but without requiring the use of " + "an IFRAME." + "Here's quite a bit more meaningless text that will serve primarily " + "to make this thing scroll off the bottom of its visible area. " + "Otherwise, you might have to make it really, really small in order " + "to see the nifty scroll bars!"); ScrollPanel scroller = new ScrollPanel(contents); scroller.setStyleName("ks-layouts-Scroller"); DockPanel dock = new DockPanel(); dock.setHorizontalAlignment(DockPanel.ALIGN_CENTER); HTML north0 = new HTML("This is the <i>first</i> north component", true); HTML east = new HTML("<center>This<br>is<br>the<br>east<br>component</center>", true); HTML south = new HTML("This is the south component"); HTML west = new HTML("<center>This<br>is<br>the<br>west<br>component</center>", true); HTML north1 = new HTML("This is the <b>second</b> north component", true); dock.add(north0, DockPanel.NORTH);// w w w . j av a2 s .c o m dock.add(east, DockPanel.EAST); dock.add(south, DockPanel.SOUTH); dock.add(west, DockPanel.WEST); dock.add(north1, DockPanel.NORTH); dock.add(scroller, DockPanel.CENTER); FlowPanel flow = new FlowPanel(); for (int i = 0; i < 8; ++i) flow.add(new CheckBox("Flow " + i)); HorizontalPanel horz = new HorizontalPanel(); horz.setVerticalAlignment(VerticalPanel.ALIGN_MIDDLE); horz.add(new Button("Button")); horz.add(new HTML("<center>This is a<br>very<br>tall thing</center>", true)); horz.add(new Button("Button")); VerticalPanel vert = new VerticalPanel(); vert.setHorizontalAlignment(VerticalPanel.ALIGN_CENTER); vert.add(new Button("Small")); vert.add(new Button("--- BigBigBigBig ---")); vert.add(new Button("tiny")); MenuBar menu = new MenuBar(); MenuBar menu0 = new MenuBar(true), menu1 = new MenuBar(true); menu.addItem("menu0", menu0); menu.addItem("menu1", menu1); menu0.addItem("child00", (Command) null); menu0.addItem("child01", (Command) null); menu0.addItem("child02", (Command) null); menu1.addItem("child10", (Command) null); menu1.addItem("child11", (Command) null); menu1.addItem("child12", (Command) null); String id = HTMLPanel.createUniqueId(); HTMLPanel html = new HTMLPanel("This is an <code>HTMLPanel</code>. It allows you to add " + "components inside existing HTML, like this:" + "<span id='" + id + "'></span>" + "Notice how the menu just fits snugly in there? Cute."); DOM.setStyleAttribute(menu.getElement(), "display", "inline"); html.add(menu, id); VerticalPanel panel = new VerticalPanel(); panel.setSpacing(8); panel.setHorizontalAlignment(VerticalPanel.ALIGN_CENTER); panel.add(makeLabel("Dock Panel")); panel.add(dock); panel.add(makeLabel("Flow Panel")); panel.add(flow); panel.add(makeLabel("Horizontal Panel")); panel.add(horz); panel.add(makeLabel("Vertical Panel")); panel.add(vert); panel.add(makeLabel("HTML Panel")); panel.add(html); initWidget(panel); setStyleName("ks-layouts"); }