Example usage for com.google.gwt.user.client.ui HorizontalPanel setHorizontalAlignment

List of usage examples for com.google.gwt.user.client.ui HorizontalPanel setHorizontalAlignment

Introduction

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

Prototype

public void setHorizontalAlignment(HorizontalAlignmentConstant align) 

Source Link

Document

Sets the default horizontal alignment to be used for widgets added to this panel.

Usage

From source file:gov.nist.appvet.gwt.client.gui.dialog.DeleteAppConfirmDialogBox.java

License:Open Source License

public DeleteAppConfirmDialogBox(String appId, String appName) {
    super(false, true);

    setSize("", "");
    setAnimationEnabled(false);/*from w ww  . j a  va2  s .  c o m*/
    final VerticalPanel verticalPanel = new VerticalPanel();
    verticalPanel.addStyleName("dialogVPanel");
    verticalPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    this.setWidget(verticalPanel);
    verticalPanel.setSize("", "");

    final VerticalPanel verticalPanel_1 = new VerticalPanel();
    verticalPanel_1.setStyleName("messagePanel");
    verticalPanel.add(verticalPanel_1);
    verticalPanel_1.setWidth("320px");
    verticalPanel.setCellWidth(verticalPanel_1, "100%");

    final SimplePanel simplePanel = new SimplePanel();
    verticalPanel_1.add(simplePanel);
    verticalPanel_1.setCellWidth(simplePanel, "100%");
    simplePanel.setHeight("40px");

    final SimplePanel simplePanel_1 = new SimplePanel();
    verticalPanel_1.add(simplePanel_1);
    verticalPanel_1.setCellWidth(simplePanel_1, "100%");
    verticalPanel_1.setCellVerticalAlignment(simplePanel_1, HasVerticalAlignment.ALIGN_MIDDLE);
    verticalPanel_1.setCellHorizontalAlignment(simplePanel_1, HasHorizontalAlignment.ALIGN_CENTER);
    simplePanel_1.setSize("300px", "60px");

    final HTML htmlNewHtml = new HTML("<p align=\"center\">\r\nAre you sure you want to delete app #" + appId
            + " '" + appName + "'?\r\n</p>", true);
    htmlNewHtml.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    simplePanel_1.setWidget(htmlNewHtml);
    htmlNewHtml.setSize("", "");
    htmlNewHtml.setStyleName("errorDialogBox");

    final SimplePanel simplePanel_2 = new SimplePanel();
    verticalPanel_1.add(simplePanel_2);
    verticalPanel_1.setCellWidth(simplePanel_2, "100%");
    simplePanel_2.setHeight("40px");

    final HorizontalPanel horizontalButtonPanel = new HorizontalPanel();
    horizontalButtonPanel.setStyleName("buttonPanel");
    horizontalButtonPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    horizontalButtonPanel.setSpacing(5);
    horizontalButtonPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    verticalPanel.add(horizontalButtonPanel);
    verticalPanel.setCellVerticalAlignment(horizontalButtonPanel, HasVerticalAlignment.ALIGN_MIDDLE);
    verticalPanel.setCellHorizontalAlignment(horizontalButtonPanel, HasHorizontalAlignment.ALIGN_CENTER);
    horizontalButtonPanel.setWidth("320px");
    verticalPanel.setCellWidth(horizontalButtonPanel, "100%");
    cancelButton = new PushButton("No");
    cancelButton.setHTML("Cancel");
    horizontalButtonPanel.add(cancelButton);
    cancelButton.setSize("70px", "18px");
    horizontalButtonPanel.setCellVerticalAlignment(cancelButton, HasVerticalAlignment.ALIGN_MIDDLE);
    horizontalButtonPanel.setCellHorizontalAlignment(cancelButton, HasHorizontalAlignment.ALIGN_CENTER);
    okButton = new PushButton("Yes");
    okButton.setHTML("Ok");
    horizontalButtonPanel.add(okButton);
    horizontalButtonPanel.setCellHorizontalAlignment(okButton, HasHorizontalAlignment.ALIGN_CENTER);
    horizontalButtonPanel.setCellVerticalAlignment(okButton, HasVerticalAlignment.ALIGN_MIDDLE);
    okButton.setSize("70px", "18px");
}

From source file:gov.nist.appvet.gwt.client.gui.dialog.DeleteUserConfirmDialogBox.java

License:Open Source License

public DeleteUserConfirmDialogBox(String userName) {
    super(false, true);

    setSize("", "");
    setAnimationEnabled(false);//from   w  w w .j  a  v  a  2 s  .co m

    final VerticalPanel verticalPanel = new VerticalPanel();
    verticalPanel.addStyleName("dialogVPanel");
    verticalPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    this.setWidget(verticalPanel);
    verticalPanel.setSize("", "");

    final VerticalPanel verticalPanel_1 = new VerticalPanel();
    verticalPanel_1.setStyleName("messagePanel");
    verticalPanel.add(verticalPanel_1);
    verticalPanel_1.setWidth("320px");
    verticalPanel.setCellWidth(verticalPanel_1, "100%");

    final SimplePanel simplePanel = new SimplePanel();
    verticalPanel_1.add(simplePanel);
    verticalPanel_1.setCellWidth(simplePanel, "100%");
    simplePanel.setHeight("40px");

    final SimplePanel simplePanel_1 = new SimplePanel();
    verticalPanel_1.add(simplePanel_1);
    verticalPanel_1.setCellWidth(simplePanel_1, "100%");
    verticalPanel_1.setCellVerticalAlignment(simplePanel_1, HasVerticalAlignment.ALIGN_MIDDLE);
    verticalPanel_1.setCellHorizontalAlignment(simplePanel_1, HasHorizontalAlignment.ALIGN_CENTER);
    simplePanel_1.setSize("300px", "60px");

    final HTML htmlNewHtml = new HTML(
            "<p align=\"center\">\r\nAre you sure you want to delete user" + " '" + userName + "'?\r\n</p>",
            true);
    htmlNewHtml.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    simplePanel_1.setWidget(htmlNewHtml);
    htmlNewHtml.setSize("", "");
    htmlNewHtml.setStyleName("errorDialogBox");

    final SimplePanel simplePanel_2 = new SimplePanel();
    verticalPanel_1.add(simplePanel_2);
    verticalPanel_1.setCellWidth(simplePanel_2, "100%");
    simplePanel_2.setHeight("40px");

    final HorizontalPanel horizontalButtonPanel = new HorizontalPanel();
    horizontalButtonPanel.setStyleName("buttonPanel");
    horizontalButtonPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    horizontalButtonPanel.setSpacing(5);
    horizontalButtonPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    verticalPanel.add(horizontalButtonPanel);
    verticalPanel.setCellVerticalAlignment(horizontalButtonPanel, HasVerticalAlignment.ALIGN_MIDDLE);
    verticalPanel.setCellHorizontalAlignment(horizontalButtonPanel, HasHorizontalAlignment.ALIGN_CENTER);
    horizontalButtonPanel.setWidth("320px");
    verticalPanel.setCellWidth(horizontalButtonPanel, "100%");
    cancelButton = new PushButton("No");
    cancelButton.setHTML("Cancel");
    horizontalButtonPanel.add(cancelButton);
    cancelButton.setSize("70px", "18px");
    horizontalButtonPanel.setCellVerticalAlignment(cancelButton, HasVerticalAlignment.ALIGN_MIDDLE);
    horizontalButtonPanel.setCellHorizontalAlignment(cancelButton, HasHorizontalAlignment.ALIGN_CENTER);
    okButton = new PushButton("Yes");
    okButton.setHTML("Ok");
    horizontalButtonPanel.add(okButton);
    horizontalButtonPanel.setCellHorizontalAlignment(okButton, HasHorizontalAlignment.ALIGN_CENTER);
    horizontalButtonPanel.setCellVerticalAlignment(okButton, HasVerticalAlignment.ALIGN_MIDDLE);
    okButton.setSize("70px", "18px");
}

From source file:gov.nist.appvet.gwt.client.gui.dialog.MessageDialogBox.java

License:Open Source License

public MessageDialogBox(String message, boolean isErrorMessage) {
    super(false, true);

    messageLabel = new Label(message);
    if (isErrorMessage) {
        messageLabel.setStyleName("errorDialogBox");
    } else {//from ww  w .j a  va 2s  .  c o  m
        messageLabel.setStyleName("infoDialogBox");
    }
    setWidth("");
    setAnimationEnabled(false);

    final VerticalPanel dialogVPanel = new VerticalPanel();
    dialogVPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    dialogVPanel.addStyleName("dialogVPanel");
    dialogVPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);

    final VerticalPanel verticalPanel = new VerticalPanel();
    verticalPanel.setStyleName("messagePanel");
    verticalPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    verticalPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    dialogVPanel.add(verticalPanel);
    verticalPanel.setSize("364px", "");
    dialogVPanel.setCellVerticalAlignment(verticalPanel, HasVerticalAlignment.ALIGN_MIDDLE);
    dialogVPanel.setCellHorizontalAlignment(verticalPanel, HasHorizontalAlignment.ALIGN_CENTER);
    dialogVPanel.setCellWidth(verticalPanel, "100%");

    final SimplePanel emptyPanel = new SimplePanel();
    verticalPanel.add(emptyPanel);
    verticalPanel.setCellVerticalAlignment(emptyPanel, HasVerticalAlignment.ALIGN_MIDDLE);
    verticalPanel.setCellWidth(emptyPanel, "100%");
    emptyPanel.setHeight("40px");

    final SimplePanel simplePanel = new SimplePanel();
    verticalPanel.add(simplePanel);
    verticalPanel.setCellHorizontalAlignment(simplePanel, HasHorizontalAlignment.ALIGN_CENTER);
    verticalPanel.setCellWidth(simplePanel, "100%");
    dialogVPanel.setCellWidth(simplePanel, "100%");
    dialogVPanel.setCellVerticalAlignment(simplePanel, HasVerticalAlignment.ALIGN_MIDDLE);
    dialogVPanel.setCellHorizontalAlignment(simplePanel, HasHorizontalAlignment.ALIGN_CENTER);
    simplePanel.setSize("300px", "60px");

    simplePanel.setWidget(messageLabel);
    messageLabel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    dialogVPanel.setCellHorizontalAlignment(messageLabel, HasHorizontalAlignment.ALIGN_CENTER);
    messageLabel.setSize("", "");

    final SimplePanel emptyPanel2 = new SimplePanel();
    verticalPanel.add(emptyPanel2);
    verticalPanel.setCellVerticalAlignment(emptyPanel2, HasVerticalAlignment.ALIGN_MIDDLE);
    verticalPanel.setCellHorizontalAlignment(emptyPanel2, HasHorizontalAlignment.ALIGN_CENTER);
    verticalPanel.setCellWidth(emptyPanel2, "100%");
    emptyPanel2.setHeight("40px");
    this.setWidget(dialogVPanel);
    dialogVPanel.setSize("", "");

    final HorizontalPanel horizontalPanel = new HorizontalPanel();
    horizontalPanel.setStyleName("buttonPanel");
    horizontalPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    horizontalPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    dialogVPanel.add(horizontalPanel);
    dialogVPanel.setCellHorizontalAlignment(horizontalPanel, HasHorizontalAlignment.ALIGN_CENTER);
    horizontalPanel.setWidth("320px");
    closeButton = new PushButton("Close");
    horizontalPanel.add(closeButton);
    dialogVPanel.setCellWidth(closeButton, "100%");

    closeButton.setSize("70px", "18px");
    dialogVPanel.setCellVerticalAlignment(closeButton, HasVerticalAlignment.ALIGN_MIDDLE);
    dialogVPanel.setCellHorizontalAlignment(closeButton, HasHorizontalAlignment.ALIGN_CENTER);
}

