List of usage examples for com.google.gwt.user.client.ui HorizontalPanel setHorizontalAlignment
public void setHorizontalAlignment(HorizontalAlignmentConstant align)
From source file:edu.kit.ipd.sonar.client.Menu.java
License:Open Source License
/** * initializes the menu's components.//from w ww.ja v a2s.c om */ private void initComponents() { GWT.log("Menu: initializing gui-objects...", null); VerticalPanel vpanel = new VerticalPanel(); Image showImage = new Image(GWT.getModuleBaseURL() + "images/menushowbutton.png"); showImage.addClickHandler(new ClickHandler() { public void onClick(final ClickEvent e) { showMenu(); } }); showImage.setStyleName("menuShowImage"); SimplePanel sp = new SimplePanel(); sp.setWidget(showImage); // This is needed so the menu doesn't maximize vertically, which // would cause it to pull the components apart. SimplePanel outer = new SimplePanel(); outer.setWidget(vpanel); // Do _not_ change this order or add anything before 'outer' deckPanel.add(sp); deckPanel.add(outer); showMenu(); initWidget(deckPanel); // Top bar HorizontalPanel topPanel = new HorizontalPanel(); topPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); topPanel.add(new Image(GWT.getModuleBaseURL() + "images/logo.png")); topPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT); Image hideImage = new Image(GWT.getModuleBaseURL() + "images/menuhidebutton.png"); hideImage.addClickHandler(new ClickHandler() { public void onClick(final ClickEvent e) { hideMenu(); } }); topPanel.add(hideImage); topPanel.setWidth("100%"); vpanel.add(topPanel); // Centrality chooser table vpanel.add(centralityTable); //init admin-panel vpanel.add(adminPanel); //cutoff: Grid cutoffGrid = new Grid(1, 2); cutoffGrid.setWidth("100%"); cutoffGrid.setWidget(0, 0, cutoffLabel); cutoffTextBox.setText("1"); cutoffTextBox.setTextAlignment(TextBoxBase.ALIGN_RIGHT); cutoffTextBox.setStyleName("menuCutoffTextBox"); cutoffGrid.setWidget(0, 1, cutoffTextBox); cutoffGrid.getCellFormatter().setHorizontalAlignment(0, 1, HasHorizontalAlignment.ALIGN_RIGHT); vpanel.add(cutoffGrid); //init buttons HorizontalPanel buttonPanel = new HorizontalPanel(); buttonPanel.setWidth("100%"); //logout-button: buttonPanel.add(new Button(messages.logout(), new ClickHandler() { public void onClick(final ClickEvent e) { EventBus.getHandlerManager().fireEvent(new AttemptLogoutEvent()); } })); buttonPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT); //Submit-button: buttonPanel.add(new Button(messages.confirm(), new ClickHandler() { public void onClick(final ClickEvent e) { requestGraph(); } })); vpanel.add(buttonPanel); CaptionPanel infobox = new CaptionPanel(messages.infoBoxHeader()); infobox.setStyleName("infobox"); VerticalPanel infovpanel = new VerticalPanel(); Label nodeInfoContent = new Label(""); Label edgeInfoContent = new Label(""); nodeInfoContent.getElement().setId(JSXGraphDrawer.NODE_TOOLTIP_ID); edgeInfoContent.getElement().setId(JSXGraphDrawer.EDGE_TOOLTIP_ID); infovpanel.add(nodeInfoContent); infovpanel.add(edgeInfoContent); infobox.setContentWidget(infovpanel); vpanel.add(infobox); }
From source file:edu.ucsb.eucalyptus.admin.client.EucalyptusWebInterface.java
License:Open Source License
public void displayBarAndTabs(String message) { /* top bar */ displayStatusPage("Drawing the tabs..."); HorizontalPanel top_bar = new HorizontalPanel(); top_bar.getElement().setClassName("euca-top-bar"); HorizontalPanel name_panel = new HorizontalPanel(); name_panel.getElement().setClassName("euca-top-bar-left"); name_panel.setSpacing(5);//from w w w. j av a2s . co m name_panel.add(new HTML(Theme.draw_header())); top_bar.add(name_panel); top_bar.setCellHorizontalAlignment(name_panel, HorizontalPanel.ALIGN_LEFT); top_bar.setCellVerticalAlignment(name_panel, HorizontalPanel.ALIGN_TOP); // michael left this as MIDDLE HorizontalPanel upanel = new HorizontalPanel(); upanel.getElement().setClassName("euca-top-bar-right"); Label user_name = new HTML( "Logged in as <b>" + loggedInUser.getUserName() + "</b> | "); Hyperlink logout_button = new Hyperlink("Logout", "logout"); logout_button.addClickListener(LogoutButtonListener); upanel.add(user_name); upanel.add(logout_button); top_bar.add(upanel); top_bar.setCellHorizontalAlignment(upanel, HorizontalPanel.ALIGN_RIGHT); top_bar.setCellVerticalAlignment(upanel, HorizontalPanel.ALIGN_TOP); final HorizontalPanel messageBox = new HorizontalPanel(); messageBox.setStyleName("euca-message-bar"); messageBox.setSpacing(3); messageBox.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT); messageBox.add(statusMessage); statusMessage.setStyleName("euca-small-text"); final VerticalPanel wrapper = new VerticalPanel(); wrapper.setStyleName("euca-tab-contents"); // wrapper.setSize("100%", "80%"); // wrapper.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); // wrapper.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); // set up tab layout so that *TabIndex variables are set in the beginning int nTabs = 0; allTabs = new TabBar(); allTabs.addTab("Credentials"); credsTabIndex = nTabs++; allTabs.addTab("Images"); imgTabIndex = nTabs++; /////allTabs.addTab ("Instances"); instTabIndex = nTabs++; if (loggedInUser.isAdministrator() != null && loggedInUser.isAdministrator().booleanValue()) { allTabs.addTab("Users"); usrTabIndex = nTabs++; allTabs.addTab("Configuration"); confTabIndex = nTabs++; allTabs.addTab("Extras"); downTabIndex = nTabs++; if (extensions != null && extensions.contains("store")) { allTabs.addTab("Store"); storeTabIndex = nTabs++; } } // can happen if admin user re-logs in as regular without reloading if (currentTabIndex > (nTabs - 1)) { currentTabIndex = 0; } allTabs.addTabListener(new TabListener() { public void onTabSelected(SourcesTabEvents sender, int tabIndex) { String error = "This tab is not implemented yet, sorry!"; statusMessage.setText(""); wrapper.clear(); currentTabIndex = tabIndex; if (tabIndex == credsTabIndex) { displayCredentialsTab(wrapper); } else if (tabIndex == imgTabIndex) { displayImagesTab(wrapper); } else if (tabIndex == usrTabIndex) { displayUsersTab(wrapper); } else if (tabIndex == confTabIndex) { displayConfTab(wrapper); } else if (tabIndex == downTabIndex) { displayDownloadsTab(wrapper); } else if (tabIndex == storeTabIndex) { displayStoreTab(wrapper); } else { displayErrorPage("Invalid tab!"); } } public boolean onBeforeTabSelected(SourcesTabEvents sender, int tabIndex) { return true; /* here we could do checking for clicks on disabled tabs */ } }); RootPanel.get().clear(); RootPanel.get().add(top_bar); RootPanel.get().add(allTabs); RootPanel.get().add(messageBox); RootPanel.get().add(wrapper); allTabs.selectTab(currentTabIndex); }
From source file:edu.ucsb.eucalyptus.admin.client.SystemConfigTable.java
License:Open Source License
private void rebuildTable() { this.c_grid.clear(); this.c_grid.resize(2, 2); // this.c_grid.getColumnFormatter().setWidth(0, "190"); // this.c_grid.getColumnFormatter().setWidth(1, "260"); int i = 0;/*from ww w.ja v a2 s . c o m*/ // cloud parameters this.c_grid.setWidget(i, 0, new Label("Cloud Host:")); this.c_grid.getCellFormatter().setHorizontalAlignment(i, 0, HasHorizontalAlignment.ALIGN_RIGHT); cloudHost_box.addChangeListener(new ChangeCallback(this)); cloudHost_box.setVisibleLength(20); cloudHost_box.setText(SystemConfig.getCloudHost()); cloudHost_box.addFocusListener(new FocusHandler(c_hint, "Warning: Changing the Cloud URL will invalidate any existing credentials, and will prevent existing users from accessing the system.")); this.c_grid.setWidget(i++, 1, cloudHost_box); // 2nd row this.c_grid.setWidget(i, 0, new Label("Default kernel:")); this.c_grid.getCellFormatter().setHorizontalAlignment(i, 0, HasHorizontalAlignment.ALIGN_RIGHT); HorizontalPanel hpanel2 = new HorizontalPanel(); hpanel2.setSpacing(0); this.c_grid.setWidget(i++, 1, hpanel2); defaultKernel_box.addChangeListener(new ChangeCallback(this)); defaultKernel_box.setVisibleLength(10); defaultKernel_box.setText(SystemConfig.getDefaultKernelId()); hpanel2.add(defaultKernel_box); hpanel2.add(new HTML(" Default ramdisk: ")); defaultRamdisk_box.addChangeListener(new ChangeCallback(this)); defaultRamdisk_box.setVisibleLength(10); defaultRamdisk_box.setText(SystemConfig.getDefaultRamdiskId()); hpanel2.add(defaultRamdisk_box); // dns params this.dns_grid.clear(); this.dns_grid.resize(2, 2); // this.dns_grid.getColumnFormatter().setWidth(0, "190"); // this.dns_grid.getColumnFormatter().setWidth(1, "260"); i = 0; this.dns_grid.setWidget(i, 0, new Label("Domain name:")); this.dns_grid.getCellFormatter().setHorizontalAlignment(i, 0, HasHorizontalAlignment.ALIGN_RIGHT); dnsDomain_box.addChangeListener(new ChangeCallback(this)); dnsDomain_box.setVisibleLength(20); dnsDomain_box.setText(SystemConfig.getDnsDomain()); this.dns_grid.setWidget(i++, 1, dnsDomain_box); this.dns_grid.setWidget(i, 0, new Label("Nameserver:")); this.dns_grid.getCellFormatter().setHorizontalAlignment(i, 0, HasHorizontalAlignment.ALIGN_RIGHT); HorizontalPanel dns_hpanel2 = new HorizontalPanel(); dns_hpanel2.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT); //dns_hpanel2.add(new Label("Nameserver:")); dns_hpanel2.setSpacing(0); this.dns_grid.setWidget(i++, 1, dns_hpanel2); nameserver_box.addChangeListener(new ChangeCallback(this)); nameserver_box.setVisibleLength(20); nameserver_box.setText(SystemConfig.getNameserver()); dns_hpanel2.add(nameserver_box); dns_hpanel2.add(new HTML(" IP: ")); nameserverAddress_box.addChangeListener(new ChangeCallback(this)); nameserverAddress_box.setVisibleLength(20); nameserverAddress_box.setText(SystemConfig.getNameserverAddress()); dns_hpanel2.add(nameserverAddress_box); }
From source file:edu.ucsc.robot.client.MainScreen.java
License:Apache License
private void setupDialogRoot() { VerticalPanel dialogRoot = new VerticalPanel(); dialogRoot.setSpacing(2);/*w w w . j av a2 s . c om*/ final Label label = new Label("Control"); label.setStyleName("title"); dialog.add(dialogRoot); dialogRoot.add(label); main = new VerticalPanel(); main.setVisible(false); HorizontalPanel hPanel = new HorizontalPanel(); hPanel.setWidth("100%"); hPanel.setHorizontalAlignment(HorizontalPanel.ALIGN_RIGHT); dialogRoot.add(hPanel); hideButton = new Button("Hide Control"); hideButton.setVisible(false); hideButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { main.setVisible(false); hideButton.setVisible(false); Util.rightTop(dialog); } }); hPanel.add(hideButton); dialogRoot.add(main); label.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { showPlayer(); } }); }
From source file:edu.udes.bio.genus.client.ui.menu.Prop_Sequences.java
License:Open Source License
/** * Instantiates a new properties panel for sequences. *//*ww w . j a va 2 s. c o m*/ public Prop_Sequences() { center(); setPopupPosition(getAbsoluteLeft() - (500 / 2), getAbsoluteTop() - 100); setAnimationEnabled(true); setModal(true); add(this.panel); setTextBoxName(); setTextBoxSequence(); // ######################################### // Block for name panel final HorizontalPanel namePanel = new HorizontalPanel(); namePanel.setWidth("500px"); this.panel.add(namePanel); final Label lblName = new Label("Name"); lblName.setSize("100px", "20px"); namePanel.add(lblName); namePanel.add(this.txtName); // ######################################### // Block for sequence entry final HorizontalPanel nucPanel = new HorizontalPanel(); nucPanel.setSize("500px", "20px"); this.panel.add(nucPanel); final Label lblNuc = new Label("Sequence"); lblNuc.setSize("100px", "20px"); nucPanel.add(lblNuc); nucPanel.add(this.txtSequence); // ######################################### // Add the action button panel final HorizontalPanel actionButtonPanel = new HorizontalPanel(); actionButtonPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT); actionButtonPanel.setWidth("500px"); // CANCEL BUTTON final Button btnCancel = new Button("Cancel"); final ClickHandler cancelclick = new ClickHandler() { @Override public void onClick(ClickEvent event) { Prop_Sequences.this.removeFromParent(); } }; btnCancel.addClickHandler(cancelclick); actionButtonPanel.add(btnCancel); // OK BUTTON final Button btnOk = new Button("OK"); final ClickHandler okclick = new ClickHandler() { @Override public void onClick(ClickEvent event) { GenUS.mainMenu.seqMenu.addNewSequence(Prop_Sequences.this.txtName.getText(), Prop_Sequences.this.sequence); Prop_Sequences.this.removeFromParent(); } }; btnOk.addClickHandler(okclick); actionButtonPanel.add(btnOk); this.panel.add(actionButtonPanel); }
From source file:edu.udes.bio.genus.client.ui.menu.Prop_Strands.java
License:Open Source License
private void init() { clear();//from ww w. j a v a 2 s .c om this.basePropertiesPanel = new VerticalPanel(); this.basePropertiesPanel.setBorderWidth(0); this.basePropertiesPanel.setSize("500px", "125px"); this.add(this.basePropertiesPanel); setTextBoxName(); setTextBoxStructure(); setTextBoxSequence(); setListBoxColor(); setListBoxStyle(); setListBoxStyle(); // ######################################### // Block for name panel final HorizontalPanel namePanel = new HorizontalPanel(); namePanel.setWidth("500px"); this.basePropertiesPanel.add(namePanel); final Label lblName = new Label("Name"); lblName.setSize("100px", "20px"); namePanel.add(lblName); namePanel.add(this.txtName); // ######################################### // Block for dp entry final HorizontalPanel dpPanel = new HorizontalPanel(); dpPanel.setWidth("500px"); this.basePropertiesPanel.add(dpPanel); final Label lblDp = new Label("Structure"); lblDp.setTitle("DotParentesis"); lblDp.setSize("100px", "20px"); dpPanel.add(lblDp); dpPanel.add(this.txtStructure); // ######################################### // Block for sequence entry final HorizontalPanel nucPanel = new HorizontalPanel(); nucPanel.setSize("500px", "20px"); this.basePropertiesPanel.add(nucPanel); final Label lblNuc = new Label("Sequence"); lblNuc.setSize("100px", "20px"); nucPanel.add(lblNuc); nucPanel.add(this.txtSequence); // ######################################### // Dropdown for color type final HorizontalPanel oPanel = new HorizontalPanel(); oPanel.setSize("500px", "20px"); this.basePropertiesPanel.add(oPanel); final Label lblCol = new Label("Colors :"); lblCol.setSize("50px", "20px"); oPanel.add(lblCol); oPanel.add(this.lbColor); // ######################################### // Add the style list final Label lblStyle = new Label("Style :"); lblStyle.setSize("50px", "20px"); oPanel.add(lblStyle); oPanel.add(this.lbStyle); // ######################################### // Add the action button panel final HorizontalPanel actionButtonPanel = new HorizontalPanel(); actionButtonPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT); actionButtonPanel.setWidth("500px"); // CANCEL BUTTON final Image iH = new Image(this.imagesBundle.hideButtonIcon()); this.btnHide = new CustomButton(iH) { @Override protected void onClick() { getParent().getParent().setVisible(false); } }; actionButtonPanel.add(this.btnHide); this.basePropertiesPanel.add(actionButtonPanel); DOM.setStyleAttribute(getElement(), "border", "1px solid grey"); DOM.setStyleAttribute(getElement(), "background", "#e3e8f3"); this.setVisible(true); }
From source file:edu.udes.bio.genus.client.ui.menu.Prop_Structures.java
License:Open Source License
/** * Instantiates a new structure proproperties panel. *//*from w w w . j a va2 s .co m*/ public Prop_Structures() { center(); setPopupPosition(getAbsoluteLeft() - (500 / 2), getAbsoluteTop() - 100); setAnimationEnabled(true); setModal(true); add(this.panel); setTextBoxName(); setTextBoxSequence(); // ######################################### // Block for name panel final HorizontalPanel namePanel = new HorizontalPanel(); namePanel.setWidth("500px"); this.panel.add(namePanel); final Label lblName = new Label("Name"); lblName.setSize("100px", "20px"); namePanel.add(lblName); namePanel.add(this.txtName); // ######################################### // Block for sequence entry final HorizontalPanel nucPanel = new HorizontalPanel(); nucPanel.setSize("500px", "20px"); this.panel.add(nucPanel); final Label lblNuc = new Label("Structure"); lblNuc.setTitle("DotPaenesis"); lblNuc.setSize("100px", "20px"); nucPanel.add(lblNuc); nucPanel.add(this.txtStructure); // ######################################### // Add the action button panel final HorizontalPanel actionButtonPanel = new HorizontalPanel(); actionButtonPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT); actionButtonPanel.setWidth("500px"); // CANCEL BUTTON final Button btnCancel = new Button("Cancel"); final ClickHandler cancelclick = new ClickHandler() { @Override public void onClick(ClickEvent event) { Prop_Structures.this.removeFromParent(); } }; btnCancel.addClickHandler(cancelclick); actionButtonPanel.add(btnCancel); // OK BUTTON final Button btnOk = new Button("OK"); final ClickHandler okclick = new ClickHandler() { @Override public void onClick(ClickEvent event) { GenUS.mainMenu.structMenu.addNewStrucure(Prop_Structures.this.txtName.getText(), Prop_Structures.this.structure); Prop_Structures.this.removeFromParent(); } }; btnOk.addClickHandler(okclick); actionButtonPanel.add(btnOk); this.panel.add(actionButtonPanel); }
From source file:es.upm.fi.dia.oeg.map4rdf.client.view.FiltersView.java
License:Open Source License
private void addFilter(FlowPanel filters, DateFilter dateFilter) { if (dateFilters.contains(dateFilter)) { widgetFactory.getDialogBox().showError(messages.existsOtherDateFilterEqual()); } else {//w w w . j a v a2 s . c o m HorizontalPanel dateFilterPanel = new HorizontalPanel(); dateFilterPanel.setSpacing(5); dateFilterPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); dateFilterPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); dateFilterPanel.setStyleName(resources.css().dateFilterBox()); String message = getDateFilterTypeMessage(dateFilter.getFilter()); if (message != null) { dateFilters.add(dateFilter); dateFilterPanel.add(new Label(message)); dateFilterPanel.add(new Label(dateTimeFormater(dateFilter.getDate()))); Image removeImage = new Image(resources.eraserIcon()); removeImage.getElement().getStyle().setCursor(Cursor.POINTER); dateFilterPanel.add(removeImage); addRemoveFilterEvent(removeImage, filters, dateFilterPanel, dateFilter); filters.add(dateFilterPanel); fireDateFilterChangeEvent(); } else { widgetFactory.getDialogBox().showError(messages.errorFilterType()); } } }
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 ww.j av a 2 s . c om*/ 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(); }
From source file:gov.nist.appvet.gwt.client.gui.dialog.AppUploadDialogBox.java
License:Open Source License
public AppUploadDialogBox(String sessionId, String servletURL) { super(false, true); setSize("", ""); setAnimationEnabled(false);/*from w ww. j a v a2s.c o m*/ final VerticalPanel dialogVPanel = new VerticalPanel(); dialogVPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); dialogVPanel.addStyleName("dialogVPanel"); dialogVPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); this.setWidget(dialogVPanel); dialogVPanel.setSize("", ""); final SimplePanel simplePanel = new SimplePanel(); simplePanel.setStyleName("appUploadPanel"); dialogVPanel.add(simplePanel); dialogVPanel.setCellVerticalAlignment(simplePanel, HasVerticalAlignment.ALIGN_MIDDLE); dialogVPanel.setCellHorizontalAlignment(simplePanel, HasHorizontalAlignment.ALIGN_CENTER); simplePanel.setSize("", ""); uploadAppForm = new FormPanel(); simplePanel.setWidget(uploadAppForm); uploadAppForm.setAction(servletURL); uploadAppForm.setMethod(FormPanel.METHOD_POST); uploadAppForm.setEncoding(FormPanel.ENCODING_MULTIPART); uploadAppForm.setSize("", ""); final VerticalPanel verticalPanel = new VerticalPanel(); verticalPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); verticalPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); uploadAppForm.setWidget(verticalPanel); verticalPanel.setSize("", ""); final Hidden hiddenCommand = new Hidden(); hiddenCommand.setValue("SUBMIT_APP"); hiddenCommand.setName("command"); verticalPanel.add(hiddenCommand); hiddenCommand.setWidth(""); final Hidden hiddenSessionId = new Hidden(); hiddenSessionId.setName("sessionid"); hiddenSessionId.setValue(sessionId); verticalPanel.add(hiddenSessionId); hiddenSessionId.setWidth(""); final HorizontalPanel horizontalButtonPanel = new HorizontalPanel(); horizontalButtonPanel.setStyleName("buttonPanel"); dialogVPanel.add(horizontalButtonPanel); horizontalButtonPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); dialogVPanel.setCellVerticalAlignment(horizontalButtonPanel, HasVerticalAlignment.ALIGN_MIDDLE); dialogVPanel.setCellHorizontalAlignment(horizontalButtonPanel, HasHorizontalAlignment.ALIGN_CENTER); horizontalButtonPanel.setSpacing(10); horizontalButtonPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); horizontalButtonPanel.setWidth("300px"); verticalPanel.setCellWidth(horizontalButtonPanel, "100%"); final Grid grid = new Grid(2, 2); grid.setStyleName("grid"); verticalPanel.add(grid); verticalPanel.setCellHorizontalAlignment(grid, HasHorizontalAlignment.ALIGN_CENTER); verticalPanel.setCellVerticalAlignment(grid, HasVerticalAlignment.ALIGN_MIDDLE); grid.setSize("", ""); final Label uploadLabel = new Label("App file: "); uploadLabel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT); grid.setWidget(0, 0, uploadLabel); uploadLabel.setStyleName("uploadLabel"); uploadLabel.setSize("", ""); fileUpload = new FileUpload(); grid.setWidget(0, 1, fileUpload); grid.getCellFormatter().setWidth(0, 1, ""); grid.getCellFormatter().setHeight(0, 1, ""); fileUpload.setStyleName("appUpload"); fileUpload.setTitle("Select app file to upload"); fileUpload.setName("fileupload"); fileUpload.setSize("240px", ""); grid.getCellFormatter().setVerticalAlignment(0, 0, HasVerticalAlignment.ALIGN_MIDDLE); grid.getCellFormatter().setVerticalAlignment(1, 0, HasVerticalAlignment.ALIGN_MIDDLE); grid.getCellFormatter().setVerticalAlignment(0, 1, HasVerticalAlignment.ALIGN_MIDDLE); grid.getCellFormatter().setHorizontalAlignment(1, 1, HasHorizontalAlignment.ALIGN_LEFT); grid.getCellFormatter().setVerticalAlignment(1, 1, HasVerticalAlignment.ALIGN_MIDDLE); grid.getCellFormatter().setHorizontalAlignment(1, 0, HasHorizontalAlignment.ALIGN_LEFT); grid.getCellFormatter().setHorizontalAlignment(0, 1, HasHorizontalAlignment.ALIGN_LEFT); grid.getCellFormatter().setHorizontalAlignment(0, 0, HasHorizontalAlignment.ALIGN_CENTER); submitAppStatusLabel = new Label(""); submitAppStatusLabel.setStyleName("submissionRequirementsLabel"); submitAppStatusLabel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); verticalPanel.add(submitAppStatusLabel); verticalPanel.setCellHorizontalAlignment(submitAppStatusLabel, HasHorizontalAlignment.ALIGN_CENTER); verticalPanel.setCellVerticalAlignment(submitAppStatusLabel, HasVerticalAlignment.ALIGN_MIDDLE); submitAppStatusLabel.setSize("", "18px"); cancelButton = new PushButton("Cancel"); cancelButton.setHTML("Cancel"); horizontalButtonPanel.add(cancelButton); horizontalButtonPanel.setCellHorizontalAlignment(cancelButton, HasHorizontalAlignment.ALIGN_CENTER); cancelButton.setSize("70px", "18px"); submitButton = new PushButton("Submit"); horizontalButtonPanel.add(submitButton); horizontalButtonPanel.setCellHorizontalAlignment(submitButton, HasHorizontalAlignment.ALIGN_CENTER); submitButton.setSize("70px", "18px"); submitButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { uploadAppForm.submit(); } }); }