List of usage examples for com.google.gwt.user.client.ui DockPanel setCellVerticalAlignment
@Override public void setCellVerticalAlignment(Widget w, VerticalAlignmentConstant align)
From source file:gov.nist.appvet.gwt.client.gui.LoginPanel.java
License:Open Source License
public LoginPanel(Unit unit) { super(Unit.PX); final String version = AppVetProperties.VERSION; log.info("Starting AppVet v" + version + "..."); setSize("100%", ""); DockPanel dockPanel_1 = new DockPanel(); dockPanel_1.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT); addNorth(dockPanel_1, 32.0);/* ww w.j a v a 2 s . co m*/ dockPanel_1.setWidth("100%"); Image image = new Image("images/nist-gray.png"); image.setStyleName("nistLoginLogo"); dockPanel_1.add(image, DockPanel.EAST); dockPanel_1.setCellVerticalAlignment(image, HasVerticalAlignment.ALIGN_MIDDLE); dockPanel_1.setCellHorizontalAlignment(image, HasHorizontalAlignment.ALIGN_RIGHT); final VerticalPanel centerVerticalPanel = new VerticalPanel(); centerVerticalPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); centerVerticalPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); add(centerVerticalPanel); centerVerticalPanel.setSize("100%", "90%"); final DecoratorPanel decoratorPanel = new DecoratorPanel(); centerVerticalPanel.add(decoratorPanel); centerVerticalPanel.setCellWidth(decoratorPanel, "100%"); decoratorPanel.setSize("", ""); centerVerticalPanel.setCellHorizontalAlignment(decoratorPanel, HasHorizontalAlignment.ALIGN_CENTER); centerVerticalPanel.setCellVerticalAlignment(decoratorPanel, HasVerticalAlignment.ALIGN_MIDDLE); final DockPanel dockPanel = new DockPanel(); dockPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); dockPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); decoratorPanel.setWidget(dockPanel); dockPanel.setSize("100%", "200px"); final VerticalPanel verticalPanel = new VerticalPanel(); verticalPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); verticalPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); dockPanel.add(verticalPanel, DockPanel.NORTH); dockPanel.setCellWidth(verticalPanel, "100%"); dockPanel.setCellVerticalAlignment(verticalPanel, HasVerticalAlignment.ALIGN_MIDDLE); dockPanel.setCellHorizontalAlignment(verticalPanel, HasHorizontalAlignment.ALIGN_CENTER); verticalPanel.setSize("300px", "90px"); final Image appVetImage = new Image("images/appvet_logo.png"); appVetImage.setStyleName("loginPanelLogo"); verticalPanel.add(appVetImage); verticalPanel.setCellHorizontalAlignment(appVetImage, HasHorizontalAlignment.ALIGN_CENTER); verticalPanel.setCellVerticalAlignment(appVetImage, HasVerticalAlignment.ALIGN_MIDDLE); appVetImage.setSize("192px", "73px"); loginStatusLabel.setStyleName("submissionRequirementsLabel"); verticalPanel.add(loginStatusLabel); loginStatusLabel.setVisible(true); loginStatusLabel.setSize("200px", "20px"); verticalPanel.setCellHorizontalAlignment(loginStatusLabel, HasHorizontalAlignment.ALIGN_CENTER); final Grid grid = new Grid(2, 2); grid.setStyleName("loginGrid"); dockPanel.add(grid, DockPanel.CENTER); dockPanel.setCellWidth(grid, "100%"); grid.setHeight(""); dockPanel.setCellVerticalAlignment(grid, HasVerticalAlignment.ALIGN_MIDDLE); dockPanel.setCellHorizontalAlignment(grid, HasHorizontalAlignment.ALIGN_CENTER); final Label usernameLabel = new Label("USERNAME"); usernameLabel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT); grid.setWidget(0, 0, usernameLabel); usernameLabel.setSize("100px", "20px"); grid.getCellFormatter().setHorizontalAlignment(0, 0, HasHorizontalAlignment.ALIGN_LEFT); grid.getCellFormatter().setVerticalAlignment(0, 0, HasVerticalAlignment.ALIGN_MIDDLE); grid.setWidget(0, 1, userNameTextBox); userNameTextBox.setSize("180px", "15px"); grid.getCellFormatter().setHorizontalAlignment(0, 1, HasHorizontalAlignment.ALIGN_RIGHT); grid.getCellFormatter().setVerticalAlignment(0, 1, HasVerticalAlignment.ALIGN_MIDDLE); final Label passwordLabel = new Label("PASSWORD"); passwordLabel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT); grid.setWidget(1, 0, passwordLabel); passwordLabel.setSize("100px", "20px"); grid.getCellFormatter().setHorizontalAlignment(1, 0, HasHorizontalAlignment.ALIGN_LEFT); grid.getCellFormatter().setVerticalAlignment(1, 0, HasVerticalAlignment.ALIGN_MIDDLE); grid.setWidget(1, 1, passwordTextBox); passwordTextBox.setSize("180px", "15px"); grid.getCellFormatter().setHorizontalAlignment(1, 1, HasHorizontalAlignment.ALIGN_RIGHT); grid.getCellFormatter().setVerticalAlignment(1, 1, HasVerticalAlignment.ALIGN_MIDDLE); passwordTextBox.addKeyPressHandler(new KeyPressHandler() { @Override public void onKeyPress(KeyPressEvent event_) { final boolean enterPressed = KeyCodes.KEY_ENTER == event_.getNativeEvent().getKeyCode(); if (enterPressed) { getUserInput(); } } }); final SimplePanel simplePanel_3 = new SimplePanel(); simplePanel_3.setStyleName("buttonPanel"); dockPanel.add(simplePanel_3, DockPanel.SOUTH); simplePanel_3.setHeight("28px"); dockPanel.setCellVerticalAlignment(simplePanel_3, HasVerticalAlignment.ALIGN_MIDDLE); dockPanel.setCellHorizontalAlignment(simplePanel_3, HasHorizontalAlignment.ALIGN_CENTER); loginButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { getUserInput(); } }); simplePanel_3.setWidget(loginButton); loginButton.setText("LOGIN"); loginButton.setSize("78px", "26px"); }
From source file:org.gwm.splice.client.dialog.MessageBox.java
License:Apache License
MessageBox(int icon, String title, String message, int buttons) { super(title); DockPanel panel = new DockPanel(); panel.setSpacing(7);/* w ww . j ava 2 s . c om*/ panel.add(getIconImage(icon), DockPanel.WEST); panel.add(new HTML(message), DockPanel.CENTER); Button okButton = new Button("OK", this); panel.add(okButton, DockPanel.SOUTH); panel.setCellHorizontalAlignment(okButton, DockPanel.ALIGN_CENTER); panel.setCellVerticalAlignment(okButton, DockPanel.ALIGN_BOTTOM); panel.setHeight("100%"); panel.setWidth("100%"); setWidget(panel); setMaximizable(false); setMinimizable(false); // setResizable(false); setWidth(300); setHeight(100); }
From source file:org.pentaho.gwt.widgets.client.wizards.AbstractWizardDialog.java
License:Open Source License
/** * layout()/*from w w w . ja v a 2 s . c o m*/ * * Lays out the GUI elements. Should only be called ONCE during the objects lifecycle */ protected void layout() { // Create the overall container to be displayed in the dialog SimplePanel deckWrapper = new SimplePanel(); deckWrapper.setHeight("100%"); deckWrapper.setWidth("100%"); deckWrapper.setStyleName("dialog-content"); DockPanel content = new DockPanel(); // Create the Steps and add it to the content stepsList = new VerticalPanel(); stepsList.add(new Label(Messages.getString("dialog.steps"))); steps.setVisibleItemCount(STEPS_COUNT); stepsList.add(steps); // steps.setSize("30%", "100%"); content.add(stepsList, DockPanel.WEST); // Add the wizardPanels to the Deck and add the deck to the content // wizardDeckPanel.setSize("70%", "100%"); deckWrapper.setWidget(wizardDeckPanel); content.add(deckWrapper, DockPanel.CENTER); wizardDeckPanel.addStyleName(WIZARD_DECK_PANEL); // Add the control buttons HorizontalPanel wizardButtonPanel = new HorizontalPanel(); wizardButtonPanel.setSpacing(2); // If we have only one button then we dont need to show the back and next button. wizardButtonPanel.add(backButton); wizardButtonPanel.add(nextButton); wizardButtonPanel.add(finishButton); wizardButtonPanel.add(cancelButton); wizardButtonPanel.addStyleName(WIZARD_BUTTON_PANEL); HorizontalPanel wizardButtonPanelWrapper = new HorizontalPanel(); wizardButtonPanelWrapper.setWidth("100%"); //$NON-NLS-1$ wizardButtonPanelWrapper.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT); wizardButtonPanelWrapper.setVerticalAlignment(HasVerticalAlignment.ALIGN_BOTTOM); wizardButtonPanelWrapper.add(wizardButtonPanel); content.add(wizardButtonPanelWrapper, DockPanel.SOUTH); content.setCellVerticalAlignment(wizardButtonPanelWrapper, HasVerticalAlignment.ALIGN_BOTTOM); // Add the content to the dialog add(content); content.setWidth("100%"); //$NON-NLS-1$ content.setHeight("100%"); //$NON-NLS-1$ content.setCellHeight(deckWrapper, "98%"); }
From source file:org.pepstock.jem.gwt.client.commons.MessageBox.java
License:Open Source License
/** * A generic message box, like a javascript Window.alert * // ww w.j a va 2 s .co m * @param image image to show on west * @param title title of message to show * @param message content of message to show * */ public MessageBox(ImageResource image, String title, String message) { super(false, true); setAnimationEnabled(true); setGlassEnabled(true); setStyleName(Styles.INSTANCE.messageBox().main()); // sets message final HTML msg = new HTML(message); msg.addStyleName(Styles.INSTANCE.messageBox().message()); // sets Max Width! int maxWidth = Window.getClientWidth() * 75 / 100; getElement().getStyle().setPropertyPx("maxWidth", maxWidth); // dialog box content DockPanel dock = new DockPanel(); dock.setSpacing(5); final HorizontalPanel flow = new HorizontalPanel(); flow.setSpacing(4); // add buttons to box if (getPreferredButtons() != null) { for (int i = 0; i < getPreferredButtons().length; i++) { PreferredButton button = getPreferredButtons()[i]; button.setMessageBox(this); flow.add(button); } } // sets default button final int defaultButtonIndex = flow.getWidgetIndex(getDefaultButton()); ((PreferredButton) flow.getWidget(defaultButtonIndex)) .addStyleName(Styles.INSTANCE.common().defaultActionButton()); dock.add(flow, DockPanel.SOUTH); dock.setCellHorizontalAlignment(flow, DockPanel.ALIGN_CENTER); // adds title if (title != null) { final Label t = new Label(title); t.addStyleName(Styles.INSTANCE.messageBox().title()); dock.add(t, DockPanel.NORTH); dock.setCellHorizontalAlignment(t, DockPanel.ALIGN_CENTER); } dock.add(msg, DockPanel.CENTER); dock.setCellVerticalAlignment(msg, DockPanel.ALIGN_MIDDLE); // adds image dock.add(new Image((image == null) ? Images.INSTANCE.info() : image), DockPanel.WEST); dock.setWidth(Sizes.HUNDRED_PERCENT); setWidget(dock); // handle default button selection (deferred) Scheduler.get().scheduleDeferred(new ScheduledCommand() { public void execute() { ((PreferredButton) flow.getWidget(defaultButtonIndex)).setFocus(true); } }); }