From source file:gov.nist.appvet.gwt.client.gui.dialog.ReportUploadDialogBox.java

License:Open Source License

public ReportUploadDialogBox(String username, String sessionId, String appid, String servletURL,
        String[] availableToolNames, final String[] availableToolIDs) {
    super(false, true);

    setWidth("100%");
    setAnimationEnabled(false);//from ww w.j  av  a 2  s  . co m

    final VerticalPanel dialogVPanel = new VerticalPanel();
    dialogVPanel.addStyleName("dialogVPanel");
    dialogVPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    this.setWidget(dialogVPanel);
    dialogVPanel.setSize("", "");
    this.servletURL = servletURL;

    final SimplePanel simplePanel = new SimplePanel();
    simplePanel.setStyleName("reportUploadPanel");
    dialogVPanel.add(simplePanel);
    dialogVPanel.setCellVerticalAlignment(simplePanel, HasVerticalAlignment.ALIGN_MIDDLE);
    dialogVPanel.setCellHorizontalAlignment(simplePanel, HasHorizontalAlignment.ALIGN_CENTER);
    simplePanel.setSize("", "");
    uploadReportForm = new FormPanel();
    simplePanel.setWidget(uploadReportForm);
    uploadReportForm.setSize("", "");
    uploadReportForm.setAction(servletURL);
    uploadReportForm.setMethod(FormPanel.METHOD_POST);
    uploadReportForm.setEncoding(FormPanel.ENCODING_MULTIPART);

    final VerticalPanel verticalPanel = new VerticalPanel();
    verticalPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    verticalPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    uploadReportForm.setWidget(verticalPanel);
    verticalPanel.setSize("", "");

    final Hidden hiddenAppid = new Hidden();
    hiddenAppid.setName("appid");
    hiddenAppid.setValue(appid);
    verticalPanel.add(hiddenAppid);

    final Hidden hiddenUsername = new Hidden();
    hiddenUsername.setName("username");
    hiddenUsername.setValue(username);
    verticalPanel.add(hiddenUsername);

    final Hidden hiddenSessionId = new Hidden();
    hiddenSessionId.setName("sessionid");
    hiddenSessionId.setValue(sessionId);
    verticalPanel.add(hiddenSessionId);

    //      final Hidden hiddenAnalyst = new Hidden();
    //      hiddenAnalyst.setName("analyst");
    //      hiddenAnalyst.setValue(username);
    //      verticalPanel.add(hiddenAnalyst);

    final Hidden hiddenCommand = new Hidden();
    hiddenCommand.setValue("SUBMIT_REPORT");
    hiddenCommand.setName("command");
    verticalPanel.add(hiddenCommand);

    hiddenToolID = new Hidden();
    hiddenToolID.setName("toolid");
    verticalPanel.add(hiddenToolID);

    final Grid grid = new Grid(5, 2);
    grid.setCellPadding(5);
    grid.setStyleName("grid");
    verticalPanel.add(grid);
    grid.setHeight("210px");
    verticalPanel.setCellVerticalAlignment(grid, HasVerticalAlignment.ALIGN_MIDDLE);
    verticalPanel.setCellHorizontalAlignment(grid, HasHorizontalAlignment.ALIGN_CENTER);
    verticalPanel.setCellWidth(grid, "100%");

    final Label labelAnalyst = new Label("Analyst: ");
    labelAnalyst.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
    labelAnalyst.setStyleName("reportUploadLabel");
    grid.setWidget(0, 0, labelAnalyst);
    labelAnalyst.setWidth("");

    final TextBox analystTextBox = new TextBox();
    analystTextBox.setAlignment(TextAlignment.LEFT);
    analystTextBox.setText(username);
    analystTextBox.setEnabled(true);
    analystTextBox.setReadOnly(true);
    grid.setWidget(0, 1, analystTextBox);
    grid.getCellFormatter().setHeight(0, 1, "18px");
    grid.getCellFormatter().setWidth(0, 1, "300px");
    grid.getCellFormatter().setStyleName(0, 1, "reportUploadWidget");
    analystTextBox.setSize("220px", "18px");

    final Label appIdLabel = new Label("App ID: ");
    appIdLabel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
    grid.setWidget(1, 0, appIdLabel);
    grid.getCellFormatter().setWidth(1, 0, "300px");
    grid.getCellFormatter().setHeight(1, 1, "18px");
    grid.getCellFormatter().setWidth(1, 1, "300px");

    final TextBox appIdTextBox = new TextBox();
    appIdTextBox.setAlignment(TextAlignment.LEFT);
    appIdTextBox.setText(appid);
    appIdTextBox.setEnabled(true);
    appIdTextBox.setReadOnly(true);
    grid.setWidget(1, 1, appIdTextBox);
    grid.getCellFormatter().setStyleName(1, 1, "reportUploadWidget");
    appIdTextBox.setSize("220px", "18px");

    final Label toolNameLabel = new Label("Tool: ");
    toolNameLabel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
    grid.setWidget(2, 0, toolNameLabel);
    toolNameLabel.setWidth("90px");
    grid.getCellFormatter().setWidth(2, 1, "300px");
    toolNamesComboBox = new ListBox();

    grid.setWidget(2, 1, toolNamesComboBox);
    grid.getCellFormatter().setHeight(2, 1, "18px");
    grid.getCellFormatter().setStyleName(2, 1, "reportUploadWidget");
    toolNamesComboBox.setSize("231px", "22px");

    final Label lblReport = new Label("Report: ");
    lblReport.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
    grid.setWidget(3, 0, lblReport);
    grid.getCellFormatter().setWidth(3, 1, "300px");
    fileUpload = new FileUpload();
    fileUpload.setName("fileupload");
    grid.setWidget(3, 1, fileUpload);
    grid.getCellFormatter().setHeight(3, 1, "18px");
    grid.getCellFormatter().setStyleName(3, 1, "reportUploadWidget");
    fileUpload.setSize("189px", "22px");

    final Label riskLabel = new Label("Risk: ");
    riskLabel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
    grid.setWidget(4, 0, riskLabel);
    grid.getCellFormatter().setHorizontalAlignment(4, 0, HasHorizontalAlignment.ALIGN_RIGHT);
    grid.getCellFormatter().setWidth(4, 1, "300px");
    grid.getCellFormatter().setHorizontalAlignment(1, 0, HasHorizontalAlignment.ALIGN_RIGHT);
    grid.getCellFormatter().setHorizontalAlignment(1, 1, HasHorizontalAlignment.ALIGN_LEFT);
    grid.getCellFormatter().setHorizontalAlignment(2, 0, HasHorizontalAlignment.ALIGN_RIGHT);
    grid.getCellFormatter().setVerticalAlignment(1, 0, HasVerticalAlignment.ALIGN_MIDDLE);
    grid.getCellFormatter().setVerticalAlignment(2, 0, HasVerticalAlignment.ALIGN_MIDDLE);
    grid.getCellFormatter().setHorizontalAlignment(3, 0, HasHorizontalAlignment.ALIGN_RIGHT);
    grid.getCellFormatter().setVerticalAlignment(3, 0, HasVerticalAlignment.ALIGN_MIDDLE);
    grid.getCellFormatter().setVerticalAlignment(4, 0, HasVerticalAlignment.ALIGN_MIDDLE);
    grid.getCellFormatter().setVerticalAlignment(1, 1, HasVerticalAlignment.ALIGN_MIDDLE);
    grid.getCellFormatter().setHorizontalAlignment(2, 1, HasHorizontalAlignment.ALIGN_LEFT);
    grid.getCellFormatter().setVerticalAlignment(2, 1, HasVerticalAlignment.ALIGN_MIDDLE);
    grid.getCellFormatter().setHorizontalAlignment(3, 1, HasHorizontalAlignment.ALIGN_LEFT);
    grid.getCellFormatter().setVerticalAlignment(3, 1, HasVerticalAlignment.ALIGN_MIDDLE);
    grid.getCellFormatter().setHorizontalAlignment(4, 1, HasHorizontalAlignment.ALIGN_LEFT);
    grid.getCellFormatter().setVerticalAlignment(4, 1, HasVerticalAlignment.ALIGN_MIDDLE);

    ListBox toolRiskComboBox = new ListBox();
    toolRiskComboBox.setName("toolrisk");
    toolRiskComboBox.addItem("PASS");
    toolRiskComboBox.addItem("WARNING");
    toolRiskComboBox.addItem("FAIL");
    grid.setWidget(4, 1, toolRiskComboBox);
    grid.getCellFormatter().setHeight(4, 1, "18px");
    grid.getCellFormatter().setStyleName(4, 1, "reportUploadWidget");
    toolRiskComboBox.setSize("231px", "22px");
    grid.getCellFormatter().setVerticalAlignment(0, 0, HasVerticalAlignment.ALIGN_MIDDLE);
    grid.getCellFormatter().setVerticalAlignment(0, 1, HasVerticalAlignment.ALIGN_MIDDLE);
    grid.getCellFormatter().setHorizontalAlignment(0, 1, HasHorizontalAlignment.ALIGN_LEFT);
    grid.getCellFormatter().setHorizontalAlignment(0, 0, HasHorizontalAlignment.ALIGN_CENTER);
    statusLabel = new Label("");
    statusLabel.setStyleName("submissionRequirementsLabel");
    verticalPanel.add(statusLabel);
    verticalPanel.setCellWidth(statusLabel, "100%");
    verticalPanel.setCellVerticalAlignment(statusLabel, HasVerticalAlignment.ALIGN_MIDDLE);
    verticalPanel.setCellHorizontalAlignment(statusLabel, HasHorizontalAlignment.ALIGN_CENTER);
    statusLabel.setHeight("20px");

    final HorizontalPanel horizontalButtonPanel = new HorizontalPanel();
    horizontalButtonPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    horizontalButtonPanel.setStyleName("reportUploadButtonPanel");
    dialogVPanel.add(horizontalButtonPanel);
    dialogVPanel.setCellVerticalAlignment(horizontalButtonPanel, HasVerticalAlignment.ALIGN_MIDDLE);
    dialogVPanel.setCellHorizontalAlignment(horizontalButtonPanel, HasHorizontalAlignment.ALIGN_CENTER);
    dialogVPanel.setCellWidth(horizontalButtonPanel, "100%");
    horizontalButtonPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    horizontalButtonPanel.setSize("210px", "");
    cancelButton = new PushButton("Cancel");
    cancelButton.setHTML("Cancel");
    horizontalButtonPanel.add(cancelButton);
    cancelButton.setSize("70px", "18px");
    horizontalButtonPanel.setCellVerticalAlignment(cancelButton, HasVerticalAlignment.ALIGN_MIDDLE);
    horizontalButtonPanel.setCellHorizontalAlignment(cancelButton, HasHorizontalAlignment.ALIGN_CENTER);
    submitButton = new PushButton("Submit");
    horizontalButtonPanel.add(submitButton);
    horizontalButtonPanel.setCellHorizontalAlignment(submitButton, HasHorizontalAlignment.ALIGN_CENTER);
    horizontalButtonPanel.setCellVerticalAlignment(submitButton, HasVerticalAlignment.ALIGN_MIDDLE);
    submitButton.setSize("70px", "18px");
    verticalPanel.setCellWidth(horizontalButtonPanel, "100%");

    submitButton.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            // Set toolid first
            int selectedToolNameIndex = toolNamesComboBox.getSelectedIndex();
            String toolID = availableToolIDs[selectedToolNameIndex];
            hiddenToolID.setValue(toolID);

            uploadReportForm.submit();
        }

    });

    for (final String availableTool : availableToolNames) {
        final String toolName = availableTool;
        if ((toolName != null) && !toolName.isEmpty()) {
            toolNamesComboBox.addItem(availableTool);
        }
    }
}

