List of usage examples for com.google.gwt.user.client.ui MenuBar setAnimationEnabled
public void setAnimationEnabled(boolean enable)
From source file:com.appspot.socialinquirer.client.SocialInquirer.java
License:Apache License
/** * Creates the menu bar.//from www . j a v a 2 s . co m * * @param constants the constants * @param user the user * @return the menu bar */ private MenuBar createMenuBar(final EverScribeConstants constants, final User user) { final boolean enabled = (user != null); final MenuBar menu = new MenuBar(); GWT.runAsync(new RunAsyncCallback() { public void onFailure(Throwable caught) { UiUtils.showErrorDialog(constants, constants.errorCodeDownloadFailed()); } public void onSuccess() { menu.setAutoOpen(true); menu.setAnimationEnabled(true); MenuItem homeMenuItem = new MenuItem(constants.homeMenuName(), new HistoryCommand(HistoryToken.Home)); homeMenuItem.setEnabled(enabled); menu.addItem(homeMenuItem); MenuBar networkMenuItem = new MenuBar(true); networkMenuItem.setAnimationEnabled(true); menu.addItem(new MenuItem(constants.networkMenuName(), networkMenuItem)); MenuItem nfMenuItem = new MenuItem(constants.followersMenuName(), new HistoryCommand(HistoryToken.Network_Followers)); nfMenuItem.setEnabled(enabled); networkMenuItem.addItem(nfMenuItem); nfMenuItem = new MenuItem(constants.followingMenuName(), new HistoryCommand(HistoryToken.Network_Following)); nfMenuItem.setEnabled(enabled); networkMenuItem.addItem(nfMenuItem); nfMenuItem = new MenuItem(constants.recommendedMenuName(), new HistoryCommand(HistoryToken.Network_Recommended)); nfMenuItem.setEnabled(enabled); networkMenuItem.addItem(nfMenuItem); MenuBar activityMenuItem = new MenuBar(true); activityMenuItem.setAnimationEnabled(true); menu.addItem(new MenuItem(constants.activityMenuName(), activityMenuItem)); MenuItem aMenuItem = new MenuItem(constants.tasksMenuName(), new HistoryCommand(HistoryToken.Activity_Tasks)); aMenuItem.setEnabled(enabled); activityMenuItem.addItem(aMenuItem); aMenuItem = new MenuItem(constants.pollMenuName(), new HistoryCommand(HistoryToken.Activity_Polls)); aMenuItem.setEnabled(enabled); activityMenuItem.addItem(aMenuItem); aMenuItem = new MenuItem(constants.quizMenuName(), new HistoryCommand(HistoryToken.Activity_Quizzes)); aMenuItem.setEnabled(enabled); activityMenuItem.addItem(aMenuItem); aMenuItem = new MenuItem(constants.pagesMenuName(), new HistoryCommand(HistoryToken.Activity_Pages)); aMenuItem.setEnabled(enabled); activityMenuItem.addItem(aMenuItem); aMenuItem = new MenuItem(constants.messagesMenuName(), new HistoryCommand(HistoryToken.Activity_Messages)); aMenuItem.setEnabled(enabled); activityMenuItem.addItem(aMenuItem); aMenuItem = new MenuItem(constants.endorsementsMenuName(), new HistoryCommand(HistoryToken.Activity_Endorsements)); aMenuItem.setEnabled(enabled); activityMenuItem.addItem(aMenuItem); // MenuBar pagesMenuItem = new MenuBar(true); // pagesMenuItem.setAnimationEnabled(true); // menu.addItem(new MenuItem(constants.pagesMenuName(), // pagesMenuItem)); // aMenuItem = new MenuItem(constants // .followingMenuName(), new HistoryCommand(HistoryToken.Pages_Following)); // aMenuItem.setEnabled(enabled); // pagesMenuItem.addItem(aMenuItem); // aMenuItem = new MenuItem(constants // .ownedMenuName(), new HistoryCommand(HistoryToken.Pages_Created)); // aMenuItem.setEnabled(enabled); // pagesMenuItem.addItem(aMenuItem); // aMenuItem = new MenuItem(constants // .recommendedMenuName(), new HistoryCommand(HistoryToken.Pages_Recommended)); // aMenuItem.setEnabled(enabled); // pagesMenuItem.addItem(aMenuItem); MenuBar questionsMenuItem = new MenuBar(true); questionsMenuItem.setAnimationEnabled(true); menu.addItem(new MenuItem(constants.questionsMenuName(), questionsMenuItem)); aMenuItem = new MenuItem(constants.askedMenuName(), new HistoryCommand(HistoryToken.Questions_Asked)); aMenuItem.setEnabled(enabled); questionsMenuItem.addItem(aMenuItem); aMenuItem = new MenuItem(constants.answeredMenuName(), new HistoryCommand(HistoryToken.Questions_Answered)); aMenuItem.setEnabled(enabled); questionsMenuItem.addItem(aMenuItem); aMenuItem = new MenuItem(constants.followingMenuName(), new HistoryCommand(HistoryToken.Questions_Following)); aMenuItem.setEnabled(enabled); questionsMenuItem.addItem(aMenuItem); aMenuItem = new MenuItem(constants.recommendedMenuName(), new HistoryCommand(HistoryToken.Questions_Recommended)); aMenuItem.setEnabled(enabled); questionsMenuItem.addItem(aMenuItem); MenuBar tagsMenuItem = new MenuBar(true); tagsMenuItem.setAnimationEnabled(true); menu.addItem(new MenuItem(constants.tagsMenuName(), tagsMenuItem)); aMenuItem = new MenuItem(constants.ownedMenuName(), new HistoryCommand(HistoryToken.Topics_Active)); aMenuItem.setEnabled(enabled); tagsMenuItem.addItem(aMenuItem); aMenuItem = new MenuItem(constants.followingMenuName(), new HistoryCommand(HistoryToken.Topics_Following)); aMenuItem.setEnabled(enabled); tagsMenuItem.addItem(aMenuItem); aMenuItem = new MenuItem(constants.recommendedMenuName(), new HistoryCommand(HistoryToken.Topics_Recommended)); aMenuItem.setEnabled(enabled); tagsMenuItem.addItem(aMenuItem); MenuBar accountMenu = new MenuBar(true); accountMenu.setAnimationEnabled(true); menu.addItem(new MenuItem(constants.accountMenuName(), accountMenu)); MenuItem loginMenuItem = new MenuItem(constants.loginMenuName(), new LoginCommand(constants)); loginMenuItem.setEnabled(!enabled); accountMenu.addItem(loginMenuItem); MenuItem logoutMenuItem = new MenuItem(constants.logoutMenuName(), new LogoutCommand(constants)); logoutMenuItem.setEnabled(enabled); accountMenu.addItem(logoutMenuItem); MenuItem settingsMenuItem = new MenuItem(constants.settingsMenuName(), new HistoryCommand(HistoryToken.Settings)); settingsMenuItem.setEnabled(enabled); accountMenu.addItem(settingsMenuItem); } }); return menu; }
From source file:com.google.gwt.sample.showcase.client.content.lists.CwMenuBar.java
License:Apache License
/** * Initialize this example.// w w w . ja v a 2s. c om */ @ShowcaseSource @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:com.novartis.pcs.ontology.webapp.client.OntoBrowser.java
License:Apache License
private void createOntologyMenu(List<Term> terms) { MenuBar menu = new MenuBar(true); menu.setAnimationEnabled(true); for (final Term term : terms) { Ontology ontology = term.getOntology(); if (!ontology.isCodelist()) { menu.addItem(ontology.getName(), new Command() { public void execute() { History.newItem(term.getReferenceId()); }//from w w w.j a v a2 s . c o m }); } } menuBar.insertItem(new MenuItem("Ontology", menu), 0); }
From source file:com.novartis.pcs.ontology.webapp.client.OntoBrowser.java
License:Apache License
private void createPopups(Curator curator) { if (curator != null) { CreateChildTermPopup createTermPopup = new CreateChildTermPopup(service, eventBus); CrossRefPopup crossRefPopup = new CrossRefPopup(service, eventBus, curator, createTermPopup); ApproveRejectPopup approveRejectPopup = new ApproveRejectPopup(service, eventBus, curator); AddSynonymPopup addSynonymPopup = new AddSynonymPopup(service, eventBus); AddRelationshipPopup addRelationshipPopup = new AddRelationshipPopup(service, eventBus); createTermPopup.setSynonymProvider(crossRefPopup); MenuBar menu = new MenuBar(true); menu.setAnimationEnabled(true); createPopupMenuItem(menu, "Map Synonyms", crossRefPopup); createPopupMenuItem(menu, "Approve", approveRejectPopup); createPopupMenuItem(menu, "Create Child Term", createTermPopup); createPopupMenuItem(menu, "Add Synonym", addSynonymPopup); createPopupMenuItem(menu, "Add Relationship", addRelationshipPopup); if (BigDecimal.ONE.equals(curator.getEntityApprovalWeight(Entity.TERM))) { ReplaceTermPopup replaceTermPopup = new ReplaceTermPopup(service, eventBus); createPopupMenuItem(menu, "Obsolete Term", replaceTermPopup); }//from w ww. jav a 2s. c o m menuBar.addItem("Curate", menu); } createPopupMenuItem(menuBar, "History", new HistoryPopup(eventBus, service)); createPopupMenuItem(menuBar, "Legend", new LegendPopup()); if (curator != null && curator.getPassword() != null) { ChangePasswordPopup changePasswordPopup = new ChangePasswordPopup(service); if (curator.isPasswordExpired()) { changePasswordPopup.show(); } menuBar.addSeparator(); createPopupMenuItem(menuBar, "Change Password", changePasswordPopup); } }
From source file:com.qualogy.qafe.gwt.client.factory.WindowFactory.java
License:Apache License
private static void processMenu(MenuItemGVO root, MenuBar menuBar, final String uuid) { MenuBar subMenuBar = null; if (QAFEKeywordsGVO.SYSTEM_MENU_APPLICATIONS.equals(root.getId())) { MenuBar applicationsMenu = new MenuBar(true); applicationsMenu.setAutoOpen(true); ClientApplicationContext.getInstance().setApplicationsMenu(applicationsMenu); subMenuBar = ClientApplicationContext.getInstance().getApplicationsMenu(); subMenuBar.setAnimationEnabled(true); subMenuBar.setAutoOpen(true);// w ww . j a v a 2 s .c o m MenuItem menuItem = GWTUIGenerator.createMenuItem(root.getId(), root.getDisplayname(), uuid, root.getContext(), subMenuBar); menuBar.addItem(menuItem); } if (root.getSubMenus() != null) { if (subMenuBar == null) { subMenuBar = new MenuBar(true); subMenuBar.setAnimationEnabled(true); subMenuBar.setAutoOpen(true); MenuItem menuItem = GWTUIGenerator.createMenuItem(root.getId(), root.getDisplayname(), uuid, root.getContext(), subMenuBar); menuBar.addItem(menuItem); } for (int i = 0; i < root.getSubMenus().length; i++) { processMenu(root.getSubMenus()[i], subMenuBar, uuid); } ClientApplicationContext.getInstance().addMenu(root.getId(), subMenuBar); } else { if (!QAFEKeywordsGVO.SYSTEM_MENU_APPLICATIONS.equals(root.getId()) && root.getDisplayname() != null && !root.getDisplayname().equals(menuBar.getTitle())) { MenuItem menuItem = new MenuItem(root.getDisplayname(), (Command) null); RendererHelper.fillIn(root, menuItem, uuid, null, root.getContext()); // DOM.setElementAttribute(menuItem.getElement(), "id", // root.getId()); Command cmd = null; if (QAFEKeywordsGVO.SYSTEM_MENUITEM_LOGGING.equals(root.getId())) { cmd = new Command() { public void execute() { } }; } else if (QAFEKeywordsGVO.SYSTEM_MENUITEM_RELOAD.equals(root.getId())) { cmd = new Command() { public void execute() { if (ClientApplicationContext.getInstance().getReloadable()) { MainFactoryActions.processReloadUIFromApplicationContext(); } else { ClientApplicationContext.getInstance().log("Not available", "Reloading of application is only available in debug mode", true); } } }; } else if (QAFEKeywordsGVO.SYSTEM_MENUITEM_TRYME.equals(root.getId())) { cmd = new Command() { public void execute() { if (ClientApplicationContext.getInstance().isDebugMode()) { MainFactory.createTryMeWindow(QAFEKeywordsGVO.SYSTEM_MENUITEM_TRYME); } else { ClientApplicationContext.getInstance().log("Not available", "Try me feature is only available in debug mode", true); } } }; } else if (QAFEKeywordsGVO.SYSTEM_MENUITEM_TRYME_FORMS.equals(root.getId())) { cmd = new Command() { public void execute() { if (ClientApplicationContext.getInstance().isDebugMode()) { MainFactory.createTryMeWindow(QAFEKeywordsGVO.SYSTEM_MENUITEM_TRYME_FORMS); } else { ClientApplicationContext.getInstance().log("Not available", "Try me feature is only available in debug mode", true); } } }; } else { if ((root.getEvents() != null) && (root.getEvents().length > 0)) { EventListenerGVO eventListenerGVO = root.getEvents()[0]; cmd = EventFactory.createCommandListener(menuItem, eventListenerGVO, null); } } menuItem.setCommand(cmd); menuBar.addItem(menuItem); } else if (root instanceof MenuItemSeparatorGVO) { MenuItemSeparator menuItemSeparator = new MenuItemSeparator(); menuBar.addSeparator(menuItemSeparator); //menuBar.addItem((MenuItem)menuItemSeparator); } } }
From source file:com.qualogy.qafe.gwt.client.ui.renderer.WindowRenderer.java
License:Apache License
private MenuBar createMenu(ComponentGVO component, String uuid, String parent) { Command cmd = new Command() { public void execute() { }/*from www.jav a 2s .c om*/ }; MenuBar mainMenu = null; MenuItemGVO rootMenu = component.getMenu(); if (rootMenu != null) { if (rootMenu.getSubMenus() != null) { mainMenu = new MenuBar(); RendererHelper.fillIn(rootMenu, mainMenu, uuid, parent, component.getContext()); for (int i = 0; i < rootMenu.getSubMenus().length; i++) { if (rootMenu.getSubMenus()[i].getSubMenus() != null && rootMenu.getSubMenus()[i].getSubMenus().length > 0) { processMenu(mainMenu, rootMenu.getSubMenus()[i], rootMenu.getSubMenus()[i].getDisplayname(), uuid, parent); } else { MenuItem menuItem = new MenuItem(rootMenu.getSubMenus()[i].getDisplayname(), cmd); RendererHelper.fillIn(rootMenu.getSubMenus()[i], menuItem, uuid, parent, component.getContext()); mainMenu.addItem(menuItem); } } } if (rootMenu.getStyleClass() != null) { mainMenu.setStylePrimaryName(rootMenu.getStyleClass()); } } if (mainMenu != null) { mainMenu.setAutoOpen(true); mainMenu.setAnimationEnabled(true); } return mainMenu; }
From source file:edu.iastate.airl.semtus.client.SEMTUSWEBAPP.java
License:Open Source License
public Widget createMenu() { Command menuCommandNws = new Command() { public void execute() { tabPanel.selectTab(0);// w w w . j a v a2 s .c o m inputField.selectAll(); resultField.selectAll(); panelHoldingTabPanel.setVisible(true); } }; Command menuCommandLom = new Command() { public void execute() { uploadBox.center(); } }; Command menuCommandEx = new Command() { public void execute() { tabPanel.selectTab(0); inputField.setText( "Input some text based on the uploaded ontology for analysis.\n\n [PS: Remember to upload an ontology model for your domain to get relevant results."); resultField.setText("Send some text for processing before trying to view the results in this tab."); level = LEVEL_ONE; panelHoldingTabPanel.setVisible(false); } }; Command menuCommandPod = new Command() { public void execute() { announcementLabel.setHTML( "<p align=\"center\"><b>SEMANTIXS Analysis Level has been set to 1 (default).</b><br/><br/>" + "In this setting, SEMANTIXS expects an rdf/owl file as input (via upload option under File menu), containing the domain ontology (TBOX: class concepts + relationships) as well as instance assertions (A-BOX) that you expect in text.</p>"); announcementBox.center(); level = LEVEL_ONE; } }; Command menuCommandUone = new Command() { public void execute() { announcementLabel .setHTML("<p align=\"center\"><b>SEMANTIXS Analysis Level has been set to 2.</b><br/><br/>" + "In this setting, SEMANTIXS still expects an rdf/owl file as input (via upload option under File menu), however it doesn't assume that it's complete in the sense of covering all the instances expected in text. " + "It thus utilizes some pre-generated instance data (for eg., FOAF, DBPedia) in addition " + "to the given ontology for acquiring knowledge, however in the current version, it won't attempt to automatically map those instances to the input ontology and instead, retain their original references.</center>"); announcementBox.center(); level = LEVEL_TWO; } }; Command menuCommandUowe = new Command() { public void execute() { announcementLabel .setHTML("<p align=\"center\"><b>SEMANTIXS Analysis Level has been set to 3.</b><br/><br/>" + "In this setting, SEMANTIXS still expects an rdf/owl file as input (via upload option under File menu), however it doesn't assume that it's complete in the sense of covering all the relationships expected in text, or the instance data. " + "Thus, it sacrifices some correctness for exploring wilderness in trying to enrich the given ontology by learning new relationships and possible classes / instances as it reads text.</center>"); announcementBox.center(); level = LEVEL_THREE; } }; Command menuCommandVsg = new Command() { public void execute() { Window.open( "http://" + SEMTUS_HOSTING_SERVER_NAME + ":" + SEMTUS_HOSTING_PORT_NAME + "/" + SEMTUS_APP_NAME + "/visualize?lang=visual&model=output.rdf&search=&submit=search", "_blank", "menubar=no,location=no,resizable=yes,scrollbars=yes,status=no"); } }; Command menuCommandVcg = new Command() { public void execute() { tabPanel.selectTab(0); dialogBox.setHTML( "<p align=\"center\"><font color=\"#000000\" face=\"verdana\" size=\"2\">Visualize Complete RDF Graph</font></p>"); serverResponseLabel.removeStyleName("serverResponseLabelError"); serverResponseLabel.setHTML("<p align=\"center\">" + "In order to visualize the entire RDF graph, please click on the following button to go to the W3 Visualization servlet." + " On the servlet page, please copy-paste the RDF structure generated by SEMANTIXS into the textarea titled - <b>Check by Direct Input</b>." + " Set the <b>Display Result Options</b> to <b>Graph only</b> and click on <b>Parse RDF</b> to generate the graph.</p>"); w3Button = new Button("Go to W3 Validator Servlet"); w3Button.getElement().setId("closeButton"); dialogVPanel.remove(closeButton); dialogVPanel.add(w3Button); dialogBox.center(); // Add a handler to invoke W3 Servlet w3Button.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { Window.open("http://www.w3.org/RDF/Validator/", "_blank", "menubar=no,location=no,resizable=yes,scrollbars=yes,status=no"); dialogBox.hide(); dialogVPanel.remove(w3Button); dialogVPanel.add(closeButton); } }); } }; Command menuCommandSo = new Command() { public void execute() { } }; Command menuCommandUg = new Command() { public void execute() { panelHoldingTabPanel.setVisible(true); } }; Command menuCommandAs = new Command() { public void execute() { tabPanel.selectTab(0); dialogBox.setHTML( "<p align=\"center\"><font color=\"#000000\" face=\"verdana\" size=\"2\">About SEMANTIXS</font></p>"); serverResponseLabel.removeStyleName("serverResponseLabelError"); serverResponseLabel.setHTML("<p align=\"center\"><font color=\"#a29364\" face=\"Times\" size=\"6\">" + "<b>SEMANTIXS</b></font>" + "<br/><font color=\"#a29364\" face=\"Times\" size=\"3\">version 1.0.0</font><br/><br/></br></br>" + "Copyright (c) <a href=\"http://sushain.com\" target=\"_blank\">Sushain Pandit</a>. All rights reserved." + "<br/>" + "<a href=\"http://www.cs.iastate.edu/~honavar/aigroup.html\" target=\"_blank\">Artificial Intelligence Research Lab</a>, Iowa State University.</p>"); dialogBox.center(); } }; // Create a menu bar MenuBar menu = new MenuBar(); menu.setAutoOpen(true); menu.setWidth("400px"); menu.setAnimationEnabled(true); // menu.setStylePrimaryName("menu"); // Create the file menu MenuBar fileMenu = new MenuBar(true); fileMenu.setAnimationEnabled(true); menu.addItem(new MenuItem("File", fileMenu)); String[] fileOptions = new String[] { "New Workspace", "Load Ontology Model", "Exit" }; fileMenu.addItem(fileOptions[0], menuCommandNws); fileMenu.addSeparator(); fileMenu.addItem(fileOptions[1], menuCommandLom); fileMenu.addSeparator(); fileMenu.addItem(fileOptions[2], menuCommandEx); menu.addSeparator(); // Create the edit menu MenuBar editMenu = new MenuBar(true); menu.addItem(new MenuItem("Analysis Complexity", editMenu)); String[] editOptions = new String[] { "Level 1 (default) - Purely Ontology Dependent [No Enrichment]", "Level 2 - Utilizes Ontology + other sources [No Enrichment]", "Level 3 - Utilizes Ontology + other sources [With Enrichment]" }; editMenu.addItem(editOptions[0], menuCommandPod); editMenu.addSeparator(); editMenu.addItem(editOptions[1], menuCommandUone); editMenu.addSeparator(); editMenu.addItem(editOptions[2], menuCommandUowe); menu.addSeparator(); // Create the GWT menu MenuBar gwtMenu = new MenuBar(true); menu.addItem(new MenuItem("User Options", true, gwtMenu)); String[] gwtOptions = new String[] { "Analyze RDF sub-graphs", "Visualize complete RDF graph", "Output file in .rdf Format" }; gwtMenu.addItem(gwtOptions[0], menuCommandVsg); gwtMenu.addSeparator(); gwtMenu.addItem(gwtOptions[1], menuCommandVcg); gwtMenu.addSeparator(); gwtMenu.addItem(gwtOptions[2], menuCommandSo); // Create the help menu MenuBar helpMenu = new MenuBar(true); menu.addSeparator(); menu.addItem(new MenuItem("Help", helpMenu)); String[] helpOptions = new String[] { "User Guide", "About SEMANTIXS" }; helpMenu.addItem(helpOptions[0], menuCommandUg); helpMenu.addSeparator(); helpMenu.addItem(helpOptions[1], menuCommandAs); // Return the menu menu.ensureDebugId("cwMenuBar"); return menu; }
From source file:edu.umb.jsPedigrees.client.Pelican.Pelican.java
License:Open Source License
private void makeMenus(RootPanel rootPanel) { // set up the popup menu that appears when you click on a person popup = new PopupPanel(); MenuBar personMenu = new MenuBar(true); MenuBar addMenu = new MenuBar(true); addMenu.addItem("1 son", new Command() { public void execute() { addChildren("1 son"); popup.hide();/*from w ww. j a va 2 s . c o m*/ } }); addMenu.addItem("1 daughter", new Command() { public void execute() { addChildren("1 daughter"); popup.hide(); } }); addMenu.addItem("2 sons", new Command() { public void execute() { addChildren("2 sons"); popup.hide(); } }); addMenu.addItem("2 daughters", new Command() { public void execute() { addChildren("2 daughters"); popup.hide(); } }); addMenu.addItem("3 sons", new Command() { public void execute() { addChildren("3 sons"); popup.hide(); } }); addMenu.addItem("3 daughters", new Command() { public void execute() { addChildren("3 daughters"); popup.hide(); } }); addMenu.addItem("Spouse+son", new Command() { public void execute() { addSpouse("Spouse+son"); popup.hide(); } }); addMenu.addItem("Spouse+daughter", new Command() { public void execute() { addSpouse("Spouse+daughter"); popup.hide(); } }); Parents = new MenuItem("Parents", new Command() { public void execute() { addParents(); popup.hide(); } }); addMenu.addItem(Parents); personMenu.addItem("Add", addMenu); MenuBar changeMenu = new MenuBar(true); MenuBar changeAff = new MenuBar(true); changeAff.addItem("Affected", new Command() { public void execute() { currentPerson.affection = PelicanPerson.affected; updateDisplay(); popup.hide(); } }); changeAff.addItem("Unaffected", new Command() { public void execute() { currentPerson.affection = PelicanPerson.unaffected; updateDisplay(); popup.hide(); } }); changeMenu.addItem("Affection", changeAff); MenuBar changeSex = new MenuBar(true); changeSex.addItem("Male", new Command() { public void execute() { currentPerson.sex = PelicanPerson.male; updateDisplay(); popup.hide(); } }); changeSex.addItem("Female", new Command() { public void execute() { currentPerson.sex = PelicanPerson.female; updateDisplay(); popup.hide(); } }); changeMenu.addItem("Sex", changeSex); personMenu.addItem("Change", changeMenu); personMenu.addItem("Delete", new Command() { public void execute() { deletePerson(currentPerson); popup.hide(); } }); personMenu.addItem("Cancel", new Command() { public void execute() { popup.hide(); } }); MenuBar popupMenu = new MenuBar(); popupMenu.addItem("Edit", personMenu); popupMenu.setAutoOpen(true); popup.add(popupMenu); // main menu MenuBar mainMenu = new MenuBar(); mainMenu.setWidth("50px"); mainMenu.setAnimationEnabled(true); MenuBar editMenu = new MenuBar(true); editMenu.setAnimationEnabled(true); editMenu.addItem("New Pedigree", new Command() { public void execute() { newPedigree(); updateDisplay(); } }); undoItem = new MenuItem("Undo", new Command() { public void execute() { if (historyPosition > 1) { historyPosition--; Vector<PelicanPerson> savedPed = (Vector<PelicanPerson>) history.elementAt(historyPosition - 1); loadPedigree(savedPed); pedHasChanged = true; updateDisplay(); } } }); editMenu.addItem(undoItem); redoItem = new MenuItem("Redo", new Command() { public void execute() { if (historyPosition < history.size()) { historyPosition++; Vector<PelicanPerson> savedPed = (Vector<PelicanPerson>) history.elementAt(historyPosition - 1); loadPedigree(savedPed); pedHasChanged = true; updateDisplay(); } } }); editMenu.addItem(redoItem); editMenu.addItem("Renumber", new Command() { public void execute() { renumberAll(); updateDisplay(); } }); mainMenu.addItem(new MenuItem("Edit", editMenu)); rootPanel.add(mainMenu); }
From source file:eu.riscoss.client.RiscossWebApp.java
License:Apache License
void showUI(JSiteMap sitemap) { Log.println("Loading UI for domain " + sitemap.domain); VerticalPanel vPanel = new VerticalPanel(); MenuBar menu = new MenuBar(); menu.setWidth(" 100% "); menu.setAnimationEnabled(true); menu.setStyleName("mainMenu"); MenuBar account = new MenuBar(true); account.setStyleName("subMenu"); account.setAnimationEnabled(true);/* w w w.j a v a2s . c om*/ menu.addItem(username + " (" + sitemap.domain + ")", account); account.addItem("Change domain", new Command() { @Override public void execute() { showDomainSelectionDialog(); } }); account.addItem("Logout", new Command() { @Override public void execute() { Cookies.removeCookie(CookieNames.TOKEN_KEY); Cookies.removeCookie(CookieNames.DOMAIN_KEY); Window.Location.reload(); } }); for (JSiteSection subsection : sitemap.getRoot().subsections()) { if (subsection.pages().size() < 1) continue; if (subsection.getLabel().equals("untracked")) continue; MenuBar submenu = new MenuBar(true); submenu.setStyleName("subMenu"); submenu.setAnimationEnabled(true); menu.addItem(subsection.getLabel(), submenu); for (JSitePage page : subsection.pages()) { access.add(page.getLabel()); submenu.addItem(page.getLabel(), new MenuCommand(page.getUrl()) { @Override public void execute() { loadPanel(getUrl()); } }); } if (subsection.getLabel().equals("Configure")) { final Button b = new Button("ye"); final SingleUploader upload = new SingleUploader(FileInputType.CUSTOM.with(b)); upload.setTitle("Upload new entities document"); upload.setAutoSubmit(true); upload.setServletPath(upload.getServletPath() + "?t=importentities&domain=" + RiscossJsonClient.getDomain() + "&token=" + RiscossCall.getToken()); upload.addOnFinishUploadHandler(new OnFinishUploaderHandler() { @Override public void onFinish(IUploader uploader) { Log.println("OnFinish"); UploadedInfo info = uploader.getServerInfo(); String name = info.name; String response = uploader.getServerMessage().getMessage(); if (confFileLoaded) { RiscossJsonClient.importEntities(new JsonCallback() { @Override public void onFailure(Method method, Throwable exception) { Window.alert(exception.getMessage()); } @Override public void onSuccess(Method method, JSONValue response) { Window.alert("Entity information imported correctly"); loadPanel("entities.jsp"); } }); } else { Window.alert("Missing config xml file. Please, contact an administrator"); } } }); submenu.addSeparator(); submenu.addItem("Import entities", new MenuCommand("Import entities") { @Override public void execute() { upload.fireEvent(new ClickEvent() { }); b.fireEvent(new ClickEvent() { }); } }); vPanel.add(upload); upload.setVisible(false); } } MenuBar helpUs = new MenuBar(true); helpUs.setStyleName("subMenu"); helpUs.setAnimationEnabled(true); menu.addItem("Help us", helpUs); helpUs.addItem("User feedback", new Command() { @Override public void execute() { Window.open("http://www.essi.upc.edu/~e-survey/index.php?sid=356784&lang=en", "_self", ""); } }); helpUs.addItem("Expert feedback", new Command() { @Override public void execute() { Window.open("http://www.essi.upc.edu/~e-survey/index.php?sid=91563&lang=en", "_self", ""); } }); HorizontalPanel hPanel = new HorizontalPanel(); VerticalPanel north = new VerticalPanel(); // Image logo = new Image( "http://riscossplatform.ow2.org/riscoss/wiki/wiki1/download/ColorThemes/RISCOSS_2/logo_riscoss_DSP.png" ); Image logo = new Image("resources/logo_riscoss_DSP.png"); logo.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent arg0) { loadPanel("dashboard.jsp"); } }); logo.setStyleName("logo"); north.add(logo); north.setHeight("5%"); // any value here seems to resolve the firefox problem of showing only a small frame on the right side Label version = new Label("v1.6.0"); version.setStyleName("version"); north.add(version); //north.setWidth("100%"); hPanel.add(north); //Comment this line if you don't need shortcuts generateShortcuts(); hPanel.add(shortcuts); hPanel.setWidth("100%"); vPanel.add(hPanel); vPanel.add(menu); vPanel.setWidth("100%"); RootPanel.get().add(vPanel); RootPanel.get().setStyleName("root"); loadPanel("dashboard.jsp"); }
From source file:gov.nist.appvet.gwt.client.gui.AppVetPanel.java
License:Open Source License
public AppVetPanel(Unit unit, final ConfigInfoGwt configInfo, List<AppInfoGwt> initialApps) { super(Unit.PX); Window.addResizeHandler(new ResizeHandler() { Timer resizeTimer = new Timer() { @Override//from w w w.ja va2 s . c o m public void run() { resizeComponents(); } }; @Override public void onResize(ResizeEvent event) { resizeTimer.cancel(); resizeTimer.schedule(250); } }); userInfo = configInfo.getUserInfo(); userName = userInfo.getUserName(); allApps = initialApps; sinkEvents(Event.ONCLICK); sessionId = configInfo.getSessionId(); sessionExpirationLong = configInfo.getSessionExpirationLong(); MAX_SESSION_IDLE_DURATION = configInfo.getMaxIdleTime(); POLLING_INTERVAL = configInfo.getUpdatesDelay(); setSize("100%", ""); setStyleName("mainDockPanel"); SERVLET_URL = configInfo.getAppVetServletUrl(); HOST_URL = configInfo.getAppVetHostUrl(); appSelectionModel = new SingleSelectionModel<AppInfoGwt>(); appSelectionModel.addSelectionChangeHandler(new AppListHandler(this, configInfo)); if (configInfo.getAvailableToolNames() == null) { log.severe("Available tools is null"); } availableToolNames = configInfo.getAvailableToolNames(); availableToolIDs = configInfo.getAvailableToolIDs(); availableToolTypes = configInfo.getAvailableToolTypes(); final VerticalPanel northAppVetPanel = new VerticalPanel(); northAppVetPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); northAppVetPanel.setStyleName("northAppVetPanel"); northAppVetPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); addNorth(northAppVetPanel, 125.0); northAppVetPanel.setSize("100%", ""); final HorizontalPanel horizontalPanel_5 = new HorizontalPanel(); horizontalPanel_5.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); horizontalPanel_5.setStyleName("appVetHeaderPanel"); northAppVetPanel.add(horizontalPanel_5); northAppVetPanel.setCellVerticalAlignment(horizontalPanel_5, HasVerticalAlignment.ALIGN_MIDDLE); horizontalPanel_5.setWidth("100%"); northAppVetPanel.setCellWidth(horizontalPanel_5, "100%"); final InlineHTML nlnhtmlNewInlinehtml_1 = new InlineHTML( "<img border=\"0\" width=\"192px\" src=\"images/appvet_logo.png\" alt=\"appvet\" />"); nlnhtmlNewInlinehtml_1.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT); nlnhtmlNewInlinehtml_1.setStyleName(""); horizontalPanel_5.add(nlnhtmlNewInlinehtml_1); horizontalPanel_5.setCellWidth(nlnhtmlNewInlinehtml_1, "33%"); horizontalPanel_5.setCellVerticalAlignment(nlnhtmlNewInlinehtml_1, HasVerticalAlignment.ALIGN_MIDDLE); final HorizontalPanel horizontalPanel_6 = new HorizontalPanel(); horizontalPanel_6.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); horizontalPanel_6.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); horizontalPanel_5.add(horizontalPanel_6); horizontalPanel_6.setWidth(""); horizontalPanel_5.setCellWidth(horizontalPanel_6, "34%"); horizontalPanel_5.setCellHorizontalAlignment(horizontalPanel_6, HasHorizontalAlignment.ALIGN_CENTER); horizontalPanel_5.setCellVerticalAlignment(horizontalPanel_6, HasVerticalAlignment.ALIGN_MIDDLE); searchTextBox = new TextBox(); searchTextBox.setText("Search"); searchTextBox.setStyleName("searchTextBox"); searchTextBox.setTitle("Search by app ID, name, release kit, etc."); searchTextBox.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { searchTextBox.setText(""); } }); searchTextBox.addKeyPressHandler(new KeyPressHandler() { @Override public void onKeyPress(KeyPressEvent event_) { final boolean enterPressed = KeyCodes.KEY_ENTER == event_.getNativeEvent().getKeyCode(); final String searchString = searchTextBox.getText(); if (enterPressed) { final int numFound = search(); if (numFound > 0) { appsLabel.setText("Search Results for \"" + searchString + "\""); } } } }); searchTextBox.setSize("300px", "22px"); horizontalPanel_6.add(searchTextBox); horizontalPanel_6.setCellVerticalAlignment(searchTextBox, HasVerticalAlignment.ALIGN_MIDDLE); final PushButton searchButton = new PushButton("Search"); searchButton.setTitle("Search by app ID, name, release kit, etc."); searchButton.getUpFace().setHTML(""); searchButton.setSize("18px", "18px"); searchButton.setHTML("<img width=\"18px\" src=\"images/icon-search.png\" alt=\"search\" />"); searchButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { final String searchString = searchTextBox.getText(); final int numFound = search(); if (numFound > 0) { appsLabel.setText("Search Results for \"" + searchString + "\""); } } }); horizontalPanel_6.add(searchButton); horizontalPanel_6.setCellHorizontalAlignment(searchButton, HasHorizontalAlignment.ALIGN_CENTER); horizontalPanel_6.setCellVerticalAlignment(searchButton, HasVerticalAlignment.ALIGN_MIDDLE); Image image = new Image("images/nist-gray.png"); horizontalPanel_5.add(image); horizontalPanel_5.setCellHorizontalAlignment(image, HasHorizontalAlignment.ALIGN_RIGHT); horizontalPanel_5.setCellWidth(image, "33%"); final HorizontalPanel horizontalPanel_3 = new HorizontalPanel(); northAppVetPanel.add(horizontalPanel_3); northAppVetPanel.setCellHorizontalAlignment(horizontalPanel_3, HasHorizontalAlignment.ALIGN_CENTER); horizontalPanel_3.setWidth("100%"); northAppVetPanel.setCellWidth(horizontalPanel_3, "100%"); final MenuBar appVetMenuBar = new MenuBar(false); horizontalPanel_3.add(appVetMenuBar); appVetMenuBar.setStyleName("appVetMenuBar"); appVetMenuBar.setAutoOpen(true); appVetMenuBar.setWidth("250px"); appVetMenuBar.setAnimationEnabled(false); final MenuBar userMenuBar = new MenuBar(true); accountMenuItem = new MenuItem(userInfo.getNameWithLastNameInitial(), true, userMenuBar); accountMenuItem.setStyleName("AccountMenuItem"); final MenuItem accountSettingsMenuItem = new MenuItem("Account Settings", false, new Command() { @Override public void execute() { updateUserInfo(); } }); userMenuBar.addItem(accountSettingsMenuItem); final MenuItem myAppsMenuItem = new MenuItem("My Apps", false, new Command() { @Override public void execute() { searchTextBox.setText(userInfo.getUserName()); final int numFound = search(); if (numFound > 0) { appsLabel.setText("My Apps"); } } }); userMenuBar.addItem(myAppsMenuItem); final MenuItemSeparator separator = new MenuItemSeparator(); userMenuBar.addSeparator(separator); final MenuItem logoutMenuItem = new MenuItem("Logout", false, new Command() { @Override public void execute() { appVetServiceAsync.removeSession(sessionId, new AsyncCallback<Boolean>() { @Override public void onFailure(Throwable caught) { AppVetPanel.showMessageDialog("AppVet Error", "App list retrieval error", true); errorDialogBox.closeButton.setFocus(true); errorDialogBox.closeButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { killDialogBox(errorDialogBox); } }); } @Override public void onSuccess(Boolean result) { if (result == false) { AppVetPanel.showMessageDialog("AppVet Error", "Could not remove session", true); errorDialogBox.closeButton.setFocus(true); errorDialogBox.closeButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { killDialogBox(errorDialogBox); } }); } else { pollingTimer.cancel(); final LoginPanel loginPanel = new LoginPanel(Unit.PX); final RootLayoutPanel rootLayoutPanel = RootLayoutPanel.get(); rootLayoutPanel.clear(); rootLayoutPanel.add(loginPanel); System.gc(); } } }); } }); userMenuBar.addItem(logoutMenuItem); appVetMenuBar.addItem(accountMenuItem); final MenuBar helpMenuBar = new MenuBar(true); final MenuItem helpMenuItem = new MenuItem("Help", true, helpMenuBar); final MenuItem aboutMenuItem = new MenuItem("About", false, new Command() { @Override public void execute() { aboutDialogBox = new AboutDialogBox(configInfo.getAppVetVersion()); aboutDialogBox.setText("About"); aboutDialogBox.center(); aboutDialogBox.closeButton.setFocus(true); aboutDialogBox.closeButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { killDialogBox(aboutDialogBox); } }); } }); final MenuItem documentationMenuItem = new MenuItem("Documentation", false, new Command() { @Override public void execute() { Window.open("http://csrc.nist.gov/projects/appvet/", "_blank", null); } }); helpMenuBar.addItem(documentationMenuItem); appVetMenuBar.addItem(helpMenuItem); helpMenuBar.addItem(aboutMenuItem); horizontalPanel_3.add(statusMessageLabel); horizontalPanel_3.setCellVerticalAlignment(statusMessageLabel, HasVerticalAlignment.ALIGN_MIDDLE); horizontalPanel_3.setCellHorizontalAlignment(statusMessageLabel, HasHorizontalAlignment.ALIGN_RIGHT); horizontalPanel_3.setCellWidth(statusMessageLabel, "100%"); statusMessageLabel.setStyleName("devModeIndicator"); statusMessageLabel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT); statusMessageLabel.setSize("420px", "18"); final MenuBar adminMenuBar = new MenuBar(true); final MenuItem adminMenuItem = new MenuItem("Admin", true, adminMenuBar); final MenuItem mntmAppVetLog = new MenuItem("AppVet Log", false, new Command() { @Override public void execute() { final String dateString = "?nocache" + new Date().getTime(); final String url = SERVLET_URL + dateString + "&command=GET_APPVET_LOG&sessionid=" + sessionId; Window.open(url, "_blank", ""); } }); adminMenuBar.addItem(mntmAppVetLog); final MenuItem usersMenuItem = new MenuItem("Users", false, new Command() { @Override public void execute() { usersDialogBox = new UsersDialogBox(); usersDialogBox.setText("Users"); usersDialogBox.center(); usersDialogBox.doneButton.setFocus(true); usersDialogBox.doneButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { killDialogBox(usersDialogBox); } }); } }); adminMenuBar.addItem(usersMenuItem); if (userInfo.getRole().equals("ADMIN")) { appVetMenuBar.addItem(adminMenuItem); } // Remove first element containing the lastUpdate timestamp AppInfoGwt timeStampObject = null; if (initialApps != null && initialApps.size() > 0) { timeStampObject = initialApps.remove(0); lastAppsListUpdate = timeStampObject.getLastAppUpdate(); } final HorizontalPanel horizontalPanel_2 = new HorizontalPanel(); horizontalPanel_2.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); horizontalPanel_2.setStyleName("footerPanel"); addSouth(horizontalPanel_2, 35.0); horizontalPanel_2.setSize("100%", ""); // final Label lastUpdatedLabel = new Label("Last updated: " // + configInfo.getLastUpdated()); // lastUpdatedLabel // .setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT); // lastUpdatedLabel.setStyleName("lastUpdated"); // horizontalPanel_2.add(lastUpdatedLabel); // lastUpdatedLabel.setWidth("200px"); // horizontalPanel_2.setCellWidth(lastUpdatedLabel, "100%"); // horizontalPanel_2.setCellVerticalAlignment(lastUpdatedLabel, // HasVerticalAlignment.ALIGN_MIDDLE); final HorizontalSplitPanel centerAppVetSplitPanel = new HorizontalSplitPanel(); centerAppVetSplitPanel.setSplitPosition("64%"); centerAppVetSplitPanel.setSize("", ""); final SimplePanel leftCenterPanel = new SimplePanel(); centerAppVetSplitPanel.setLeftWidget(leftCenterPanel); leftCenterPanel.setSize("", "95%"); final DockPanel dockPanel_1 = new DockPanel(); dockPanel_1.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); leftCenterPanel.setWidget(dockPanel_1); dockPanel_1.setSize("100%", ""); rightCenterPanel = new SimplePanel(); centerAppVetSplitPanel.setRightWidget(rightCenterPanel); rightCenterPanel.setSize("", "630px"); final VerticalPanel appInfoVerticalPanel = new VerticalPanel(); appInfoVerticalPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); rightCenterPanel.setWidget(appInfoVerticalPanel); appInfoVerticalPanel.setSize("99%", ""); final HorizontalPanel horizontalPanel_1 = new HorizontalPanel(); horizontalPanel_1.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); horizontalPanel_1.setStyleName("iconPanel"); appInfoVerticalPanel.add(horizontalPanel_1); appInfoVerticalPanel.setCellWidth(horizontalPanel_1, "100%"); horizontalPanel_1.setSize("", ""); appInfoIcon = new Image(""); appInfoIcon.setVisible(false); appInfoIcon.setAltText(""); horizontalPanel_1.add(appInfoIcon); horizontalPanel_1.setCellVerticalAlignment(appInfoIcon, HasVerticalAlignment.ALIGN_MIDDLE); appInfoIcon.setSize("70px", "70px"); final VerticalPanel verticalPanel = new VerticalPanel(); horizontalPanel_1.add(verticalPanel); appInfoName = new HTML("", true); appInfoName.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT); verticalPanel.add(appInfoName); appInfoName.setStyleName("appInfoName"); appInfoName.setWidth(""); horizontalPanel_1.setCellVerticalAlignment(appInfoName, HasVerticalAlignment.ALIGN_MIDDLE); appInfoVersion = new HTML("", true); appInfoVersion.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT); appInfoVersion.setStyleName("appInfoVersion"); verticalPanel.add(appInfoVersion); appsListButtonPanel = new HorizontalPanel(); appsListButtonPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); dockPanel_1.add(appsListButtonPanel, DockPanel.NORTH); dockPanel_1.setCellHorizontalAlignment(appsListButtonPanel, HasHorizontalAlignment.ALIGN_CENTER); dockPanel_1.setCellWidth(appsListButtonPanel, "100%"); dockPanel_1.setCellVerticalAlignment(appsListButtonPanel, HasVerticalAlignment.ALIGN_MIDDLE); appsListButtonPanel.setStyleName("appListButtonPanel"); appsListButtonPanel.setSize("100%", ""); appsLabel = new InlineLabel("Apps"); appsLabel.setStyleName("AppsLabel"); appsListButtonPanel.add(appsLabel); appsListButtonPanel.setCellWidth(appsLabel, "50%"); appsListButtonPanel.setCellVerticalAlignment(appsLabel, HasVerticalAlignment.ALIGN_MIDDLE); appsLabel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT); appsLabel.setWidth("60px"); final HorizontalPanel horizontalPanel = new HorizontalPanel(); horizontalPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT); horizontalPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); horizontalPanel.setStyleName("appFunctionButtonPanel"); appsListButtonPanel.add(horizontalPanel); appsListButtonPanel.setCellWidth(horizontalPanel, "50%"); appsListButtonPanel.setCellVerticalAlignment(horizontalPanel, HasVerticalAlignment.ALIGN_MIDDLE); appsListButtonPanel.setCellHorizontalAlignment(horizontalPanel, HasHorizontalAlignment.ALIGN_RIGHT); horizontalPanel.setWidth(""); final PushButton submitButton = new PushButton("Submit"); submitButton.setTitle("Submit App"); submitButton.setHTML("<img width=\"18px\" src=\"images/icon-submit.png\" alt=\"Submit\" />"); submitButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { appUploadDialogBox = new AppUploadDialogBox(sessionId, SERVLET_URL); appUploadDialogBox.setText("Submit App"); appUploadDialogBox.center(); appUploadDialogBox.cancelButton.setFocus(true); appUploadDialogBox.cancelButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { killDialogBox(appUploadDialogBox); } }); appUploadDialogBox.uploadAppForm.addFormHandler(new AppUploadFormHandler(appUploadDialogBox)); } }); final PushButton viewAllButton = new PushButton("View All"); viewAllButton.setTitle("View All"); viewAllButton.setHTML("<img width=\"18px\" src=\"images/icon-view-all.png\" alt=\"view-all\" />"); viewAllButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { searchMode = false; setAllApps(); } }); horizontalPanel.add(viewAllButton); horizontalPanel.setCellHorizontalAlignment(viewAllButton, HasHorizontalAlignment.ALIGN_CENTER); horizontalPanel.setCellVerticalAlignment(viewAllButton, HasVerticalAlignment.ALIGN_MIDDLE); viewAllButton.setSize("18px", "18px"); horizontalPanel.add(submitButton); horizontalPanel.setCellVerticalAlignment(submitButton, HasVerticalAlignment.ALIGN_MIDDLE); horizontalPanel.setCellHorizontalAlignment(submitButton, HasHorizontalAlignment.ALIGN_CENTER); submitButton.setSize("18px", "18px"); downloadButton = new PushButton("Download"); downloadButton.setTitle("Download Reports"); downloadButton.setHTML("<img width=\"18px\" src=\"images/icon-download.png\" alt=\"Download\" />"); horizontalPanel.add(downloadButton); downloadButton.setEnabled(true); downloadButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { final AppInfoGwt selected = appSelectionModel.getSelectedObject(); if (selected == null) { showMessageDialog("AppVet Error", "No app is selected", true); } else { final String appId = selected.appId; final String dateString = "?nocache" + new Date().getTime(); final String url = SERVLET_URL + dateString + "&command=DOWNLOAD_REPORTS&appid=" + appId + "&sessionid=" + sessionId; Window.open(url, "_self", ""); // downloadDialog = new DownloadDialogBox(sessionId, selected); // downloadDialog.setText("Download reports"); // downloadDialog.center(); // downloadDialog.cancelButton.setFocus(true); // downloadDialog.cancelButton // .addClickHandler(new ClickHandler() { // @Override // public void onClick(ClickEvent event) { // killDialogBox(downloadDialog); // } // }); // downloadDialog.downloadButton // .addClickHandler(new ClickHandler() { // @Override // public void onClick(ClickEvent event) { // if (downloadDialog.selected_apk_radio_button // .isChecked()) { // final AppInfoGwt selected = appSelectionModel // .getSelectedObject(); // final String appId = selected.appId; // final String apk = selected.appName; // final String dateString = "?nocache" // + new Date().getTime(); // final String url = SERVLET_URL // + dateString // + "&command=DOWNLOAD_APP&appid=" // + appId + "&sessionid=" // + sessionId + "&appname=" + apk // + ".apk"; // Window.open(url, "_self", ""); // killDialogBox(downloadDialog); // } else if (downloadDialog.selected_report_radio_button // .isChecked()) { // final AppInfoGwt selected = appSelectionModel // .getSelectedObject(); // final String appId = selected.appId; // final String dateString = "?nocache" // + new Date().getTime(); // final String url = SERVLET_URL // + dateString // + "&command=DOWNLOAD_REPORTS&appid=" // + appId + "&sessionid=" // + sessionId; // Window.open(url, "_self", ""); // killDialogBox(downloadDialog); // } // } // }); } } }); horizontalPanel.setCellHorizontalAlignment(downloadButton, HasHorizontalAlignment.ALIGN_CENTER); horizontalPanel.setCellVerticalAlignment(downloadButton, HasVerticalAlignment.ALIGN_MIDDLE); appsListButtonPanel.setCellHorizontalAlignment(downloadButton, HasHorizontalAlignment.ALIGN_CENTER); downloadButton.setSize("18px", "18px"); addReportButton = new PushButton("Add Report"); horizontalPanel.add(addReportButton); horizontalPanel.setCellVerticalAlignment(addReportButton, HasVerticalAlignment.ALIGN_MIDDLE); addReportButton.setTitle("Override Report"); addReportButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { final AppInfoGwt selected = appSelectionModel.getSelectedObject(); if (selected == null) { showMessageDialog("AppVet Error", "No app is selected", true); } else { reportUploadDialogBox = new ReportUploadDialogBox(userName, sessionId, selected.appId, SERVLET_URL, availableToolNames, availableToolIDs); reportUploadDialogBox.setText("Override Report"); reportUploadDialogBox.center(); reportUploadDialogBox.cancelButton.setFocus(true); reportUploadDialogBox.cancelButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { killDialogBox(reportUploadDialogBox); } }); reportUploadDialogBox.uploadReportForm.addFormHandler( new ReportUploadFormHandler(reportUploadDialogBox, userName, selected.appId)); } } }); addReportButton.setSize("18px", "18px"); addReportButton.setHTML("<img width=\"18px\" src=\"images/icon-submit-report.png\" alt=\"Add Report\" />"); deleteButton = new PushButton("Delete"); horizontalPanel.add(deleteButton); horizontalPanel.setCellVerticalAlignment(deleteButton, HasVerticalAlignment.ALIGN_MIDDLE); deleteButton.setHTML("<img width=\"18px\" src=\"images/icon-delete.png\" alt=\"delete\" />"); deleteButton.setTitle("Delete App"); deleteButton.setVisible(true); deleteButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { final AppInfoGwt selected = appSelectionModel.getSelectedObject(); deleteConfirmDialogBox = new DeleteAppConfirmDialogBox(selected.appId, selected.appName); deleteConfirmDialogBox.setText("Confirm Delete"); deleteConfirmDialogBox.center(); deleteConfirmDialogBox.cancelButton.setFocus(true); deleteConfirmDialogBox.cancelButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { killDialogBox(deleteConfirmDialogBox); return; } }); deleteConfirmDialogBox.okButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { killDialogBox(deleteConfirmDialogBox); if (selected != null) { deleteApp(selected.appId, userName); } } }); } }); deleteButton.setSize("18px", "18px"); logButton = new PushButton("Log"); horizontalPanel.add(logButton); horizontalPanel.setCellVerticalAlignment(logButton, HasVerticalAlignment.ALIGN_MIDDLE); logButton.setTitle("View Log"); logButton.setHTML("<img width=\"18px\" src=\"images/icon-log.png\" alt=\"log\" />"); logButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { final AppInfoGwt selected = appSelectionModel.getSelectedObject(); if (selected != null) { final String appId = selected.appId; final String dateString = "?nocache" + new Date().getTime(); final String url = SERVLET_URL + dateString + "&command=GET_APP_LOG&appid=" + appId + "&sessionid=" + sessionId; Window.open(url, "_blank", ""); } } }); logButton.setSize("18px", "18px"); appsListTable = new AppsListPagingDataGrid<AppInfoGwt>(); appsListTable.dataGrid.setStyleName("dataGrid"); dockPanel_1.add(appsListTable, DockPanel.CENTER); dockPanel_1.setCellHorizontalAlignment(appsListTable, HasHorizontalAlignment.ALIGN_CENTER); dockPanel_1.setCellVerticalAlignment(appsListTable, HasVerticalAlignment.ALIGN_MIDDLE); appsListTable.setAppVetHostUrl(HOST_URL); appsListTable.dataGrid.setSize("99%", ""); appsListTable.setDataList(initialApps); appsListTable.setSize("", ""); appsListTable.dataGrid.setKeyboardSelectionPolicy(KeyboardSelectionPolicy.DISABLED); appsListTable.dataGrid.setSelectionModel(appSelectionModel); addReportButton.setVisible(true); logButton.setVisible(true); // final Label lblNewLabel_1 = new Label("*See log for system errors"); // lblNewLabel_1.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT); // appInfoVerticalPanel.add(lblNewLabel_1); // lblNewLabel_1.setWidth("200px"); // appInfoVerticalPanel.setCellWidth(lblNewLabel_1, "100%"); toolResultsHtml = new HTML("", true); appInfoVerticalPanel.add(toolResultsHtml); appInfoVerticalPanel.setCellWidth(toolResultsHtml, "100%"); toolResultsHtml.setWidth("100%"); toolResultsHtml.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT); toolResultsHtml.setStyleName("toolResultsHtml"); add(centerAppVetSplitPanel); /* // Add logo in bottom-right corner final InlineHTML nlnhtmlNewInlinehtml = new InlineHTML( "<a href=\"http://www.example.com\"><img border=\"0\" width=\"75px\" src=\"exampleImage.png\" alt=\"example\" /></a>" ); nlnhtmlNewInlinehtml .setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT); nlnhtmlNewInlinehtml.setStyleName("mainTaLogo"); horizontalPanel_2.add(nlnhtmlNewInlinehtml); nlnhtmlNewInlinehtml.setWidth(""); horizontalPanel_2.setCellHorizontalAlignment(nlnhtmlNewInlinehtml, HasHorizontalAlignment.ALIGN_RIGHT); horizontalPanel_2.setCellVerticalAlignment(nlnhtmlNewInlinehtml, HasVerticalAlignment.ALIGN_MIDDLE); */ if ((initialApps != null) && (initialApps.size() > 0)) { appSelectionModel.setSelected(initialApps.get(0), true); } else { logButton.setEnabled(false); addReportButton.setEnabled(false); deleteButton.setEnabled(false); downloadButton.setEnabled(false); } pollServer(userName); scheduleResize(); }