List of usage examples for com.google.gwt.user.client.ui HasVerticalAlignment ALIGN_MIDDLE
VerticalAlignmentConstant ALIGN_MIDDLE
To view the source code for com.google.gwt.user.client.ui HasVerticalAlignment ALIGN_MIDDLE.
Click Source Link
From source file:gov.nist.appvet.gwt.client.gui.dialog.AppUploadDialogBox.java
License:Open Source License
public AppUploadDialogBox(String sessionId, String servletURL) { super(false, true); setSize("", ""); setAnimationEnabled(false);// w w w. j a v a 2 s. c o m final VerticalPanel dialogVPanel = new VerticalPanel(); dialogVPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); dialogVPanel.addStyleName("dialogVPanel"); dialogVPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); this.setWidget(dialogVPanel); dialogVPanel.setSize("", ""); final SimplePanel simplePanel = new SimplePanel(); simplePanel.setStyleName("appUploadPanel"); dialogVPanel.add(simplePanel); dialogVPanel.setCellVerticalAlignment(simplePanel, HasVerticalAlignment.ALIGN_MIDDLE); dialogVPanel.setCellHorizontalAlignment(simplePanel, HasHorizontalAlignment.ALIGN_CENTER); simplePanel.setSize("", ""); uploadAppForm = new FormPanel(); simplePanel.setWidget(uploadAppForm); uploadAppForm.setAction(servletURL); uploadAppForm.setMethod(FormPanel.METHOD_POST); uploadAppForm.setEncoding(FormPanel.ENCODING_MULTIPART); uploadAppForm.setSize("", ""); final VerticalPanel verticalPanel = new VerticalPanel(); verticalPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); verticalPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); uploadAppForm.setWidget(verticalPanel); verticalPanel.setSize("", ""); final Hidden hiddenCommand = new Hidden(); hiddenCommand.setValue("SUBMIT_APP"); hiddenCommand.setName("command"); verticalPanel.add(hiddenCommand); hiddenCommand.setWidth(""); final Hidden hiddenSessionId = new Hidden(); hiddenSessionId.setName("sessionid"); hiddenSessionId.setValue(sessionId); verticalPanel.add(hiddenSessionId); hiddenSessionId.setWidth(""); final HorizontalPanel horizontalButtonPanel = new HorizontalPanel(); horizontalButtonPanel.setStyleName("buttonPanel"); dialogVPanel.add(horizontalButtonPanel); horizontalButtonPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); dialogVPanel.setCellVerticalAlignment(horizontalButtonPanel, HasVerticalAlignment.ALIGN_MIDDLE); dialogVPanel.setCellHorizontalAlignment(horizontalButtonPanel, HasHorizontalAlignment.ALIGN_CENTER); horizontalButtonPanel.setSpacing(10); horizontalButtonPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); horizontalButtonPanel.setWidth("300px"); verticalPanel.setCellWidth(horizontalButtonPanel, "100%"); final Grid grid = new Grid(2, 2); grid.setStyleName("grid"); verticalPanel.add(grid); verticalPanel.setCellHorizontalAlignment(grid, HasHorizontalAlignment.ALIGN_CENTER); verticalPanel.setCellVerticalAlignment(grid, HasVerticalAlignment.ALIGN_MIDDLE); grid.setSize("", ""); final Label uploadLabel = new Label("App file: "); uploadLabel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT); grid.setWidget(0, 0, uploadLabel); uploadLabel.setStyleName("uploadLabel"); uploadLabel.setSize("", ""); fileUpload = new FileUpload(); grid.setWidget(0, 1, fileUpload); grid.getCellFormatter().setWidth(0, 1, ""); grid.getCellFormatter().setHeight(0, 1, ""); fileUpload.setStyleName("appUpload"); fileUpload.setTitle("Select app file to upload"); fileUpload.setName("fileupload"); fileUpload.setSize("240px", ""); grid.getCellFormatter().setVerticalAlignment(0, 0, HasVerticalAlignment.ALIGN_MIDDLE); grid.getCellFormatter().setVerticalAlignment(1, 0, HasVerticalAlignment.ALIGN_MIDDLE); grid.getCellFormatter().setVerticalAlignment(0, 1, HasVerticalAlignment.ALIGN_MIDDLE); grid.getCellFormatter().setHorizontalAlignment(1, 1, HasHorizontalAlignment.ALIGN_LEFT); grid.getCellFormatter().setVerticalAlignment(1, 1, HasVerticalAlignment.ALIGN_MIDDLE); grid.getCellFormatter().setHorizontalAlignment(1, 0, HasHorizontalAlignment.ALIGN_LEFT); grid.getCellFormatter().setHorizontalAlignment(0, 1, HasHorizontalAlignment.ALIGN_LEFT); grid.getCellFormatter().setHorizontalAlignment(0, 0, HasHorizontalAlignment.ALIGN_CENTER); submitAppStatusLabel = new Label(""); submitAppStatusLabel.setStyleName("submissionRequirementsLabel"); submitAppStatusLabel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); verticalPanel.add(submitAppStatusLabel); verticalPanel.setCellHorizontalAlignment(submitAppStatusLabel, HasHorizontalAlignment.ALIGN_CENTER); verticalPanel.setCellVerticalAlignment(submitAppStatusLabel, HasVerticalAlignment.ALIGN_MIDDLE); submitAppStatusLabel.setSize("", "18px"); cancelButton = new PushButton("Cancel"); cancelButton.setHTML("Cancel"); horizontalButtonPanel.add(cancelButton); horizontalButtonPanel.setCellHorizontalAlignment(cancelButton, HasHorizontalAlignment.ALIGN_CENTER); cancelButton.setSize("70px", "18px"); submitButton = new PushButton("Submit"); horizontalButtonPanel.add(submitButton); horizontalButtonPanel.setCellHorizontalAlignment(submitButton, HasHorizontalAlignment.ALIGN_CENTER); submitButton.setSize("70px", "18px"); submitButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { uploadAppForm.submit(); } }); }
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);// w w w .ja va 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 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);/*ww w. j av 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 {//w ww . j av a 2 s . 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);/*w w w. ja va2 s . c o 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);// w w w. ja va 2 s . co 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;/* ww w. ja v a2 s. co 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 2 s .co m 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.appvet.gwt.client.gui.LoginPanel.java
License:Open Source License
public LoginPanel(Unit unit) { super(Unit.PX); final String version = AppVetProperties.VERSION; log.info("Starting AppVet v" + version + "..."); setSize("100%", ""); DockPanel dockPanel_1 = new DockPanel(); dockPanel_1.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT); addNorth(dockPanel_1, 32.0);/*from ww w . j a v a 2 s.c o m*/ dockPanel_1.setWidth("100%"); Image image = new Image("images/nist-gray.png"); image.setStyleName("nistLoginLogo"); dockPanel_1.add(image, DockPanel.EAST); dockPanel_1.setCellVerticalAlignment(image, HasVerticalAlignment.ALIGN_MIDDLE); dockPanel_1.setCellHorizontalAlignment(image, HasHorizontalAlignment.ALIGN_RIGHT); final VerticalPanel centerVerticalPanel = new VerticalPanel(); centerVerticalPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); centerVerticalPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); add(centerVerticalPanel); centerVerticalPanel.setSize("100%", "90%"); final DecoratorPanel decoratorPanel = new DecoratorPanel(); centerVerticalPanel.add(decoratorPanel); centerVerticalPanel.setCellWidth(decoratorPanel, "100%"); decoratorPanel.setSize("", ""); centerVerticalPanel.setCellHorizontalAlignment(decoratorPanel, HasHorizontalAlignment.ALIGN_CENTER); centerVerticalPanel.setCellVerticalAlignment(decoratorPanel, HasVerticalAlignment.ALIGN_MIDDLE); final DockPanel dockPanel = new DockPanel(); dockPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); dockPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); decoratorPanel.setWidget(dockPanel); dockPanel.setSize("100%", "200px"); final VerticalPanel verticalPanel = new VerticalPanel(); verticalPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); verticalPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); dockPanel.add(verticalPanel, DockPanel.NORTH); dockPanel.setCellWidth(verticalPanel, "100%"); dockPanel.setCellVerticalAlignment(verticalPanel, HasVerticalAlignment.ALIGN_MIDDLE); dockPanel.setCellHorizontalAlignment(verticalPanel, HasHorizontalAlignment.ALIGN_CENTER); verticalPanel.setSize("300px", "90px"); final Image appVetImage = new Image("images/appvet_logo.png"); appVetImage.setStyleName("loginPanelLogo"); verticalPanel.add(appVetImage); verticalPanel.setCellHorizontalAlignment(appVetImage, HasHorizontalAlignment.ALIGN_CENTER); verticalPanel.setCellVerticalAlignment(appVetImage, HasVerticalAlignment.ALIGN_MIDDLE); appVetImage.setSize("192px", "73px"); loginStatusLabel.setStyleName("submissionRequirementsLabel"); verticalPanel.add(loginStatusLabel); loginStatusLabel.setVisible(true); loginStatusLabel.setSize("200px", "20px"); verticalPanel.setCellHorizontalAlignment(loginStatusLabel, HasHorizontalAlignment.ALIGN_CENTER); final Grid grid = new Grid(2, 2); grid.setStyleName("loginGrid"); dockPanel.add(grid, DockPanel.CENTER); dockPanel.setCellWidth(grid, "100%"); grid.setHeight(""); dockPanel.setCellVerticalAlignment(grid, HasVerticalAlignment.ALIGN_MIDDLE); dockPanel.setCellHorizontalAlignment(grid, HasHorizontalAlignment.ALIGN_CENTER); final Label usernameLabel = new Label("USERNAME"); usernameLabel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT); grid.setWidget(0, 0, usernameLabel); usernameLabel.setSize("100px", "20px"); grid.getCellFormatter().setHorizontalAlignment(0, 0, HasHorizontalAlignment.ALIGN_LEFT); grid.getCellFormatter().setVerticalAlignment(0, 0, HasVerticalAlignment.ALIGN_MIDDLE); grid.setWidget(0, 1, userNameTextBox); userNameTextBox.setSize("180px", "15px"); grid.getCellFormatter().setHorizontalAlignment(0, 1, HasHorizontalAlignment.ALIGN_RIGHT); grid.getCellFormatter().setVerticalAlignment(0, 1, HasVerticalAlignment.ALIGN_MIDDLE); final Label passwordLabel = new Label("PASSWORD"); passwordLabel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT); grid.setWidget(1, 0, passwordLabel); passwordLabel.setSize("100px", "20px"); grid.getCellFormatter().setHorizontalAlignment(1, 0, HasHorizontalAlignment.ALIGN_LEFT); grid.getCellFormatter().setVerticalAlignment(1, 0, HasVerticalAlignment.ALIGN_MIDDLE); grid.setWidget(1, 1, passwordTextBox); passwordTextBox.setSize("180px", "15px"); grid.getCellFormatter().setHorizontalAlignment(1, 1, HasHorizontalAlignment.ALIGN_RIGHT); grid.getCellFormatter().setVerticalAlignment(1, 1, HasVerticalAlignment.ALIGN_MIDDLE); passwordTextBox.addKeyPressHandler(new KeyPressHandler() { @Override public void onKeyPress(KeyPressEvent event_) { final boolean enterPressed = KeyCodes.KEY_ENTER == event_.getNativeEvent().getKeyCode(); if (enterPressed) { getUserInput(); } } }); final SimplePanel simplePanel_3 = new SimplePanel(); simplePanel_3.setStyleName("buttonPanel"); dockPanel.add(simplePanel_3, DockPanel.SOUTH); simplePanel_3.setHeight("28px"); dockPanel.setCellVerticalAlignment(simplePanel_3, HasVerticalAlignment.ALIGN_MIDDLE); dockPanel.setCellHorizontalAlignment(simplePanel_3, HasHorizontalAlignment.ALIGN_CENTER); loginButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { getUserInput(); } }); simplePanel_3.setWidget(loginButton); loginButton.setText("LOGIN"); loginButton.setSize("78px", "26px"); }
From source file:gov.nist.spectrumbrowser.admin.AccountManagement.java
License:Open Source License
@Override public void draw() { verticalPanel.clear();/* ww w.j av a 2s.com*/ HTML html = new HTML("<h3>User Accounts</h3>"); int rows = userAccounts.size(); verticalPanel.add(html); HTML helpText = new HTML("<p>Add button to add new accounts.</p> " + "<p>Admin accounts are always authenticated. For User account, ensure authentication is enbled on System Config page.</p>"); grid = new Grid(rows + 1, 11); grid.setText(0, 0, "Email Adddress"); grid.setText(0, 1, "First Name"); grid.setText(0, 2, "Last Name"); grid.setText(0, 3, "Admin Privilege"); grid.setText(0, 4, "Failed Login Attempts"); grid.setText(0, 5, "Account Locked?"); grid.setText(0, 6, "Unlock Account"); grid.setText(0, 7, "Password Expiry Date"); grid.setText(0, 8, "Reset Expiration"); grid.setText(0, 9, "Creation Date"); grid.setText(0, 10, "Delete Account"); // TODO: add session information like currently logged in, time logged in, time session expires // & ability to delete a session object grid.setBorderWidth(2); grid.setCellPadding(2); for (int i = 1; i < rows + 1; i++) { JSONObject account = userAccounts.get(i - 1).isObject(); grid.setText(i, 0, account.get(Defines.ACCOUNT_EMAIL_ADDRESS).isString().stringValue()); grid.setText(i, 1, account.get(Defines.ACCOUNT_FIRST_NAME).isString().stringValue()); grid.setText(i, 2, account.get(Defines.ACCOUNT_LAST_NAME).isString().stringValue()); String priv = account.get(Defines.ACCOUNT_PRIVILEGE).isString().stringValue(); CheckBox togglePrivilege = new CheckBox(); togglePrivilege.setValue(priv.equals("admin")); togglePrivilege.addValueChangeHandler(new TogglePrivilegeValueChangeHandler( account.get(Defines.ACCOUNT_EMAIL_ADDRESS).isString().stringValue())); grid.setWidget(i, 3, togglePrivilege); grid.setText(i, 4, Integer .toString((int) account.get(Defines.ACCOUNT_NUM_FAILED_LOGINS).isNumber().doubleValue())); grid.setText(i, 5, Boolean.toString(account.get(Defines.ACCOUNT_LOCKED).isBoolean().booleanValue())); Button unlock = new Button("Unlock"); unlock.addClickHandler( new UnlockClickHandler(account.get(Defines.ACCOUNT_EMAIL_ADDRESS).isString().stringValue())); grid.setWidget(i, 6, unlock); //JEK: note: the 'datePasswordExpires' and 'dateAccountCreated' are not in accounts database since we store time in seconds. // These date fields are just for display here so we do not need to define constants for JSON strings. grid.setText(i, 7, account.get("datePasswordExpires").isString().stringValue()); Button reset = new Button("Reset Expiration"); reset.addClickHandler(new ResetExpirationClickHandler( account.get(Defines.ACCOUNT_EMAIL_ADDRESS).isString().stringValue())); grid.setWidget(i, 8, reset); grid.setText(i, 9, account.get("dateAccountCreated").isString().stringValue()); Button delete = new Button("Delete"); delete.addClickHandler( new DeleteClickHandler(account.get(Defines.ACCOUNT_EMAIL_ADDRESS).isString().stringValue())); grid.setWidget(i, 10, delete); } for (int i = 0; i < grid.getColumnCount(); i++) { grid.getCellFormatter().setStyleName(0, i, "textLabelStyle"); } for (int i = 0; i < grid.getRowCount(); i++) { for (int j = 0; j < grid.getColumnCount(); j++) { grid.getCellFormatter().setHorizontalAlignment(i, j, HasHorizontalAlignment.ALIGN_CENTER); grid.getCellFormatter().setVerticalAlignment(i, j, HasVerticalAlignment.ALIGN_MIDDLE); } } verticalPanel.add(grid); HorizontalPanel buttonPanel = new HorizontalPanel(); Button addAccountButton = new Button("Add"); addAccountButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { //JEK: I commented out this line because we not want to go back to account management if add account failed //redraw = true; new AddAccount(admin, AccountManagement.this, verticalPanel).draw(); } }); buttonPanel.add(addAccountButton); Button refreshButton = new Button("Refresh"); refreshButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { redraw = true; Admin.getAdminService().getUserAccounts(AccountManagement.this); } }); buttonPanel.add(refreshButton); Button logoffButton = new Button("Log Off"); logoffButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { admin.logoff(); } }); buttonPanel.add(logoffButton); verticalPanel.add(buttonPanel); }