From source file:gov.nist.appvet.gwt.client.gui.dialog.UserAcctDialogBox.java

License:Open Source License

public UserAcctDialogBox(final UserInfoGwt userInfo) {
    setSize("386px", "300px");

    final VerticalPanel verticalPanel = new VerticalPanel();
    verticalPanel.setSize("100%", "100%");
    verticalPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    verticalPanel.setStyleName("verticalPanel");
    verticalPanel.setSpacing(5);//from   w w  w .j  av  a  2s. c  o m

    final HorizontalPanel horizontalPanel_1 = new HorizontalPanel();
    horizontalPanel_1.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    horizontalPanel_1.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    verticalPanel.add(horizontalPanel_1);
    verticalPanel.setCellHorizontalAlignment(horizontalPanel_1, HasHorizontalAlignment.ALIGN_CENTER);
    verticalPanel.setCellVerticalAlignment(horizontalPanel_1, HasVerticalAlignment.ALIGN_MIDDLE);
    horizontalPanel_1.setWidth("");

    final Label lblUserId = new Label("User Name:");
    lblUserId.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
    horizontalPanel_1.add(lblUserId);
    horizontalPanel_1.setCellHorizontalAlignment(lblUserId, HasHorizontalAlignment.ALIGN_CENTER);
    horizontalPanel_1.setCellWidth(lblUserId, "50%");
    lblUserId.setWidth("170px");
    horizontalPanel_1.setCellVerticalAlignment(lblUserId, HasVerticalAlignment.ALIGN_MIDDLE);

    final TextBox userIdTextBox_1 = new TextBox();
    userIdTextBox_1.setEnabled(false);
    userIdTextBox_1.setAlignment(TextAlignment.LEFT);
    userIdTextBox_1.setText(userInfo.getUserName());
    userIdTextBox_1.setReadOnly(true);
    horizontalPanel_1.add(userIdTextBox_1);
    horizontalPanel_1.setCellHorizontalAlignment(userIdTextBox_1, HasHorizontalAlignment.ALIGN_CENTER);
    userIdTextBox_1.setSize("180px", "20px");
    horizontalPanel_1.setCellVerticalAlignment(userIdTextBox_1, HasVerticalAlignment.ALIGN_MIDDLE);
    horizontalPanel_1.setCellWidth(userIdTextBox_1, "50%");

    final HorizontalPanel horizontalPanel_2 = new HorizontalPanel();
    horizontalPanel_2.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    horizontalPanel_2.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    verticalPanel.add(horizontalPanel_2);
    verticalPanel.setCellHorizontalAlignment(horizontalPanel_2, HasHorizontalAlignment.ALIGN_CENTER);
    verticalPanel.setCellVerticalAlignment(horizontalPanel_2, HasVerticalAlignment.ALIGN_MIDDLE);

    final Label lblNewLabel = new Label("Last Name: ");
    horizontalPanel_2.add(lblNewLabel);
    horizontalPanel_2.setCellHorizontalAlignment(lblNewLabel, HasHorizontalAlignment.ALIGN_CENTER);
    horizontalPanel_2.setCellVerticalAlignment(lblNewLabel, HasVerticalAlignment.ALIGN_MIDDLE);
    lblNewLabel.setWidth("170px");
    horizontalPanel_2.setCellWidth(lblNewLabel, "50%");
    lblNewLabel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
    lastNameTextBox = new TextBox();
    lastNameTextBox.setEnabled(false);
    lastNameTextBox.setAlignment(TextAlignment.LEFT);
    horizontalPanel_2.add(lastNameTextBox);
    horizontalPanel_2.setCellHorizontalAlignment(lastNameTextBox, HasHorizontalAlignment.ALIGN_CENTER);
    horizontalPanel_2.setCellVerticalAlignment(lastNameTextBox, HasVerticalAlignment.ALIGN_MIDDLE);
    horizontalPanel_2.setCellWidth(lastNameTextBox, "50%");
    lastNameTextBox.setText(userInfo.getLastName());
    lastNameTextBox.setSize("180px", "20px");

    final HorizontalPanel horizontalPanel_3 = new HorizontalPanel();
    horizontalPanel_3.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    verticalPanel.add(horizontalPanel_3);
    verticalPanel.setCellVerticalAlignment(horizontalPanel_3, HasVerticalAlignment.ALIGN_MIDDLE);
    verticalPanel.setCellHorizontalAlignment(horizontalPanel_3, HasHorizontalAlignment.ALIGN_CENTER);
    horizontalPanel_3.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);

    final Label lblNewLabel_1 = new Label("First Name: ");
    horizontalPanel_3.add(lblNewLabel_1);
    horizontalPanel_3.setCellHorizontalAlignment(lblNewLabel_1, HasHorizontalAlignment.ALIGN_CENTER);
    lblNewLabel_1.setWidth("170px");
    horizontalPanel_3.setCellWidth(lblNewLabel_1, "50%");
    horizontalPanel_3.setCellVerticalAlignment(lblNewLabel_1, HasVerticalAlignment.ALIGN_MIDDLE);
    lblNewLabel_1.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
    firstNameTextBox = new TextBox();
    firstNameTextBox.setEnabled(false);
    firstNameTextBox.setAlignment(TextAlignment.LEFT);
    horizontalPanel_3.add(firstNameTextBox);
    horizontalPanel_3.setCellHorizontalAlignment(firstNameTextBox, HasHorizontalAlignment.ALIGN_CENTER);
    horizontalPanel_3.setCellVerticalAlignment(firstNameTextBox, HasVerticalAlignment.ALIGN_MIDDLE);
    firstNameTextBox.setText(userInfo.getFirstName());
    firstNameTextBox.setSize("180px", "20px");

    final HorizontalPanel horizontalPanel_4 = new HorizontalPanel();
    horizontalPanel_4.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    horizontalPanel_4.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    verticalPanel.add(horizontalPanel_4);
    verticalPanel.setCellHorizontalAlignment(horizontalPanel_4, HasHorizontalAlignment.ALIGN_CENTER);
    verticalPanel.setCellVerticalAlignment(horizontalPanel_4, HasVerticalAlignment.ALIGN_MIDDLE);

    final Label lblOrganization = new Label("Organization: ");
    horizontalPanel_4.add(lblOrganization);
    horizontalPanel_4.setCellVerticalAlignment(lblOrganization, HasVerticalAlignment.ALIGN_MIDDLE);
    horizontalPanel_4.setCellHorizontalAlignment(lblOrganization, HasHorizontalAlignment.ALIGN_CENTER);
    lblOrganization.setWidth("170px");
    horizontalPanel_4.setCellWidth(lblOrganization, "50%");
    lblOrganization.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
    organizationTextBox = new TextBox();
    organizationTextBox.setEnabled(false);
    organizationTextBox.setAlignment(TextAlignment.LEFT);
    horizontalPanel_4.add(organizationTextBox);
    horizontalPanel_4.setCellHorizontalAlignment(organizationTextBox, HasHorizontalAlignment.ALIGN_CENTER);
    horizontalPanel_4.setCellVerticalAlignment(organizationTextBox, HasVerticalAlignment.ALIGN_MIDDLE);
    horizontalPanel_4.setCellWidth(organizationTextBox, "50%");
    organizationTextBox.setSize("180px", "20px");
    organizationTextBox.setText(userInfo.getOrganization());

    final HorizontalPanel horizontalPanel_5 = new HorizontalPanel();
    horizontalPanel_5.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    horizontalPanel_5.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    verticalPanel.add(horizontalPanel_5);
    verticalPanel.setCellHorizontalAlignment(horizontalPanel_5, HasHorizontalAlignment.ALIGN_CENTER);
    verticalPanel.setCellVerticalAlignment(horizontalPanel_5, HasVerticalAlignment.ALIGN_MIDDLE);

    final Label lblEmail = new Label("Email: ");
    horizontalPanel_5.add(lblEmail);
    horizontalPanel_5.setCellVerticalAlignment(lblEmail, HasVerticalAlignment.ALIGN_MIDDLE);
    horizontalPanel_5.setCellHorizontalAlignment(lblEmail, HasHorizontalAlignment.ALIGN_CENTER);
    lblEmail.setWidth("170px");
    horizontalPanel_5.setCellWidth(lblEmail, "50%");
    lblEmail.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
    emailTextBox = new TextBox();
    emailTextBox.setEnabled(false);
    emailTextBox.setAlignment(TextAlignment.LEFT);
    horizontalPanel_5.add(emailTextBox);
    horizontalPanel_5.setCellHorizontalAlignment(emailTextBox, HasHorizontalAlignment.ALIGN_CENTER);
    horizontalPanel_5.setCellVerticalAlignment(emailTextBox, HasVerticalAlignment.ALIGN_MIDDLE);
    horizontalPanel_5.setCellWidth(emailTextBox, "50%");
    emailTextBox.setText(userInfo.getEmail());
    emailTextBox.setSize("180px", "20px");

    final Label lblNewLabel_2 = new Label("Change Password");
    lblNewLabel_2.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
    lblNewLabel_2.setWidth("340px");

    final HorizontalPanel horizontalPanel_6 = new HorizontalPanel();
    horizontalPanel_6.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    horizontalPanel_6.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    verticalPanel.add(horizontalPanel_6);
    verticalPanel.setCellVerticalAlignment(horizontalPanel_6, HasVerticalAlignment.ALIGN_MIDDLE);
    verticalPanel.setCellHorizontalAlignment(horizontalPanel_6, HasHorizontalAlignment.ALIGN_CENTER);

    final Label lblNewLabel_3 = new Label("New Password: ");
    horizontalPanel_6.add(lblNewLabel_3);
    lblNewLabel_3.setWidth("170px");
    horizontalPanel_6.setCellVerticalAlignment(lblNewLabel_3, HasVerticalAlignment.ALIGN_MIDDLE);
    horizontalPanel_6.setCellHorizontalAlignment(lblNewLabel_3, HasHorizontalAlignment.ALIGN_CENTER);
    horizontalPanel_6.setCellWidth(lblNewLabel_3, "50%");
    lblNewLabel_3.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
    password1TextBox = new PasswordTextBox();
    password1TextBox.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            updateButton.setEnabled(true);
        }
    });
    password1TextBox.setEnabled(true);
    password1TextBox.setAlignment(TextAlignment.LEFT);
    horizontalPanel_6.add(password1TextBox);
    horizontalPanel_6.setCellHorizontalAlignment(password1TextBox, HasHorizontalAlignment.ALIGN_CENTER);
    horizontalPanel_6.setCellVerticalAlignment(password1TextBox, HasVerticalAlignment.ALIGN_MIDDLE);
    horizontalPanel_6.setCellWidth(password1TextBox, "50%");
    password1TextBox.setSize("180px", "20px");

    final HorizontalPanel horizontalPanel_7 = new HorizontalPanel();
    horizontalPanel_7.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    horizontalPanel_7.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    verticalPanel.add(horizontalPanel_7);
    verticalPanel.setCellHorizontalAlignment(horizontalPanel_7, HasHorizontalAlignment.ALIGN_CENTER);
    verticalPanel.setCellVerticalAlignment(horizontalPanel_7, HasVerticalAlignment.ALIGN_MIDDLE);

    final Label lblNewLabel_4 = new Label("New Password (again): ");
    horizontalPanel_7.add(lblNewLabel_4);
    horizontalPanel_7.setCellHorizontalAlignment(lblNewLabel_4, HasHorizontalAlignment.ALIGN_CENTER);
    lblNewLabel_4.setWidth("170px");
    horizontalPanel_7.setCellWidth(lblNewLabel_4, "50%");
    horizontalPanel_7.setCellVerticalAlignment(lblNewLabel_4, HasVerticalAlignment.ALIGN_MIDDLE);
    lblNewLabel_4.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
    password2TextBox = new PasswordTextBox();
    password2TextBox.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            updateButton.setEnabled(true);
        }
    });
    password2TextBox.setEnabled(true);
    password2TextBox.setAlignment(TextAlignment.LEFT);
    horizontalPanel_7.add(password2TextBox);
    horizontalPanel_7.setCellHorizontalAlignment(password2TextBox, HasHorizontalAlignment.ALIGN_CENTER);
    horizontalPanel_7.setCellWidth(password2TextBox, "50%");
    password2TextBox.setSize("180px", "20px");

    final HorizontalPanel horizontalPanel = new HorizontalPanel();
    horizontalPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    horizontalPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    horizontalPanel.setSize("200px", "50px");
    cancelButton = new PushButton("Cancel");
    cancelButton.setHTML("Cancel");
    horizontalPanel.add(cancelButton);
    horizontalPanel.setCellHorizontalAlignment(cancelButton, HasHorizontalAlignment.ALIGN_CENTER);
    horizontalPanel.setCellVerticalAlignment(cancelButton, HasVerticalAlignment.ALIGN_MIDDLE);
    cancelButton.setSize("70px", "18px");

    final Label buttonSpacerLabel = new Label("");
    horizontalPanel.add(buttonSpacerLabel);
    horizontalPanel.setCellVerticalAlignment(buttonSpacerLabel, HasVerticalAlignment.ALIGN_MIDDLE);
    horizontalPanel.setCellHorizontalAlignment(buttonSpacerLabel, HasHorizontalAlignment.ALIGN_CENTER);
    buttonSpacerLabel.setSize("60px", "18px");

    updateButton = new PushButton("Update");
    updateButton.setEnabled(false);
    updateButton.setHTML("Update");
    horizontalPanel.add(updateButton);
    horizontalPanel.setCellVerticalAlignment(updateButton, HasVerticalAlignment.ALIGN_MIDDLE);
    horizontalPanel.setCellHorizontalAlignment(updateButton, HasHorizontalAlignment.ALIGN_CENTER);
    updateButton.setSize("70px", "18px");
    verticalPanel.setCellVerticalAlignment(horizontalPanel, HasVerticalAlignment.ALIGN_MIDDLE);
    verticalPanel.setCellHorizontalAlignment(horizontalPanel, HasHorizontalAlignment.ALIGN_CENTER);

    final SimplePanel simplePanel = new SimplePanel();
    simplePanel.setStyleName("userFormPanel");
    simplePanel.setWidget(verticalPanel);

    final DockPanel dockPanel = new DockPanel();
    dockPanel.setStyleName("gwt-DialogBox");
    setWidget(dockPanel);
    dockPanel.setWidth("386px");
    dockPanel.add(simplePanel, DockPanel.CENTER);
    dockPanel.add(horizontalPanel, DockPanel.SOUTH);
    dockPanel.setCellVerticalAlignment(horizontalPanel, HasVerticalAlignment.ALIGN_MIDDLE);
    dockPanel.setCellHorizontalAlignment(horizontalPanel, HasHorizontalAlignment.ALIGN_CENTER);
}

