Example usage for com.google.gwt.user.client.ui HasVerticalAlignment ALIGN_MIDDLE

List of usage examples for com.google.gwt.user.client.ui HasVerticalAlignment ALIGN_MIDDLE

Introduction

In this page you can find the example usage for com.google.gwt.user.client.ui HasVerticalAlignment ALIGN_MIDDLE.

Prototype

VerticalAlignmentConstant ALIGN_MIDDLE

To view the source code for com.google.gwt.user.client.ui HasVerticalAlignment ALIGN_MIDDLE.

Click Source Link

Document

Specifies that the widget's contents should be aligned in the middle.

Usage

From source file:edu.ucsb.eucalyptus.admin.client.EucalyptusWebInterface.java

License:Open Source License

public void displayLoginPage(String greeting) {
    History.newItem("login");
    label_box.setText(greeting);/*from w w w .ja v  a 2  s . co  m*/
    label_box.setStyleName("euca-greeting-normal");
    final TextBox login_box = new TextBox();
    login_box.setFocus(true); // this box gets focus first
    final PasswordTextBox pass_box = new PasswordTextBox();

    ClickListener LoginButtonListener = new ClickListener() {
        public void onClick(Widget sender) {
            /* perform checks */
            if (login_box.getText().length() < 1) {
                displayLoginErrorPage("Username is empty!");
                return;
            }
            if (pass_box.getText().length() < 1) {
                displayLoginErrorPage("Password is empty!");
                return;
            }

            label_box.setText("Contacting the server...");
            label_box.setStyleName("euca-greeting-pending");
            EucalyptusWebBackend.App.getInstance().getNewSessionID(login_box.getText(),
                    GWTUtils.md5(pass_box.getText()), new AsyncCallback() {
                        public void onSuccess(Object result) {
                            sessionId = (String) result;
                            long expiresMs = System.currentTimeMillis() + (7 * 24 * 60 * 60 * 1000); /* week */
                            Date expires = new Date(expiresMs);
                            if (check_box.isChecked()) {
                                Cookies.setCookie(cookie_name, sessionId, expires);
                            } else {
                                /* this cookie should expire at the end of the session */
                                /* TODO: does this work right in all browsers? */
                                Cookies.setCookie(cookie_name, sessionId, new Date(0));
                            }
                            attemptLogin();
                        }

                        public void onFailure(Throwable caught) {
                            displayLoginErrorPage((String) caught.getMessage());
                        }
                    });
        }
    };

    ClickListener RecoverButtonListener = new ClickListener() {
        public void onClick(Widget sender) {
            displayInitiatePasswordRecoveryPage();
        }
    };

    Button submit_button = new Button(MSG.signInButton(), LoginButtonListener);
    Hyperlink signup_button = new Hyperlink(MSG.applyButton(), "apply");
    signup_button.addClickListener(AddUserButtonListener);
    Hyperlink recover_button = new Hyperlink(MSG.recoverButton(), "recover");
    recover_button.addClickListener(RecoverButtonListener);
    remember_label.setStyleName("euca-remember-text");

    /* enable login by pressing Enter */
    EucalyptusKeyboardListener sl = new EucalyptusKeyboardListener(submit_button);
    submit_button.addKeyboardListener(sl);
    login_box.addKeyboardListener(sl);
    pass_box.addKeyboardListener(sl);

    Grid g = new Grid(4, 2);
    g.setCellSpacing(4);
    g.setWidget(0, 0, new Label(MSG.usernameField() + ":"));
    g.getCellFormatter().setHorizontalAlignment(0, 0, HasHorizontalAlignment.ALIGN_RIGHT);
    g.setWidget(1, 0, new Label(MSG.passwordField() + ":"));
    g.getCellFormatter().setHorizontalAlignment(1, 0, HasHorizontalAlignment.ALIGN_RIGHT);
    g.setWidget(0, 1, login_box);
    g.setWidget(1, 1, pass_box);
    g.setWidget(2, 0, check_box);
    g.getCellFormatter().setHorizontalAlignment(2, 0, HasHorizontalAlignment.ALIGN_RIGHT);
    g.setWidget(2, 1, remember_label);
    g.setWidget(3, 1, submit_button);
    VerticalPanel panel = new VerticalPanel();
    panel.add(g);
    panel.setStyleName("euca-login-panel");
    panel.setCellHorizontalAlignment(g, HasHorizontalAlignment.ALIGN_CENTER);
    panel.setCellVerticalAlignment(g, HasVerticalAlignment.ALIGN_MIDDLE);

    HorizontalPanel hpanel = new HorizontalPanel();
    hpanel.setSpacing(2);
    if (enable_signups) {
        hpanel.add(signup_button);
        hpanel.add(new HTML("&nbsp;" + MSG.forAccount() + "&nbsp;&nbsp;|&nbsp;&nbsp;"));
    }
    hpanel.add(recover_button);
    hpanel.add(new HTML("&nbsp;" + MSG.thePassword()));

    VerticalPanel vpanel = new VerticalPanel();
    vpanel.setSpacing(15);
    vpanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    if (logo != null) {
        vpanel.add(logo);
    }
    if (version != null) {
        Label version_label = new Label("Version " + version);
        version_label.setStyleName("euca-small-text");
        vpanel.add(version_label);
    }
    vpanel.add(label_box);
    vpanel.add(panel);
    if (server_ready.booleanValue()) {
        vpanel.add(hpanel);
    }

    VerticalPanel wrapper = new VerticalPanel();
    wrapper.add(vpanel);
    wrapper.setSize("100%", "100%");
    wrapper.setCellHorizontalAlignment(vpanel, VerticalPanel.ALIGN_CENTER);
    wrapper.setCellVerticalAlignment(vpanel, VerticalPanel.ALIGN_MIDDLE);

    RootPanel.get().clear();
    RootPanel.get().add(wrapper);
}

