List of usage examples for com.google.gwt.user.client.ui MenuBar setAnimationEnabled
public void setAnimationEnabled(boolean enable)
From source file:gwtquery.plugins.draggable.client.GWTIntegrationSample.java
License:Apache License
/** * Create a menu bar. The code comes from the GWT show case : * http://gwt.google.com/samples/Showcase/Showcase.html#!CwMenuBar * * @return/*from w w w . j av a 2 s .c o m*/ */ private MenuBar createMenuBar() { // Create a command that will execute on menu item selection Command menuCommand = new Command() { private int curPhrase = 0; private final String[] phrases = new String[] { "Thank you for selecting a menu item", "A fine selection indeed", "Don't you have anything better to do than select menu items?", "Try something else", "this is just a menu!", "Another wasted click" }; public void execute() { Window.alert(phrases[curPhrase]); curPhrase = (curPhrase + 1) % phrases.length; } }; // Create a menu bar MenuBar menu = new MenuBar(); menu.setAutoOpen(false); menu.setWidth("500px"); menu.setAnimationEnabled(true); // Create a sub menu of recent documents MenuBar recentDocsMenu = new MenuBar(true); String[] recentDocs = new String[] { "Fishing in the desert.txt", "How to tame a wild parrot", "Idiots Guide to Emu Farms" }; for (int i = 0; i < recentDocs.length; i++) { recentDocsMenu.addItem(recentDocs[i], menuCommand); } // Create the file menu MenuBar fileMenu = new MenuBar(true); fileMenu.setAnimationEnabled(true); menu.addItem(new MenuItem("File", fileMenu)); String[] fileOptions = new String[] { "New", "Open", "Close", "Recents", "Exit" }; for (int i = 0; i < fileOptions.length; i++) { if (i == 3) { fileMenu.addSeparator(); fileMenu.addItem(fileOptions[i], recentDocsMenu); fileMenu.addSeparator(); } else { fileMenu.addItem(fileOptions[i], menuCommand); } } // Create the edit menu MenuBar editMenu = new MenuBar(true); menu.addItem(new MenuItem("Edit", editMenu)); String[] editOptions = new String[] { "Undo", "Redo", "Copy", "Cut", "Paste" }; for (int i = 0; i < editOptions.length; i++) { editMenu.addItem(editOptions[i], menuCommand); } // Create the GWT menu MenuBar gwtMenu = new MenuBar(true); menu.addItem(new MenuItem("GWT", true, gwtMenu)); String[] gwtOptions = new String[] { "Download", "Examples", "Source code", "GWT wit' the program" }; for (int i = 0; i < gwtOptions.length; i++) { gwtMenu.addItem(gwtOptions[i], menuCommand); } // Create the help menu MenuBar helpMenu = new MenuBar(true); menu.addSeparator(); menu.addItem(new MenuItem("Help", helpMenu)); String[] helpOptions = new String[] { "Contents", "Fortune cookies", "About GWT" }; for (int i = 0; i < helpOptions.length; i++) { helpMenu.addItem(helpOptions[i], menuCommand); } // Return the menu menu.ensureDebugId("cwMenuBar"); return menu; }
From source file:it.pep.EsamiGWT.client.maschere.MascheraPrincipale.java
License:Apache License
private MenuBar creaMenu() { // Create a menu bar menu.setAutoOpen(true);/*from www . ja v a 2 s . c o m*/ menu.setWidth("100%"); menu.setAnimationEnabled(true); // Create the file menu MenuBar fileMenu = new MenuBar(true); fileMenu.setAnimationEnabled(true); fileMenu.addItem("Impostazioni", true, new Command() { public void execute() { Window.alert("scelto Impostazioni"); } }); fileMenu.addItem("Logout", true, new Command() { public void execute() { // Window.alert("scelto logout"); if (Window.confirm("Vuoi terminare la sessione di lavoro?")) { tornaAMascheraLogin(); } } }); menu.addItem(new MenuItem("File", fileMenu)); // Create the file menu MenuBar domandeMenu = new MenuBar(true); domandeMenu.setAnimationEnabled(true); domandeMenu.addItem("blocca tutte", true, new Command() { public void execute() { eseguiSBlocco(true); } }); domandeMenu.addItem("sblocca tutte", true, new Command() { public void execute() { eseguiSBlocco(false); } }); menu.addItem(new MenuItem("Domande", domandeMenu)); // Create the file menu MenuBar elaboratiMenu = new MenuBar(true); elaboratiMenu.setAnimationEnabled(true); elaboratiMenu.addItem("importa correzione", true, new Command() { public void execute() { eseguiImportazione(); } }); menu.addItem(new MenuItem("Elaborati", elaboratiMenu)); menuPanel.add(menu); return menu; }
From source file:net.s17fabu.vip.gwt.showcase.client.content.lists.CwMenuBar.java
License:Apache License
/** * Initialize this example.//from w w w . j a v a 2 s . com */ @Override public Widget onInitialize() { // Create a command that will execute on menu item selection Command menuCommand = new Command() { private int curPhrase = 0; private final String[] phrases = constants.cwMenuBarPrompts(); public void execute() { Window.alert(phrases[curPhrase]); curPhrase = (curPhrase + 1) % phrases.length; } }; // Create a menu bar MenuBar menu = new MenuBar(); menu.setAutoOpen(true); menu.setWidth("500px"); menu.setAnimationEnabled(true); // Create a sub menu of recent documents MenuBar recentDocsMenu = new MenuBar(true); String[] recentDocs = constants.cwMenuBarFileRecents(); for (int i = 0; i < recentDocs.length; i++) { recentDocsMenu.addItem(recentDocs[i], menuCommand); } // Create the file menu MenuBar fileMenu = new MenuBar(true); fileMenu.setAnimationEnabled(true); menu.addItem(new MenuItem(constants.cwMenuBarFileCategory(), fileMenu)); String[] fileOptions = constants.cwMenuBarFileOptions(); for (int i = 0; i < fileOptions.length; i++) { if (i == 3) { fileMenu.addSeparator(); fileMenu.addItem(fileOptions[i], recentDocsMenu); fileMenu.addSeparator(); } else { fileMenu.addItem(fileOptions[i], menuCommand); } } // Create the edit menu MenuBar editMenu = new MenuBar(true); menu.addItem(new MenuItem(constants.cwMenuBarEditCategory(), editMenu)); String[] editOptions = constants.cwMenuBarEditOptions(); for (int i = 0; i < editOptions.length; i++) { editMenu.addItem(editOptions[i], menuCommand); } // Create the GWT menu MenuBar gwtMenu = new MenuBar(true); menu.addItem(new MenuItem("GWT", true, gwtMenu)); String[] gwtOptions = constants.cwMenuBarGWTOptions(); for (int i = 0; i < gwtOptions.length; i++) { gwtMenu.addItem(gwtOptions[i], menuCommand); } // Create the help menu MenuBar helpMenu = new MenuBar(true); menu.addSeparator(); menu.addItem(new MenuItem(constants.cwMenuBarHelpCategory(), helpMenu)); String[] helpOptions = constants.cwMenuBarHelpOptions(); for (int i = 0; i < helpOptions.length; i++) { helpMenu.addItem(helpOptions[i], menuCommand); } // Return the menu menu.ensureDebugId("cwMenuBar"); return menu; }
From source file:org.apache.oozie.tools.workflowgenerator.client.OozieWorkflowGenerator.java
License:Apache License
/** * Initialize menu panel on top/*from ww w . jav a 2 s . c o m*/ * * @return */ public MenuBar initMenu() { // Menu bar Command cmd = new Command() { public void execute() { Window.alert("To be implemented soon"); } }; Command mr_cmd = new Command() { public void execute() { initWidget(); MapReduceActionWidget mr = new MapReduceActionWidget(OozieWorkflowGenerator.this); mr.setName("MR_0"); addWidget(mr, 300, 100); ((OozieDiagramController) controller).addConnection(start, mr); ((OozieDiagramController) controller).addConnection(mr, end); mr.updateOnSelection(); } }; Command pig_cmd = new Command() { public void execute() { clear(); initWidget(); PigActionWidget pig = new PigActionWidget(OozieWorkflowGenerator.this); pig.setName("Pig_0"); addWidget(pig, 300, 100); ((OozieDiagramController) controller).addConnection(start, pig); ((OozieDiagramController) controller).addConnection(pig, end); pig.updateOnSelection(); } }; Command java_cmd = new Command() { public void execute() { clear(); initWidget(); JavaActionWidget java = new JavaActionWidget(OozieWorkflowGenerator.this); java.setName("Java_0"); addWidget(java, 300, 100); ((OozieDiagramController) controller).addConnection(start, java); ((OozieDiagramController) controller).addConnection(java, end); java.updateOnSelection(); } }; Command forkjoin_cmd = new Command() { public void execute() { clear(); initWidget(); ForkNodeWidget fork = new ForkNodeWidget(OozieWorkflowGenerator.this); fork.setName("Fork_0"); addWidget(fork, 150, 100); ((OozieDiagramController) controller).addConnection(start, fork); MapReduceActionWidget mr = new MapReduceActionWidget(OozieWorkflowGenerator.this); mr.setName("MR_0"); addWidget(mr, 300, 30); ((OozieDiagramController) controller).addMultiConnection(fork, mr); PigActionWidget pig = new PigActionWidget(OozieWorkflowGenerator.this); pig.setName("Pig_0"); addWidget(pig, 300, 200); ((OozieDiagramController) controller).addMultiConnection(fork, pig); JoinNodeWidget join = new JoinNodeWidget(OozieWorkflowGenerator.this); join.setName("Join_0"); addWidget(join, 450, 100); ((OozieDiagramController) controller).addConnection(mr, join); ((OozieDiagramController) controller).addConnection(pig, join); ((OozieDiagramController) controller).addConnection(join, end); fork.updateOnSelection(); join.updateOnSelection(); mr.updateOnSelection(); pig.updateOnSelection(); } }; Command clear_cmd = new Command() { public void execute() { clear(); } }; MenuBar fileMenu = new MenuBar(true); fileMenu.setAutoOpen(true); fileMenu.setAnimationEnabled(true); fileMenu.addItem("New", cmd); fileMenu.addItem("Open", cmd); fileMenu.addItem("Load XML", cmd); fileMenu.addItem("Save", cmd); fileMenu.addItem("Save As..", cmd); fileMenu.addItem("Generate XML", cmd); fileMenu.addItem("Print", cmd); fileMenu.addItem("Quit", cmd); MenuBar editMenu = new MenuBar(true); editMenu.setAutoOpen(true); editMenu.setAnimationEnabled(true); editMenu.addItem("Undo", cmd); editMenu.addItem("Redo", cmd); editMenu.addItem("Copy", cmd); editMenu.addItem("Cut", cmd); editMenu.addItem("Paste", cmd); editMenu.addItem("Duplicate", cmd); editMenu.addItem("Delete", cmd); editMenu.addItem("Clear Diagram", clear_cmd); MenuBar examples = new MenuBar(true); examples.setAutoOpen(true); examples.setAnimationEnabled(true); examples.addItem("wrkflow with MR action", mr_cmd); examples.addItem("wrkflow with Pig action", pig_cmd); examples.addItem("wrkflow with Java action", java_cmd); examples.addItem("wrkflow with Fork/Join ", forkjoin_cmd); MenuBar helpMenu = new MenuBar(true); helpMenu.setAutoOpen(true); helpMenu.setAnimationEnabled(true); // TODO this should point to a workflowgenerator's maven site, however there is no maven site available. (Not even in // Workspace of the jenkins job at https://builds.apache.org/job/oozie-trunk-precommit-build/ws/workflowgenerator/target/) // where client, for example, has target/site/apidocs // The ideal place is somewhere under http://oozie.apache.org/docs/ once it is generated. Command openOozieTopPageComman = new Command() { @Override public void execute() { Window.open("http://oozie.apache.org/", "_blank", ""); } }; helpMenu.addItem("Documentation", openOozieTopPageComman); helpMenu.addItem("Online Help", openOozieTopPageComman); Command aboutCommand = new Command() { @Override public void execute() { // Dialogbox final DialogBox d = new DialogBox(false, true); d.setGlassEnabled(true); d.setText("About Oozie Workflow Generator"); d.center(); // Set this to workaround the grid z-index issue https://issues.apache.org/jira/browse/OOZIE-1081 d.getElement().getStyle().setZIndex(ZINDEX_FRONT_OF_GRID); // About text VerticalPanel vpanel = new VerticalPanel(); vpanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); vpanel.setSpacing(10); vpanel.setWidth("150"); vpanel.add(new Label("Oozie Workflow Generator")); vpanel.add(new Label("Version 3.4.0-SNAPSHOT")); // TODO how to get a version number from pom? // OK button to close Button ok = new Button("OK"); ok.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { d.hide(); } }); vpanel.add(ok); d.setWidget(vpanel); d.show(); } }; helpMenu.addItem("About", aboutCommand); MenuBar menu = new MenuBar(); menu.addItem("File", fileMenu); menu.addItem("Edit", editMenu); menu.addItem("Example", examples); menu.addItem("Help", helpMenu); return menu; }
From source file:org.dataconservancy.dcs.access.client.model.JsManifestationFile.java
License:Apache License
public static void display(Panel panel, JsArray<JsManifestationFile> array) { // Doesn't deal well with large array // FlexTable table = Util.createTable("Path", "Ref"); // ScrollPanel top = new ScrollPanel(table); // top.setSize("300px", "5em"); ////from w ww. j a v a 2 s . c om // for (int i = 0; i < array.length(); i++) { // JsManifestationFile mf = array.get(i); // // table.setText(0, i + 1, mf.getPath()); // table.setWidget(1, i + 1, Util.entityLink(mf.getRef())); // } // // panel.add(top); MenuBar top = new MenuBar(); // TODO work around bug with menubar width top.setWidth("15ex"); top.setAnimationEnabled(true); MenuBar refs = new MenuBar(true); top.addItem("File refs (" + array.length() + ")", refs); for (int i = 0; i < array.length(); i++) { final JsManifestationFile mf = array.get(i); String label = mf.getPath(); if (label.isEmpty()) { label = mf.getRef(); } refs.addItem(label, new Command() { public void execute() { History.newItem(State.ENTITY.toToken(mf.getRef())); } }); } panel.add(top); }
From source file:org.dataconservancy.dcs.access.client.Util.java
License:Apache License
public static Widget entityLinks(JsArrayString ids) { if (ids.length() == 0) { return new Label(); }/*from ww w . j ava2 s. co m*/ MenuBar top = new MenuBar(); // TODO work around bug with menubar width top.setWidth("15ex"); top.setAnimationEnabled(true); MenuBar refs = new MenuBar(true); top.addItem("Entities (" + ids.length() + ")", refs); for (int i = 0; i < ids.length(); i++) { final String id = ids.get(i); refs.addItem(id, new Command() { public void execute() { History.newItem(SeadState.ENTITY.toToken(id)); } }); } return top; }
From source file:org.dataconservancy.dcs.access.client.Util.java
License:Apache License
public static Widget metadataLinks(JsArrayString ids) { if (ids.length() == 0) { return new Label(); }/* ww w . j a va 2s . c o m*/ MenuBar top = new MenuBar(); top.setWidth("15ex"); top.setAnimationEnabled(true); final MenuBar refs = new MenuBar(true); top.addItem("View Metadata (" + ids.length() + ")", refs); for (int i = 0; i < ids.length(); i++) { final String id = ids.get(i); JsonpRequestBuilder rb = new JsonpRequestBuilder(); String query = Search.createLiteralQuery("id", id); String searchUrl = Search.searchURL(query, 0, true, Constants.MAX_SEARCH_RESULTS); rb.requestObject(searchUrl, new AsyncCallback<JsSearchResult>() { public void onFailure(Throwable caught) { reportInternalError("Viewing entity", caught); } public void onSuccess(final JsSearchResult result) { final JsMatch m = result.matches().get(0); if (m.getEntityType().equalsIgnoreCase("file")) { final JsArray<JsFormat> formats = ((JsFile) m.getEntity()).getFormats(); if (formats.length() > 0) { refs.addItem(formats.get(0).getFormat(), new Command() { public void execute() { String fileSource = ((JsFile) m.getEntity()).getPrimaryDataLocation() .getLocation(); if (!(fileSource.startsWith("http://") || fileSource.startsWith("https://"))) fileSource = ((JsFile) m.getEntity()).getSource(); MetadataPopupPanel statusPopupPanel = new MetadataPopupPanel(fileSource, formats.get(0).getFormat()); statusPopupPanel.show(); } }); } } } }); } return top; }
From source file:org.dataconservancy.dcs.access.ui.client.Util.java
License:Apache License
public static Widget entityLinks(JsArrayString ids) { if (ids.length() == 0) { return new Label(); }//from ww w . j a va 2 s . c o m MenuBar top = new MenuBar(); // TODO work around bug with menubar width top.setWidth("15ex"); top.setAnimationEnabled(true); MenuBar refs = new MenuBar(true); top.addItem("Entities (" + ids.length() + ")", refs); for (int i = 0; i < ids.length(); i++) { final String id = ids.get(i); refs.addItem(id, new Command() { public void execute() { History.newItem(State.ENTITY.toToken(id)); } }); } return top; }
From source file:org.drools.guvnor.client.asseteditor.drools.PackagesNewAssetMenuViewImpl.java
License:Apache License
private MenuBar getMenu() { addNewPackageMenuItem();/*from ww w .java2 s. co m*/ addNewChangeSetMenuItem(); addNewSpringContextMenuItem(); addNewServiceConfigMenuItem(); addNewWorkingSetMenuItem(); addNewRuleMenuItem(); addNewRuleTemplateMenuItem(); addNewPojoModelMenuItem(); addNewDeclarativeModelMenuItem(); addNewFunctionMenuItem(); addNewDSLMenuItem(); addNewRuleFlowMenuItem(); addNewBPMN2ProcessMenuItem(); addNewWorkItemDefinitionMenuItem(); addNewFormDefinitionMenuItem(); addNewEnumerationMenuItem(); addNewTestScenarioMenuItem(); // addNewSimulationTestMenuItem(); addNewFileMenuItem(); rebuildAllPackagesMenuItem(); MenuBar rootMenuBar = new MenuBar(true); rootMenuBar.setAutoOpen(false); rootMenuBar.setAnimationEnabled(false); rootMenuBar.addItem(new MenuItem(Constants.INSTANCE.CreateNew(), createNewMenu)); return rootMenuBar; }
From source file:org.drools.guvnor.client.asseteditor.soa.SOAServicesNewAssetMenuViewImpl.java
License:Apache License
private MenuBar getMenu() { addNewServiceMenuItem();/* ww w . j av a 2 s.c o m*/ //We assume for every asset type, we always have a corresponding "New Asset" menu item for this type PerspectiveFactory perspectiveFactory = GWT.create(PerspectiveFactory.class); String[] formats = perspectiveFactory.getRegisteredAssetEditorFormats("soaservice"); for (final String format : formats) { addNewAssetMenuItem(format); } MenuBar rootMenuBar = new MenuBar(true); rootMenuBar.setAutoOpen(true); rootMenuBar.setAnimationEnabled(true); rootMenuBar.addItem(new MenuItem(constants.CreateNew(), createNewMenu)); return rootMenuBar; }