From source file:gov.nist.appvet.gwt.client.gui.dialog.UserInfoAdminEditDialogBox.java

License:Open Source License

@SuppressWarnings("deprecation")
public UserInfoAdminEditDialogBox(UserInfoGwt userInfo, UsersListPagingDataGrid<UserInfoGwt> usersListTable,
        List<UserInfoGwt> allUsers) {
    setWidth("386px");

    this.usersListTable = usersListTable;
    this.allUsers = allUsers;
    if (userInfo == null) {
        newUser = true;/*from   ww w.  j av a  2s . c o m*/
    }
    changePasswordCheckBox = new SimpleCheckBox();
    if (newUser) {
        passwordLabel = new Label("Password: ");
    } else {
        passwordLabel = new Label("Password Reset: ");
    }
    passwordLabel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT);
    if (newUser) {
        passwordAgainLabel = new Label("Password (again): ");
    } else {
        passwordAgainLabel = new Label("Password Reset (again): ");
    }
    passwordAgainLabel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT);

    final VerticalPanel verticalPanel_1 = new VerticalPanel();
    verticalPanel_1.setSize("100%", "100%");
    verticalPanel_1.setSpacing(5);
    verticalPanel_1.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    verticalPanel_1.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);

    final HorizontalPanel horizontalPanel_1 = new HorizontalPanel();
    verticalPanel_1.add(horizontalPanel_1);
    horizontalPanel_1.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    horizontalPanel_1.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);

    final Label lblNewLabel = new Label("Last Name: ");
    horizontalPanel_1.add(lblNewLabel);
    horizontalPanel_1.setCellHorizontalAlignment(lblNewLabel, HasHorizontalAlignment.ALIGN_CENTER);
    horizontalPanel_1.setCellVerticalAlignment(lblNewLabel, HasVerticalAlignment.ALIGN_MIDDLE);
    lblNewLabel.setWidth("170px");
    horizontalPanel_1.setCellWidth(lblNewLabel, "50%");
    lblNewLabel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);

    lastNameTextBox = new TextBox();
    lastNameTextBox.setTextAlignment(TextBoxBase.ALIGN_LEFT);
    lastNameTextBox.setAlignment(TextAlignment.LEFT);
    horizontalPanel_1.add(lastNameTextBox);
    horizontalPanel_1.setCellHorizontalAlignment(lastNameTextBox, HasHorizontalAlignment.ALIGN_CENTER);
    horizontalPanel_1.setCellVerticalAlignment(lastNameTextBox, HasVerticalAlignment.ALIGN_MIDDLE);
    horizontalPanel_1.setCellWidth(lastNameTextBox, "50%");
    lastNameTextBox.setWidth("180px");

    final HorizontalPanel horizontalPanel_2 = new HorizontalPanel();
    verticalPanel_1.add(horizontalPanel_2);
    horizontalPanel_2.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    horizontalPanel_2.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);

    final Label lblNewLabel_1 = new Label("First Name: ");
    horizontalPanel_2.add(lblNewLabel_1);
    lblNewLabel_1.setWidth("170px");
    horizontalPanel_2.setCellWidth(lblNewLabel_1, "50%");
    horizontalPanel_2.setCellVerticalAlignment(lblNewLabel_1, HasVerticalAlignment.ALIGN_MIDDLE);
    horizontalPanel_2.setCellHorizontalAlignment(lblNewLabel_1, HasHorizontalAlignment.ALIGN_CENTER);
    lblNewLabel_1.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);

    firstNameTextBox = new TextBox();
    firstNameTextBox.setTextAlignment(TextBoxBase.ALIGN_LEFT);
    firstNameTextBox.setAlignment(TextAlignment.LEFT);
    horizontalPanel_2.add(firstNameTextBox);
    horizontalPanel_2.setCellWidth(firstNameTextBox, "50%");
    horizontalPanel_2.setCellVerticalAlignment(firstNameTextBox, HasVerticalAlignment.ALIGN_MIDDLE);
    horizontalPanel_2.setCellHorizontalAlignment(firstNameTextBox, HasHorizontalAlignment.ALIGN_CENTER);
    firstNameTextBox.setWidth("180px");

    final HorizontalPanel horizontalPanel_3 = new HorizontalPanel();
    verticalPanel_1.add(horizontalPanel_3);
    horizontalPanel_3.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    horizontalPanel_3.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);

    final Label lblUserId = new Label("User ID:");
    horizontalPanel_3.add(lblUserId);
    lblUserId.setWidth("170px");
    horizontalPanel_3.setCellVerticalAlignment(lblUserId, HasVerticalAlignment.ALIGN_MIDDLE);
    horizontalPanel_3.setCellHorizontalAlignment(lblUserId, HasHorizontalAlignment.ALIGN_CENTER);
    horizontalPanel_3.setCellWidth(lblUserId, "50%");
    lblUserId.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);

    userIdTextBox = new TextBox();
    userIdTextBox.setTextAlignment(TextBoxBase.ALIGN_LEFT);
    userIdTextBox.setAlignment(TextAlignment.LEFT);
    horizontalPanel_3.add(userIdTextBox);
    horizontalPanel_3.setCellWidth(userIdTextBox, "50%");
    horizontalPanel_3.setCellVerticalAlignment(userIdTextBox, HasVerticalAlignment.ALIGN_MIDDLE);
    horizontalPanel_3.setCellHorizontalAlignment(userIdTextBox, HasHorizontalAlignment.ALIGN_CENTER);
    userIdTextBox.setWidth("180px");

    final HorizontalPanel horizontalPanel_6 = new HorizontalPanel();
    verticalPanel_1.add(horizontalPanel_6);
    horizontalPanel_6.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    horizontalPanel_6.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);

    final Label lblOrganization = new Label("Organization: ");
    horizontalPanel_6.add(lblOrganization);
    lblOrganization.setWidth("170px");
    horizontalPanel_6.setCellVerticalAlignment(lblOrganization, HasVerticalAlignment.ALIGN_MIDDLE);
    horizontalPanel_6.setCellHorizontalAlignment(lblOrganization, HasHorizontalAlignment.ALIGN_CENTER);
    horizontalPanel_6.setCellWidth(lblOrganization, "50%");
    lblOrganization.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);

    organizationTextBox = new TextBox();
    organizationTextBox.setTextAlignment(TextBoxBase.ALIGN_LEFT);
    organizationTextBox.setAlignment(TextAlignment.LEFT);
    horizontalPanel_6.add(organizationTextBox);
    horizontalPanel_6.setCellVerticalAlignment(organizationTextBox, HasVerticalAlignment.ALIGN_MIDDLE);
    horizontalPanel_6.setCellHorizontalAlignment(organizationTextBox, HasHorizontalAlignment.ALIGN_CENTER);
    horizontalPanel_6.setCellWidth(organizationTextBox, "50%");
    organizationTextBox.setWidth("180px");

    final HorizontalPanel horizontalPanel_7 = new HorizontalPanel();
    verticalPanel_1.add(horizontalPanel_7);
    horizontalPanel_7.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    horizontalPanel_7.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);

    final Label lblEmail = new Label("Email: ");
    horizontalPanel_7.add(lblEmail);
    lblEmail.setWidth("170px");
    horizontalPanel_7.setCellVerticalAlignment(lblEmail, HasVerticalAlignment.ALIGN_MIDDLE);
    horizontalPanel_7.setCellHorizontalAlignment(lblEmail, HasHorizontalAlignment.ALIGN_CENTER);
    horizontalPanel_7.setCellWidth(lblEmail, "50%");
    lblEmail.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
    emailTextBox = new TextBox();
    emailTextBox.setTextAlignment(TextBoxBase.ALIGN_LEFT);
    emailTextBox.setAlignment(TextAlignment.LEFT);
    horizontalPanel_7.add(emailTextBox);
    horizontalPanel_7.setCellVerticalAlignment(emailTextBox, HasVerticalAlignment.ALIGN_MIDDLE);
    horizontalPanel_7.setCellHorizontalAlignment(emailTextBox, HasHorizontalAlignment.ALIGN_CENTER);
    horizontalPanel_7.setCellWidth(emailTextBox, "50%");
    emailTextBox.setWidth("180px");

    final HorizontalPanel horizontalPanel_8 = new HorizontalPanel();
    verticalPanel_1.add(horizontalPanel_8);
    horizontalPanel_8.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    horizontalPanel_8.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);

    final Label lblRole = new Label("Role: ");
    horizontalPanel_8.add(lblRole);
    horizontalPanel_8.setCellHorizontalAlignment(lblRole, HasHorizontalAlignment.ALIGN_CENTER);
    lblRole.setWidth("170px");
    horizontalPanel_8.setCellVerticalAlignment(lblRole, HasVerticalAlignment.ALIGN_MIDDLE);
    horizontalPanel_8.setCellWidth(lblRole, "50%");
    lblRole.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);

    roleComboBox = new ListBox();
    horizontalPanel_8.add(roleComboBox);
    horizontalPanel_8.setCellWidth(roleComboBox, "50%");
    horizontalPanel_8.setCellVerticalAlignment(roleComboBox, HasVerticalAlignment.ALIGN_MIDDLE);
    horizontalPanel_8.setCellHorizontalAlignment(roleComboBox, HasHorizontalAlignment.ALIGN_CENTER);
    roleComboBox.addItem("DEV");
    roleComboBox.addItem("ANALYST");
    roleComboBox.addItem("ADMIN");
    roleComboBox.addItem("APPSTORE");
    roleComboBox.addItem("TOOL_SERVICE_PROVIDER");
    roleComboBox.addItem("OTHER_CLIENT");

    roleComboBox.setWidth("190px");

    final HorizontalPanel horizontalPanel_13 = new HorizontalPanel();
    verticalPanel_1.add(horizontalPanel_13);
    horizontalPanel_13.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    horizontalPanel_13.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    horizontalPanel_13.setWidth("366px");

    changePasswordCheckBox.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            if (changePasswordCheckBox.isChecked()) {
                password1TextBox.setEnabled(true);
                password2TextBox.setEnabled(true);
            } else {
                password1TextBox.setText(null);
                password1TextBox.setEnabled(false);
                password2TextBox.setText(null);
                password2TextBox.setEnabled(false);
            }
        }

    });
    horizontalPanel_13.add(changePasswordCheckBox);
    horizontalPanel_13.setCellVerticalAlignment(changePasswordCheckBox, HasVerticalAlignment.ALIGN_MIDDLE);

    final Label lblNewLabel_2 = new Label("Change Password");
    lblNewLabel_2.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
    horizontalPanel_13.add(lblNewLabel_2);
    horizontalPanel_13.setCellVerticalAlignment(lblNewLabel_2, HasVerticalAlignment.ALIGN_MIDDLE);
    lblNewLabel_2.setWidth("340px");

    final HorizontalPanel horizontalPanel_4 = new HorizontalPanel();
    verticalPanel_1.add(horizontalPanel_4);
    horizontalPanel_4.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    horizontalPanel_4.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);

    horizontalPanel_4.add(passwordLabel);
    passwordLabel.setWidth("170px");
    horizontalPanel_4.setCellWidth(passwordLabel, "50%");
    horizontalPanel_4.setCellVerticalAlignment(passwordLabel, HasVerticalAlignment.ALIGN_MIDDLE);
    horizontalPanel_4.setCellHorizontalAlignment(passwordLabel, HasHorizontalAlignment.ALIGN_CENTER);
    passwordLabel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);

    password1TextBox = new PasswordTextBox();
    password1TextBox.setEnabled(false);
    password1TextBox.setTextAlignment(TextBoxBase.ALIGN_LEFT);
    password1TextBox.setAlignment(TextAlignment.LEFT);
    horizontalPanel_4.add(password1TextBox);
    horizontalPanel_4.setCellVerticalAlignment(password1TextBox, HasVerticalAlignment.ALIGN_MIDDLE);
    horizontalPanel_4.setCellHorizontalAlignment(password1TextBox, HasHorizontalAlignment.ALIGN_CENTER);
    horizontalPanel_4.setCellWidth(password1TextBox, "50%");
    password1TextBox.setSize("180px", "");

    final HorizontalPanel horizontalPanel_5 = new HorizontalPanel();
    verticalPanel_1.add(horizontalPanel_5);
    horizontalPanel_5.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    horizontalPanel_5.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);

    horizontalPanel_5.add(passwordAgainLabel);
    passwordAgainLabel.setWidth("170px");
    horizontalPanel_5.setCellVerticalAlignment(passwordAgainLabel, HasVerticalAlignment.ALIGN_MIDDLE);
    horizontalPanel_5.setCellHorizontalAlignment(passwordAgainLabel, HasHorizontalAlignment.ALIGN_CENTER);
    horizontalPanel_5.setCellWidth(passwordAgainLabel, "50%");
    passwordAgainLabel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
    password2TextBox = new PasswordTextBox();
    password2TextBox.setEnabled(false);
    password2TextBox.setTextAlignment(TextBoxBase.ALIGN_LEFT);
    password2TextBox.setAlignment(TextAlignment.LEFT);
    horizontalPanel_5.add(password2TextBox);
    horizontalPanel_5.setCellVerticalAlignment(password2TextBox, HasVerticalAlignment.ALIGN_MIDDLE);
    horizontalPanel_5.setCellHorizontalAlignment(password2TextBox, HasHorizontalAlignment.ALIGN_CENTER);
    horizontalPanel_5.setCellWidth(password2TextBox, "50%");
    password2TextBox.setSize("180px", "");

    final HorizontalPanel horizontalPanel_9 = new HorizontalPanel();
    verticalPanel_1.add(horizontalPanel_9);
    horizontalPanel_9.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    horizontalPanel_9.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);

    final HorizontalPanel horizontalPanel_10 = new HorizontalPanel();
    verticalPanel_1.add(horizontalPanel_10);
    horizontalPanel_10.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    horizontalPanel_10.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);

    final Label lblLastLogon = new Label("Last Logon: ");
    horizontalPanel_10.add(lblLastLogon);
    lblLastLogon.setWidth("170px");
    horizontalPanel_10.setCellVerticalAlignment(lblLastLogon, HasVerticalAlignment.ALIGN_MIDDLE);
    horizontalPanel_10.setCellHorizontalAlignment(lblLastLogon, HasHorizontalAlignment.ALIGN_CENTER);
    horizontalPanel_10.setCellWidth(lblLastLogon, "50%");
    lblLastLogon.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);

    final TextBox lastLogonTextBox = new TextBox();
    lastLogonTextBox.setEnabled(false);
    lastLogonTextBox.setTextAlignment(TextBoxBase.ALIGN_LEFT);
    lastLogonTextBox.setAlignment(TextAlignment.LEFT);
    horizontalPanel_10.add(lastLogonTextBox);
    horizontalPanel_10.setCellVerticalAlignment(lastLogonTextBox, HasVerticalAlignment.ALIGN_MIDDLE);
    horizontalPanel_10.setCellHorizontalAlignment(lastLogonTextBox, HasHorizontalAlignment.ALIGN_CENTER);
    horizontalPanel_10.setCellWidth(lastLogonTextBox, "50%");
    lastLogonTextBox.setReadOnly(true);
    lastLogonTextBox.setWidth("180px");

    final HorizontalPanel horizontalPanel_11 = new HorizontalPanel();
    verticalPanel_1.add(horizontalPanel_11);
    horizontalPanel_11.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    horizontalPanel_11.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);

    final Label lblFromHost = new Label("From Host: ");
    horizontalPanel_11.add(lblFromHost);
    lblFromHost.setWidth("170px");
    horizontalPanel_11.setCellWidth(lblFromHost, "50%");
    horizontalPanel_11.setCellVerticalAlignment(lblFromHost, HasVerticalAlignment.ALIGN_MIDDLE);
    horizontalPanel_11.setCellHorizontalAlignment(lblFromHost, HasHorizontalAlignment.ALIGN_CENTER);
    lblFromHost.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);

    final TextBox fromHostTextBox = new TextBox();
    fromHostTextBox.setEnabled(false);
    fromHostTextBox.setTextAlignment(TextBoxBase.ALIGN_LEFT);
    fromHostTextBox.setAlignment(TextAlignment.LEFT);
    horizontalPanel_11.add(fromHostTextBox);
    horizontalPanel_11.setCellVerticalAlignment(fromHostTextBox, HasVerticalAlignment.ALIGN_MIDDLE);
    horizontalPanel_11.setCellHorizontalAlignment(fromHostTextBox, HasHorizontalAlignment.ALIGN_CENTER);
    horizontalPanel_11.setCellWidth(fromHostTextBox, "50%");
    fromHostTextBox.setReadOnly(true);
    fromHostTextBox.setWidth("180px");

    final HorizontalPanel horizontalPanel_12 = new HorizontalPanel();
    verticalPanel_1.add(horizontalPanel_12);
    horizontalPanel_12.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    horizontalPanel_12.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);

    final HorizontalPanel horizontalPanel = new HorizontalPanel();

    horizontalPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    horizontalPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    horizontalPanel.setSize("200px", "50px");
    horizontalPanel.setStyleName("buttonPanelStyle");
    cancelButton = new PushButton("Cancel");
    cancelButton.setHTML("Cancel");
    horizontalPanel.add(cancelButton);

    final Label buttonSpacerLabel = new Label("");

    horizontalPanel.add(buttonSpacerLabel);
    horizontalPanel.setCellVerticalAlignment(buttonSpacerLabel, HasVerticalAlignment.ALIGN_MIDDLE);
    horizontalPanel.setCellHorizontalAlignment(buttonSpacerLabel, HasHorizontalAlignment.ALIGN_CENTER);
    buttonSpacerLabel.setSize("60px", "18px");
    horizontalPanel.setCellHorizontalAlignment(cancelButton, HasHorizontalAlignment.ALIGN_CENTER);
    horizontalPanel.setCellVerticalAlignment(cancelButton, HasVerticalAlignment.ALIGN_MIDDLE);
    cancelButton.setSize("70px", "18px");
    okButton = new PushButton("Submit");

    horizontalPanel.add(okButton);
    horizontalPanel.setCellHorizontalAlignment(okButton, HasHorizontalAlignment.ALIGN_CENTER);
    horizontalPanel.setCellVerticalAlignment(okButton, HasVerticalAlignment.ALIGN_MIDDLE);
    okButton.setSize("70px", "18px");
    if (!newUser) {
        lastNameTextBox.setText(userInfo.getLastName());
        firstNameTextBox.setText(userInfo.getFirstName());
        userIdTextBox.setText(userInfo.getUserName());
        userIdTextBox.setReadOnly(true);
        lastLogonTextBox.setText(userInfo.getLastLogon());
        fromHostTextBox.setText(userInfo.getFromHost());
        organizationTextBox.setText(userInfo.getOrganization());
        emailTextBox.setText(userInfo.getEmail());
        if (userInfo.getRole().equals("DEV")) {
            roleComboBox.setSelectedIndex(0);
        } else if (userInfo.getRole().equals("ANALYST")) {
            roleComboBox.setSelectedIndex(1);
        } else if (userInfo.getRole().equals("ADMIN")) {
            roleComboBox.setSelectedIndex(2);
        } else if (userInfo.getRole().equals("APPSTORE")) {
            roleComboBox.setSelectedIndex(3);
        } else if (userInfo.getRole().equals("TOOL_SERVICE_PROVIDER")) {
            roleComboBox.setSelectedIndex(4);
        } else if (userInfo.getRole().equals("OTHER_CLIENT")) {
            roleComboBox.setSelectedIndex(5);
        }
    }

    final SimplePanel simplePanel = new SimplePanel();
    simplePanel.setStyleName("userFormPanel");
    simplePanel.setWidget(verticalPanel_1);

    final DockPanel dockPanel = new DockPanel();
    dockPanel.setStyleName("gwt-DialogBox");
    setWidget(dockPanel);
    dockPanel.setSize("386px", "");
    dockPanel.add(horizontalPanel, DockPanel.SOUTH);
    dockPanel.setCellVerticalAlignment(horizontalPanel, HasVerticalAlignment.ALIGN_MIDDLE);
    dockPanel.setCellHorizontalAlignment(horizontalPanel, HasHorizontalAlignment.ALIGN_CENTER);
    dockPanel.add(simplePanel, DockPanel.CENTER);
}