From source file:edu.ucsb.eucalyptus.admin.client.EucalyptusWebInterface.java

License:Open Source License

private Button displayDialog(String greeting, String message, Button firstButton) {
    if (message == null || message.equalsIgnoreCase("")) {
        message = "Server is not accessible!"; // TODO: any other reasons why message would be empty?
    }/*  w  ww  .  j  a v  a 2  s  . co  m*/
    label_box.setText(greeting);
    label_box.setStyleName("euca-greeting-normal");
    Label m = new Label(message);
    m.setWidth("300");

    VerticalPanel panel = new VerticalPanel();
    panel.add(m);
    panel.setStyleName("euca-login-panel");
    panel.setCellHorizontalAlignment(m, HasHorizontalAlignment.ALIGN_CENTER);
    panel.setCellVerticalAlignment(m, HasVerticalAlignment.ALIGN_MIDDLE);
    Button ok_button = new Button("Ok", DefaultPageButtonListener);

    HorizontalPanel hpanel = new HorizontalPanel();
    hpanel.setSpacing(10);
    if (firstButton != null) {
        hpanel.add(firstButton);
    }
    hpanel.add(ok_button);

    VerticalPanel vpanel = new VerticalPanel();
    vpanel.setSpacing(15);
    vpanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    if (logo != null) {
        vpanel.add(logo);
    }
    vpanel.add(label_box);
    vpanel.add(panel);
    vpanel.add(hpanel);

    VerticalPanel wrapper = new VerticalPanel();
    wrapper.add(vpanel);
    wrapper.setSize("100%", "100%");
    wrapper.setCellHorizontalAlignment(vpanel, VerticalPanel.ALIGN_CENTER);
    wrapper.setCellVerticalAlignment(vpanel, VerticalPanel.ALIGN_MIDDLE);

    RootPanel.get().clear();
    RootPanel.get().add(wrapper);

    return ok_button;
}

From source file:edu.ucsb.eucalyptus.admin.client.EucalyptusWebInterface.java

License:Open Source License

public void displayStatusPage(String message) {
    label_box.setText(message);/*from   w w w. ja  v a  2 s  . c om*/
    label_box.setStyleName("euca-greeting-pending");

    final VerticalPanel wrapper = new VerticalPanel();
    wrapper.setSize("100%", "100%");
    wrapper.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    wrapper.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    wrapper.add(label_box);

    RootPanel.get().clear();
    RootPanel.get().add(wrapper);
}

From source file:edu.ucsb.eucalyptus.admin.client.SystemConfigTable.java

License:Open Source License