From source file:gov.nist.appvet.gwt.client.gui.dialog.UsersDialogBox.java

License:Open Source License

public UsersDialogBox() {
    super(false, true);
    setSize("", "450px");
    setAnimationEnabled(false);/*from w ww  .j a v a 2s  .  c  om*/
    usersSelectionModel = new SingleSelectionModel<UserInfoGwt>();
    usersSelectionModel.addSelectionChangeHandler(new UserListHandler(this));

    final DockPanel dockPanel = new DockPanel();
    dockPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    dockPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    setWidget(dockPanel);
    dockPanel.setSize("", "417px");

    final VerticalPanel verticalPanel = new VerticalPanel();
    verticalPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    verticalPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    verticalPanel.setStyleName("usersCenterPanel");
    dockPanel.add(verticalPanel, DockPanel.CENTER);
    dockPanel.setCellVerticalAlignment(verticalPanel, HasVerticalAlignment.ALIGN_MIDDLE);
    dockPanel.setCellHorizontalAlignment(verticalPanel, HasHorizontalAlignment.ALIGN_CENTER);
    verticalPanel.setSize("", "416px");

    final HorizontalPanel horizontalPanel_1 = new HorizontalPanel();
    horizontalPanel_1.setStyleName("usersHorizPanel");
    horizontalPanel_1.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    horizontalPanel_1.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    verticalPanel.add(horizontalPanel_1);
    verticalPanel.setCellVerticalAlignment(horizontalPanel_1, HasVerticalAlignment.ALIGN_MIDDLE);
    verticalPanel.setCellHorizontalAlignment(horizontalPanel_1, HasHorizontalAlignment.ALIGN_CENTER);

    searchTextBox = new TextBox();
    searchTextBox.addKeyDownHandler(new KeyDownHandler() {

        @Override
        public void onKeyDown(KeyDownEvent event) {
            if (event.getNativeKeyCode() == KeyCodes.KEY_ENTER) {
                searchMode = true;
                search();
            }
        }

    });
    horizontalPanel_1.add(searchTextBox);
    horizontalPanel_1.setCellVerticalAlignment(searchTextBox, HasVerticalAlignment.ALIGN_MIDDLE);
    searchTextBox.setSize("260px", "18px");
    final PushButton searchButton = new PushButton("Search");
    searchButton.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {

        }
    });
    searchButton.setHTML("<img width=\"18px\" src=\"images/icon-search.png\" alt=\"search\" />");
    searchButton.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            searchMode = true;
            search();
        }

    });
    horizontalPanel_1.add(searchButton);
    horizontalPanel_1.setCellVerticalAlignment(searchButton, HasVerticalAlignment.ALIGN_MIDDLE);
    horizontalPanel_1.setCellHorizontalAlignment(searchButton, HasHorizontalAlignment.ALIGN_CENTER);
    searchButton.setSize("18px", "18px");
    final PushButton viewAllButton = new PushButton("View All");
    viewAllButton.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            searchMode = false;
            getAllUsers(allUsers);
        }

    });
    viewAllButton.setHTML("<img width=\"18px\" src=\"images/icon-view-all.png\" alt=\"view-all\" />");
    horizontalPanel_1.add(viewAllButton);
    horizontalPanel_1.setCellHorizontalAlignment(viewAllButton, HasHorizontalAlignment.ALIGN_CENTER);
    horizontalPanel_1.setCellVerticalAlignment(viewAllButton, HasVerticalAlignment.ALIGN_MIDDLE);
    viewAllButton.setSize("18px", "18px");

    final DockLayoutPanel dockLayoutPanel = new DockLayoutPanel(Unit.EM);
    dockLayoutPanel.setStyleName("usersDockPanel");
    verticalPanel.add(dockLayoutPanel);
    verticalPanel.setCellVerticalAlignment(dockLayoutPanel, HasVerticalAlignment.ALIGN_MIDDLE);
    verticalPanel.setCellHorizontalAlignment(dockLayoutPanel, HasHorizontalAlignment.ALIGN_CENTER);
    dockLayoutPanel.setSize("", "380px");
    usersListTable = new UsersListPagingDataGrid<UserInfoGwt>();
    usersListTable.dataGrid.setSize("342px", "342px");
    usersListTable.dataGrid.setKeyboardSelectionPolicy(KeyboardSelectionPolicy.DISABLED);
    usersListTable.dataGrid.setSelectionModel(usersSelectionModel);
    dockLayoutPanel.add(usersListTable);
    usersListTable.setWidth("");

    final HorizontalPanel horizontalPanel_2 = new HorizontalPanel();
    horizontalPanel_2.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    horizontalPanel_2.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    horizontalPanel_2.setStyleName("buttonPanel");
    verticalPanel.add(horizontalPanel_2);

    verticalPanel.setCellVerticalAlignment(horizontalPanel_2, HasVerticalAlignment.ALIGN_MIDDLE);
    verticalPanel.setCellHorizontalAlignment(horizontalPanel_2, HasHorizontalAlignment.ALIGN_CENTER);
    addButton = new PushButton("Add");
    addButton.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            editUser(true);
        }

    });
    addButton.setHTML("Add");
    horizontalPanel_2.add(addButton);
    horizontalPanel_2.setCellHorizontalAlignment(addButton, HasHorizontalAlignment.ALIGN_CENTER);
    horizontalPanel_2.setCellVerticalAlignment(addButton, HasVerticalAlignment.ALIGN_MIDDLE);
    addButton.setSize("70px", "18px");

    final PushButton editButton = new PushButton("Edit");
    editButton.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            editUser(false);
        }

    });

    final PushButton pshbtnNewButton = new PushButton("Delete");
    pshbtnNewButton.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            final UserInfoGwt selected = usersSelectionModel.getSelectedObject();
            final DeleteUserConfirmDialogBox deleteConfirmDialogBox = new DeleteUserConfirmDialogBox(
                    selected.getUserName());
            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) {
                        deleteUser(user.getUserName());
                    }
                }

            });
        }
    });
    pshbtnNewButton.setHTML("Delete");
    horizontalPanel_2.add(pshbtnNewButton);
    horizontalPanel_2.setCellVerticalAlignment(pshbtnNewButton, HasVerticalAlignment.ALIGN_MIDDLE);
    horizontalPanel_2.setCellHorizontalAlignment(pshbtnNewButton, HasHorizontalAlignment.ALIGN_CENTER);
    pshbtnNewButton.setSize("70px", "18px");
    editButton.setHTML("Edit");
    horizontalPanel_2.add(editButton);
    horizontalPanel_2.setCellHorizontalAlignment(editButton, HasHorizontalAlignment.ALIGN_CENTER);
    horizontalPanel_2.setCellVerticalAlignment(editButton, HasVerticalAlignment.ALIGN_MIDDLE);
    editButton.setSize("70px", "18px");
    doneButton = new PushButton("Done");
    doneButton.setHTML("Done");
    horizontalPanel_2.add(doneButton);
    horizontalPanel_2.setCellHorizontalAlignment(doneButton, HasHorizontalAlignment.ALIGN_CENTER);
    horizontalPanel_2.setCellVerticalAlignment(doneButton, HasVerticalAlignment.ALIGN_MIDDLE);
    doneButton.setSize("70px", "18px");
    getUsersList();
}

From source file:gov.nist.spectrumbrowser.client.FftPowerOneAcquisitionSpectrogramChart.java

License:Open Source License

public void draw() {
    try {/*from  ww w.j  a  v  a  2  s . c o  m*/
        vpanel.clear();

        super.drawNavigation();
        HTML pageTitle = new HTML("<h2>" + getEndLabel() + "</h2>");
        vpanel.add(pageTitle);

        title = new HTML("<H3>Acquisition Start Time : " + localDateOfAcquisition + "; Occupancy Threshold : "
                + cutoff + " dBm; Measurements Per Acquisition = " + measurementsPerAcquisition + "</H3>");

        vpanel.add(title);

        double timeResolution = (double) (timeDelta + 1) / (double) measurementCount;

        int freqResolution = (int) round((this.mMaxFreq - this.mMinFreq) / this.binsPerMesurement);

        HTML subTitle = new HTML("<h3>Time Resolution= " + round3(timeResolution) + " s; Resolution BW = "
                + freqResolution + " Hz; Measurements = " + measurementCount + "; Max Occupancy = "
                + maxOccupancy + "%; Median Occupancy = " + medianOccupancy + "%; Mean Occupancy = "
                + meanOccupancy + "%; Min Occupancy = " + minOccupancy + "%</h3>");
        vpanel.add(subTitle);

        help = new Label("Single click for detail. Double click to zoom");
        vpanel.add(help);

        spectrogramVerticalPanel = new VerticalPanel();

        hpanel = new HorizontalPanel();

        commands = new Grid(1, 7);
        commands.setStyleName("selectionGrid");

        for (int i = 0; i < commands.getRowCount(); i++) {
            for (int j = 0; j < commands.getColumnCount(); j++) {
                commands.getCellFormatter().setHorizontalAlignment(i, j, HasHorizontalAlignment.ALIGN_CENTER);
                commands.getCellFormatter().setVerticalAlignment(i, j, HasVerticalAlignment.ALIGN_MIDDLE);
            }
        }

        hpanel.setSpacing(10);
        hpanel.setStyleName("spectrogram");
        xaxisPanel = new HorizontalPanel();
        xaxisPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
        HorizontalPanel xaxis = new HorizontalPanel();
        xaxis.setWidth(canvasPixelWidth + 30 + "px");
        xaxis.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
        NumberFormat numberFormat = NumberFormat.getFormat("00.00");
        xaxis.add(new Label(numberFormat.format(minTime)));
        xaxis.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
        xaxis.add(new Label("Time (sec)"));
        xaxis.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT);
        xaxis.add(new Label(numberFormat.format(minTime + timeDelta)));
        xaxisPanel.add(xaxis);

        // Attach the previous reading button.

        if (prevAcquisitionTime != mSelectionTime) {

            final Button prevDayButton = new Button();
            prevDayButton.setEnabled(true);
            prevDayButton.addClickHandler(new ClickHandler() {

                @Override
                public void onClick(ClickEvent event) {
                    mSelectionTime = prevAcquisitionTime;
                    prevDayButton.setEnabled(false);
                    acquisitionDuration = 0;
                    leftBound = 0;
                    rightBound = 0;
                    window = measurementsPerAcquisition;
                    help.setText(COMPUTING_PLEASE_WAIT);
                    mSpectrumBrowser.showWaitImage();
                    mSpectrumBrowser.getSpectrumBrowserService()
                            .generateSingleAcquisitionSpectrogramAndOccupancy(mSensorId, prevAcquisitionTime,
                                    mSys2detect, mMinFreq, mMaxFreq, cutoff,
                                    FftPowerOneAcquisitionSpectrogramChart.this);

                }
            });

            prevDayButton.setText("<< Prev. Acquisition");
            commands.setWidget(0, 0, prevDayButton);

        }

        // Attach button for panning within the acquisition

        if (leftBound > 0) {
            Button panLeftButton = new Button();
            panLeftButton.addClickHandler(new ClickHandler() {

                @Override
                public void onClick(ClickEvent event) {
                    if (leftBound - window >= 0) {
                        leftBound = (int) (leftBound - window);
                        rightBound = rightBound + window;
                    } else {
                        rightBound = rightBound + leftBound;
                        leftBound = 0;
                    }
                    help.setText(COMPUTING_PLEASE_WAIT);
                    mSpectrumBrowser.getSpectrumBrowserService()
                            .generateSingleAcquisitionSpectrogramAndOccupancy(mSensorId, mSelectionTime,
                                    mSys2detect, mMinFreq, mMaxFreq, (int) leftBound, (int) rightBound, cutoff,
                                    FftPowerOneAcquisitionSpectrogramChart.this);
                }
            });
            panLeftButton.setText("< Pan Left");
            panLeftButton.setTitle("Click to pan left");
            commands.setWidget(0, 1, panLeftButton);
        }

        // Attach the labels for the spectrogram power
        VerticalPanel powerLevelPanel = new VerticalPanel();
        powerLevelPanel.setWidth(100 + "px");
        this.maxPowerLabel = new Label();
        this.minPowerLabel = new Label();
        powerLevelPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_TOP);
        powerLevelPanel.add(maxPowerLabel);
        powerLevelPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
        powerLevelPanel.add(new Label("Power (dBm) "));
        powerLevelPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_BOTTOM);
        powerLevelPanel.add(minPowerLabel);
        // Attach labels for the frequency.
        freqPanel = new VerticalPanel();
        freqPanel.setWidth(100 + "px");
        powerLevelPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_TOP);
        freqPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_TOP);
        freqPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT);
        freqPanel.add(new Label(Double.toString(maxFreqMhz)));
        freqPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
        freqPanel.add(new Label("Frequency (MHz)"));
        freqPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_BOTTOM);
        freqPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT);
        freqPanel.add(new Label(Double.toString(minFreqMhz)));
        powerMapPanel = new HorizontalPanel();
        powerMapPanel.setWidth(30 + "px");
        hpanel.add(freqPanel);
        spectrogramPanel = new VerticalPanel();

        HorizontalPanel spectrogramAndPowerMapPanel = new HorizontalPanel();
        spectrogramAndPowerMapPanel.add(spectrogramPanel);
        spectrogramAndPowerMapPanel.add(powerMapPanel);
        hpanel.add(spectrogramAndPowerMapPanel);
        currentValue = new Label("Click for power spectrum and power at selected time. Double click to zoom.");
        spectrogramVerticalPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
        spectrogramVerticalPanel.add(commands);
        if (maxTime - minTime < acquisitionDuration) {
            Button unzoom = new Button("Zoom Out");

            unzoom.addClickHandler(new ClickHandler() {
                @Override
                public void onClick(ClickEvent event) {
                    zoomOut();
                }
            });
            commands.setWidget(0, 2, unzoom);
        }
        spectrogramVerticalPanel.add(currentValue);
        spectrogramVerticalPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
        spectrogramVerticalPanel.add(hpanel);
        String helpString = "Single click for power spectrum. Double click to zoom.";

        // Add the slider bar for min occupancy selection.
        occupancyMinPowerVpanel = new VerticalPanel();
        occupancyMinPowerVpanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
        occupancyMinPowerVpanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);

        occupancyMinPowerSliderBar = new SliderBarSimpleVertical(100, canvasPixelHeight + "px", true);
        occupancyMinPowerVpanel.add(occupancyMinPowerSliderBar);
        occupancyMinPowerSliderBar.setMaxValue(100);

        this.occupancyMinPowerLabel = new Label();
        occupancyMinPowerVpanel.add(occupancyMinPowerLabel);

        final Button clearTabsButton = new Button("Close Tabs");
        commands.setWidget(0, 3, clearTabsButton);
        clearTabsButton.addClickHandler(new ClickHandler() {

            @Override
            public void onClick(ClickEvent event) {
                tabPanel.clear();
                tabPanel.add(spectrogramVerticalPanel, "[Spectrogram]");
                tabPanel.add(occupancyPanel, "[Occupancy]");
                tabPanel.selectTab(0);
            }
        });

        final Button cutoffAndRedrawButton = new Button("Cutoff and Redraw");
        commands.setWidget(0, 4, cutoffAndRedrawButton);
        cutoffAndRedrawButton.addClickHandler(new ClickHandler() {
            @Override
            public void onClick(ClickEvent event) {
                mSpectrumBrowser.showWaitImage();
                cutoffAndRedrawButton.setEnabled(false);
                help.setText(COMPUTING_PLEASE_WAIT);
                mSpectrumBrowser.getSpectrumBrowserService().generateSingleAcquisitionSpectrogramAndOccupancy(
                        mSensorId, mSelectionTime, mSys2detect, mMinFreq, mMaxFreq, leftBound, rightBound,
                        cutoffPower, FftPowerOneAcquisitionSpectrogramChart.this);

            }
        });
        occupancyMinPowerSliderBar
                .addBarValueChangedHandler(new OccupancyMinPowerSliderHandler(occupancyMinPowerLabel));
        int initialValue = (int) ((double) (maxPower - cutoff) / (double) (maxPower - minPower) * 100);
        occupancyMinPowerSliderBar.setValue(initialValue);

        hpanel.add(occupancyMinPowerVpanel);

        spectrogramPanel.setTitle(helpString);
        spectrumAndOccupancyPanel = new VerticalPanel();
        spectrumAndOccupancyPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
        spectrogramVerticalPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
        spectrogramVerticalPanel.add(spectrumAndOccupancyPanel);

        occupancyPanel = new VerticalPanel();
        occupancyPanel.setWidth(canvasPixelWidth + "px");
        occupancyPanel.setHeight(canvasPixelHeight + "px");
        occupancyPanel.setPixelSize(canvasPixelWidth, canvasPixelHeight);
        // Fine pan to the right.
        if (rightBound > 0) {
            Button rightPanButton = new Button();
            rightPanButton.addClickHandler(new ClickHandler() {

                @Override
                public void onClick(ClickEvent event) {
                    logger.finest("rightBound = " + rightBound + " leftBound = " + leftBound + " window =  "
                            + window + " aquisitionDuration = " + measurementsPerAcquisition);
                    if (rightBound - window > 0) {
                        rightBound = rightBound - window;
                        leftBound = leftBound + window;
                    } else {
                        leftBound = leftBound + rightBound;
                        rightBound = 0;
                    }
                    help.setText(COMPUTING_PLEASE_WAIT);
                    mSpectrumBrowser.showWaitImage();
                    mSpectrumBrowser.getSpectrumBrowserService()
                            .generateSingleAcquisitionSpectrogramAndOccupancy(mSensorId, mSelectionTime,
                                    mSys2detect, mMinFreq, mMaxFreq, (int) leftBound, (int) rightBound, cutoff,
                                    FftPowerOneAcquisitionSpectrogramChart.this);
                }
            });
            commands.setWidget(0, 5, rightPanButton);
            rightPanButton.setTitle("Click to pan right");
            rightPanButton.setText("Pan Right >");
        }

        // Attach the next spectrogram panel.

        if (nextAcquisitionTime != mSelectionTime) {
            final Button nextAquisitionButton = new Button();
            nextAquisitionButton.setEnabled(true);
            nextAquisitionButton.addClickHandler(new ClickHandler() {

                @Override
                public void onClick(ClickEvent event) {
                    logger.finer("getting next spectrogram");
                    try {
                        mSelectionTime = nextAcquisitionTime;
                        nextAquisitionButton.setEnabled(false);
                        acquisitionDuration = 0;
                        leftBound = 0;
                        rightBound = 0;
                        window = measurementsPerAcquisition;
                        mSpectrumBrowser.showWaitImage();
                        help.setText(COMPUTING_PLEASE_WAIT);

                        mSpectrumBrowser.getSpectrumBrowserService()
                                .generateSingleAcquisitionSpectrogramAndOccupancy(mSensorId,
                                        nextAcquisitionTime, mSys2detect, mMinFreq, mMaxFreq, cutoff,
                                        FftPowerOneAcquisitionSpectrogramChart.this);
                    } catch (Throwable th) {
                        logger.log(Level.SEVERE, "Error calling spectrum browser service", th);
                    }

                }
            });
            nextAquisitionButton.setText("Next Acquisition >>");
            // .setHTML("<img border='0' src='myicons/right-arrow.png' />");
            commands.setWidget(0, 6, nextAquisitionButton);
        }
        setSpectrogramImage();
        drawOccupancyChart();
        tabPanel = new TabPanel();
        tabPanel.add(spectrogramVerticalPanel, "[Spectrogram]");
        tabPanel.add(occupancyPanel, "[Occupancy]");
        tabPanel.selectTab(0);
        vpanel.add(tabPanel);
        tabPanel.addSelectionHandler(new SelectionHandler<Integer>() {

            @Override
            public void onSelection(SelectionEvent<Integer> event) {
                int item = event.getSelectedItem();
                if (item == 0) {
                    help.setText("Single click for detail. Double click to zoom");
                } else if (item == 1) {
                    help.setText("Single click for spectrum");
                } else {
                    help.setText("");
                }
            }
        });

    } catch (Throwable ex) {
        logger.log(Level.SEVERE, "Problem drawing specgtrogram", ex);
    }
}