public SystemConfigTable(String sessionId) {
    this.sessionId = sessionId;
    this.setStyleName("euca-config-component");
    //      this.setSpacing (10);
    this.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    //      this.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    Label SystemConfigsHeader = new Label("Cloud configuration:");
    SystemConfigsHeader.setStyleName("euca-section-header");
    this.add(SystemConfigsHeader);
    HorizontalPanel c_hpanel = new HorizontalPanel();
    c_hpanel.add(this.c_grid);
    c_hpanel.add(this.c_hint);
    //      c_hint.setWidth ("180");
    this.add(c_hpanel);
    HorizontalPanel c_hpanel2 = new HorizontalPanel();
    c_hpanel2.setSpacing(10);/*from w w w  .  j a  va 2  s  . com*/
    c_hpanel2.add(new EucaButton("Save Configuration", new SaveCallback(this)));
    c_hpanel2.add(this.c_status);
    this.c_status.setText("");
    this.c_status.setStyleName("euca-greeting-pending");
    //      this.c_status.setWidth ("250");
    this.add(c_hpanel2);

    Label DNSConfigHeader = new Label("DNS configuration:");
    DNSConfigHeader.setStyleName("euca-section-header");
    this.add(DNSConfigHeader);
    HorizontalPanel dns_hpanel = new HorizontalPanel();
    dns_hpanel.add(this.dns_grid);
    dns_hpanel.add(this.dns_hint);
    //      dns_hint.setWidth ("180");
    this.add(dns_hpanel);
    HorizontalPanel dns_hpanel2 = new HorizontalPanel();
    dns_hpanel2.setSpacing(10);
    dns_hpanel2.add(new EucaButton("Save Configuration", new SaveCallback(this)));
    dns_hpanel2.add(this.dns_status);
    this.dns_status.setText("");
    this.dns_status.setStyleName("euca-greeting-pending");
    //      this.dns_status.setWidth ("250");
    this.add(dns_hpanel2);

    this.rebuildTable();
    EucalyptusWebBackend.App.getInstance().getSystemConfig(this.sessionId, new GetCallback(this));
}

From source file:edu.ucsb.eucalyptus.admin.client.VmTypeTable.java

License:Open Source License

public VmTypeTable(String sessionId) {
    this.sessionId = sessionId;
    this.setStyleName("euca-config-component");
    this.setSpacing(10);
    this.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    //      this.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    Label VmTypesHeader = new Label("VM Types:");
    VmTypesHeader.setStyleName("euca-section-header");
    this.add(VmTypesHeader);
    this.add(this.grid);
    HorizontalPanel hpanel = new HorizontalPanel();
    hpanel.setSpacing(5);/*  www  .j  a  va  2  s .co  m*/
    hpanel.add(new EucaButton("Save VmTypes", new SaveCallback(this)));
    hpanel.add(this.statusLabel);
    //      this.statusLabel.setWidth ("250");
    this.statusLabel.setText("");
    this.statusLabel.setStyleName("euca-greeting-pending");
    this.add(hpanel);
    EucalyptusWebBackend.App.getInstance().getVmTypes(this.sessionId, new GetCallback(this));
}

From source file:edu.ucsb.eucalyptus.admin.client.WalrusInfoTable.java

License:Open Source License

public WalrusInfoTable(String sessionId) {
    this.sessionId = sessionId;
    this.setStyleName("euca-config-component");
    this.setSpacing(2);
    this.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    //      this.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    Label walrusesHeader = new Label("Walrus Configuration:");
    walrusesHeader.setStyleName("euca-section-header");
    this.add(walrusesHeader);
    this.noWalrusesLabel.setText("No Walrus hosts registered");
    this.noWalrusesLabel.setStyleName("euca-greeting-disabled");
    HorizontalPanel grid_and_hint = new HorizontalPanel();
    grid_and_hint.add(this.grid);
    grid_and_hint.add(this.hint);
    this.hint.setWidth("100");
    this.add(grid_and_hint);
    HorizontalPanel hpanel = new HorizontalPanel();
    hpanel.setSpacing(2);//from   w w w  .jav a 2  s  .  com
    hpanel.add(add_button);
    hpanel.add(new EucaButton("Save Walrus configuration", new SaveCallback(this)));
    hpanel.add(this.statusLabel);
    //      this.statusLabel.setWidth ("250");
    this.statusLabel.setText("");
    this.statusLabel.setStyleName("euca-greeting-pending");
    this.add(hpanel);
    rebuildTable();
    EucalyptusWebBackend.App.getInstance().getWalrusList(this.sessionId, new GetWalrusListCallback(this));
}