From source file:gov.nist.spectrumbrowser.client.LoginScreen.java

License:Open Source License

public LoginScreen(SpectrumBrowser spectrumBrowser) {
    verticalPanel = new VerticalPanel();
    RootPanel rootPanel = RootPanel.get();
    VerticalPanel rootVerticalPanel = new VerticalPanel();
    rootPanel.add(rootVerticalPanel);// w w  w.  ja  va  2  s .  c o m
    rootVerticalPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    rootVerticalPanel.setWidth(Window.getClientWidth() + "px");

    HorizontalPanel hpanel = new HorizontalPanel();
    int height = 50;
    hpanel.setWidth(SpectrumBrowser.MAP_WIDTH + "px");
    Image nistLogo = new Image(SpectrumBrowser.getIconsPath() + "nist-logo.png");
    nistLogo.setPixelSize((int) (215.0 / 95.0 * height), height);
    Image ntiaLogo = new Image(SpectrumBrowser.getIconsPath() + "ntia-logo.png");
    ntiaLogo.setPixelSize(height, height);
    hpanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
    hpanel.add(nistLogo);
    HTML html = new HTML("<h2>CAC Measured Spectrum Occupancy Database (BETA)</h2>");
    hpanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    hpanel.add(html);
    hpanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT);
    hpanel.add(ntiaLogo);
    rootVerticalPanel.add(hpanel);

    rootVerticalPanel.add(verticalPanel);
    this.spectrumBrowser = spectrumBrowser;
}

From source file:gov.nist.spectrumbrowser.client.SpectrumBrowser.java

License:Open Source License

@Override
public void onModuleLoad() {
    logger.fine("onModuleLoad");

    spectrumBrowserService.getScreenConfig(new SpectrumBrowserCallback<String>() {
        @Override//from   www. j a v  a  2 s  .  c om
        public void onSuccess(String result) {
            try {
                logger.finer("Result: " + result);
                JSONValue jsonValue = JSONParser.parseLenient(result);

                SpectrumBrowser.MAP_WIDTH = (int) jsonValue.isObject().get(Defines.MAP_WIDTH).isNumber()
                        .doubleValue();

                SpectrumBrowser.MAP_HEIGHT = (int) jsonValue.isObject().get(Defines.MAP_HEIGHT).isNumber()
                        .doubleValue();

                SpectrumBrowser.SPEC_WIDTH = (int) jsonValue.isObject().get(Defines.SPEC_WIDTH).isNumber()
                        .doubleValue();

                SpectrumBrowser.SPEC_HEIGHT = (int) jsonValue.isObject().get(Defines.SPEC_HEIGHT).isNumber()
                        .doubleValue();
                Window.setTitle("MSOD:Login");
                for (int i = 0; i < RootPanel.get().getWidgetCount(); i++) {
                    RootPanel.get().remove(i);
                }
                rootVerticalPanel = new VerticalPanel();
                rootVerticalPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
                rootVerticalPanel.setStyleName("loginPanel");
                RootPanel.get().add(rootVerticalPanel);
                ImagePreloader.load(SpectrumBrowser.getIconsPath() + "ajax-loader.gif", new ImageLoadHandler() {

                    @Override
                    public void imageLoaded(ImageLoadEvent event) {
                        waitImage.setUrl(event.getImageUrl());
                        waitImage.setVisible(false);
                    }
                });

                HorizontalPanel waitImagePanel = new HorizontalPanel();
                waitImagePanel.setHeight(40 + "px");
                waitImage = new FitImage();
                waitImagePanel.add(waitImage);
                rootVerticalPanel.add(waitImagePanel);

                HorizontalPanel hpanel = new HorizontalPanel();
                int height = 50;
                Image nistLogo = new Image(SpectrumBrowser.getIconsPath() + "nist-logo.png");
                nistLogo.setPixelSize((int) (215.0 / 95.0) * height, height);
                Image ntiaLogo = new Image(SpectrumBrowser.getIconsPath() + "ntia-logo.png");
                ntiaLogo.setPixelSize(height, height);
                hpanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
                hpanel.add(nistLogo);
                HTML html = new HTML("<h2>CAC Measured Spectrum Occupancy Database (BETA)</h2>");
                hpanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
                hpanel.add(html);
                hpanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT);
                hpanel.add(ntiaLogo);

                rootVerticalPanel.add(hpanel);
                verticalPanel = new VerticalPanel();
                verticalPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
                verticalPanel.setStyleName("loginPanel");
                verticalPanel.setSpacing(20);
                rootVerticalPanel.add(verticalPanel);

                if (jsonValue.isObject().get(Defines.WARNING_TEXT) != null) {
                    SpectrumBrowser.systemWarning = jsonValue.isObject().get(Defines.WARNING_TEXT).isString()
                            .stringValue();
                }

                if (systemWarning != null) {
                    displayWarning();
                } else {
                    draw();
                }
            } catch (Throwable th) {
                logger.log(Level.SEVERE, "Error Parsing JSON", th);
            }
        }

        @Override
        public void onFailure(Throwable throwable) {
            Window.alert("Error contacting server. Please try later");
        }

    });
}