From source file:edu.udes.bio.genus.client.ui.menu.Sequence.java

License:Open Source License

/**
 * Instantiates a new sequence./*from ww  w .  j  a v  a2 s. c om*/
 * 
 * @param name
 *            the name
 * @param sequence
 *            the sequence itself (ex: "GACU GA")
 */
public Sequence(String name, String sequence) {
    super();
    if (name.equals("")) {
        this.name = sequence;
    } else {
        this.name = name;
    }
    this.sequence = sequence;

    // Setup main panel
    DOM.setStyleAttribute(getElement(), "border", "1px solid #e3e8f3");
    setSize("90%", "20px");
    setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);

    // Create and setup label for the name of the strand
    this.sName.setPixelSize(164, 20);
    updateName();
    add(this.sName);

    final Image iD = new Image(this.imagesBundle.cancelButtonIcon());
    final CustomButton btnDel = new CustomButton(iD) {
        @Override
        protected void onClick() {
            if (DOM.eventGetCtrlKey(DOM.eventGetCurrentEvent())
                    || Window.confirm("Are you sure you want to delete this strand ?")) {
                GenUS.mainMenu.seqMenu.removeSequence(Sequence.this);
            }
        }
    };
    btnDel.setSize("16px", "16px");
    btnDel.setTitle("Press Ctrl to delete without confirmation.");
    add(btnDel);

    // Setup Widget
    final MouseOverHandler overHandler = new MouseOverHandler() {
        @Override
        public void onMouseOver(MouseOverEvent event) {
            DOM.setStyleAttribute(getElement(), "backgroundColor", "#e3e8f3");
            DOM.setStyleAttribute(getElement(), "border", "1px solid lightgrey");
        }
    };
    addDomHandler(overHandler, MouseOverEvent.getType());
    final MouseOutHandler leaveHandler = new MouseOutHandler() {

        @Override
        public void onMouseOut(MouseOutEvent event) {
            DOM.setStyleAttribute(getElement(), "backgroundColor", "white");
            DOM.setStyleAttribute(getElement(), "border", "1px solid #e3e8f3");
        }
    };
    addDomHandler(leaveHandler, MouseOutEvent.getType());
}

From source file:edu.udes.bio.genus.client.ui.menu.Strand.java

License:Open Source License

/**
 * Instantiates a new strand.// w  ww  .  j  ava2  s . c  om
 * 
 * @param o
 *            the drawable object
 */
public Strand(RNAssDrawable o) {
    super();
    this.poolObj = o;

    // Setup main panel
    DOM.setStyleAttribute(getElement(), "border", "1px solid #e3e8f3");
    setSize("90%", "20px");
    setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);

    // Create and setup checkbox
    this.cbxDisplay.setChecked(true);
    this.cbxDisplay.setPixelSize(16, 16);
    final ClickHandler cbxClickHandler = new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            Strand.this.poolObj.setVisible(Strand.this.cbxDisplay.isChecked());
        }
    };
    this.cbxDisplay.addClickHandler(cbxClickHandler);
    add(this.cbxDisplay);

    // Create and setup label for the name of the strand
    this.sName.setPixelSize(132, 20);
    updateName();
    add(this.sName);

    // Create and setup Edit button
    final Image iE = new Image(this.imagesBundle.detailsButtonIcon());
    final CustomButton btnEdit = new CustomButton(iE) {
        @Override
        protected void onClick() {
            GenUS.propMenu.show(Strand.this.poolObj);
        }
    };
    btnEdit.setPixelSize(16, 16);
    btnEdit.setTitle("Details");
    add(btnEdit);

    final Image iD = new Image(this.imagesBundle.cancelButtonIcon());
    final CustomButton btnDel = new CustomButton(iD) {
        @Override
        protected void onClick() {
            if (DOM.eventGetCtrlKey(DOM.eventGetCurrentEvent())
                    || Window.confirm("Are you sure you want to delete this strand ?")) {
                GenUS.rnaPool.removeFromPool(Strand.this.poolObj);
            }
        }
    };
    btnDel.setSize("16px", "16px");
    btnDel.setTitle("Press Ctrl to delete without confirmation.");
    add(btnDel);

    // Setup Widget
    final MouseOverHandler overHandler = new MouseOverHandler() {
        @Override
        public void onMouseOver(MouseOverEvent event) {
            DOM.setStyleAttribute(getElement(), "backgroundColor", "#e3e8f3");
            DOM.setStyleAttribute(getElement(), "border", "1px solid lightgrey");
        }
    };
    addDomHandler(overHandler, MouseOverEvent.getType());
    final MouseOutHandler leaveHandler = new MouseOutHandler() {

        @Override
        public void onMouseOut(MouseOutEvent event) {
            DOM.setStyleAttribute(getElement(), "backgroundColor", "white");
            DOM.setStyleAttribute(getElement(), "border", "1px solid #e3e8f3");
        }
    };
    addDomHandler(leaveHandler, MouseOutEvent.getType());
}

From source file:edu.udes.bio.genus.client.ui.menu.Structure.java

License:Open Source License

/**
 * Instantiates a new structure./*w  w  w. j a v  a 2s . c om*/
 * 
 * @param name
 *            the name
 * @param struct
 *            the structure in dot parenthisis format (ex: "..((...)..)." )
 */
public Structure(String name, String struct) {
    super();
    if (name.equals("")) {
        this.name = struct;
    } else {
        this.name = name;
    }
    this.structure = struct;

    // Setup main panel
    DOM.setStyleAttribute(getElement(), "border", "1px solid #e3e8f3");
    setSize("90%", "20px");
    setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);

    // Create and setup label for the name of the strand
    this.sName.setPixelSize(164, 20);
    updateName();
    add(this.sName);

    // TODO Include the image in the project
    final Image iD = new Image(this.imagesBundle.cancelButtonIcon());
    final CustomButton btnDel = new CustomButton(iD) {
        @Override
        protected void onClick() {
            if (DOM.eventGetCtrlKey(DOM.eventGetCurrentEvent())
                    || Window.confirm("Are you sure you want to delete this strand ?")) {
                GenUS.mainMenu.structMenu.removeStructure(Structure.this);
            }
        }
    };
    btnDel.setSize("16px", "16px");
    btnDel.setTitle("Press Ctrl to delete without confirmation.");
    add(btnDel);

    // Setup Widget
    final MouseOverHandler overHandler = new MouseOverHandler() {
        @Override
        public void onMouseOver(MouseOverEvent event) {
            DOM.setStyleAttribute(getElement(), "backgroundColor", "#e3e8f3");
            DOM.setStyleAttribute(getElement(), "border", "1px solid lightgrey");
        }
    };
    addDomHandler(overHandler, MouseOverEvent.getType());
    final MouseOutHandler leaveHandler = new MouseOutHandler() {

        @Override
        public void onMouseOut(MouseOutEvent event) {
            DOM.setStyleAttribute(getElement(), "backgroundColor", "white");
            DOM.setStyleAttribute(getElement(), "border", "1px solid #e3e8f3");
        }
    };
    addDomHandler(leaveHandler, MouseOutEvent.getType());
}

From source file:eml.studio.client.ui.panel.Uploader.FileUploader.java

License:Open Source License

public void init() {

    uploader.setButtonImageURL("studio/img/uploadimg.png").setButtonWidth(32).setButtonHeight(32)
            .setButtonCursor(Uploader.Cursor.HAND);

    horizontalPanel.setStyleName("bda-fileupload-bottom-hpanel");
    horizontalPanel.setSpacing(10);//from w  w w .  j a v a 2s  .c om
    horizontalPanel.add(uploader);
    if (Uploader.isAjaxUploadWithProgressEventsSupported()) {

        dropFilesLabel.getElement().getStyle().setCursor(Cursor.POINTER);
        dropFilesLabel.setSize("32px", "32px");
        dropFilesLabel.setTitle("File dragable upload area");
    }
    horizontalPanel.add(dropFilesLabel);
    horizontalPanel.add(progressBarPanel);
    horizontalPanel.setCellVerticalAlignment(progressBarPanel, HasVerticalAlignment.ALIGN_MIDDLE);
    this.add(horizontalPanel);
    initFacet();
}