Example usage for com.google.gwt.user.client.ui DockPanel add

List of usage examples for com.google.gwt.user.client.ui DockPanel add

Introduction

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

Prototype

public void add(IsWidget widget, DockLayoutConstant direction) 

Source Link

Document

Overloaded version for IsWidget.

Usage

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 w w  w .  ja v  a 2 s. c  om*/
    }
    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 w w. j  a v a  2  s .c o  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  av a  2  s  .  co m
    dockPanel_1.setWidth("100%");

    Image image = new Image("images/nist-gray.png");
    image.setStyleName("nistLoginLogo");
    dockPanel_1.add(image, DockPanel.EAST);
    dockPanel_1.setCellVerticalAlignment(image, HasVerticalAlignment.ALIGN_MIDDLE);
    dockPanel_1.setCellHorizontalAlignment(image, HasHorizontalAlignment.ALIGN_RIGHT);

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

    final DecoratorPanel decoratorPanel = new DecoratorPanel();
    centerVerticalPanel.add(decoratorPanel);
    centerVerticalPanel.setCellWidth(decoratorPanel, "100%");
    decoratorPanel.setSize("", "");
    centerVerticalPanel.setCellHorizontalAlignment(decoratorPanel, HasHorizontalAlignment.ALIGN_CENTER);
    centerVerticalPanel.setCellVerticalAlignment(decoratorPanel, HasVerticalAlignment.ALIGN_MIDDLE);

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

    final VerticalPanel verticalPanel = new VerticalPanel();
    verticalPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    verticalPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    dockPanel.add(verticalPanel, DockPanel.NORTH);
    dockPanel.setCellWidth(verticalPanel, "100%");
    dockPanel.setCellVerticalAlignment(verticalPanel, HasVerticalAlignment.ALIGN_MIDDLE);
    dockPanel.setCellHorizontalAlignment(verticalPanel, HasHorizontalAlignment.ALIGN_CENTER);
    verticalPanel.setSize("300px", "90px");

    final Image appVetImage = new Image("images/appvet_logo.png");
    appVetImage.setStyleName("loginPanelLogo");
    verticalPanel.add(appVetImage);
    verticalPanel.setCellHorizontalAlignment(appVetImage, HasHorizontalAlignment.ALIGN_CENTER);
    verticalPanel.setCellVerticalAlignment(appVetImage, HasVerticalAlignment.ALIGN_MIDDLE);
    appVetImage.setSize("192px", "73px");

    loginStatusLabel.setStyleName("submissionRequirementsLabel");
    verticalPanel.add(loginStatusLabel);
    loginStatusLabel.setVisible(true);
    loginStatusLabel.setSize("200px", "20px");
    verticalPanel.setCellHorizontalAlignment(loginStatusLabel, HasHorizontalAlignment.ALIGN_CENTER);

    final Grid grid = new Grid(2, 2);
    grid.setStyleName("loginGrid");
    dockPanel.add(grid, DockPanel.CENTER);
    dockPanel.setCellWidth(grid, "100%");
    grid.setHeight("");
    dockPanel.setCellVerticalAlignment(grid, HasVerticalAlignment.ALIGN_MIDDLE);
    dockPanel.setCellHorizontalAlignment(grid, HasHorizontalAlignment.ALIGN_CENTER);

    final Label usernameLabel = new Label("USERNAME");
    usernameLabel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
    grid.setWidget(0, 0, usernameLabel);
    usernameLabel.setSize("100px", "20px");
    grid.getCellFormatter().setHorizontalAlignment(0, 0, HasHorizontalAlignment.ALIGN_LEFT);
    grid.getCellFormatter().setVerticalAlignment(0, 0, HasVerticalAlignment.ALIGN_MIDDLE);

    grid.setWidget(0, 1, userNameTextBox);
    userNameTextBox.setSize("180px", "15px");
    grid.getCellFormatter().setHorizontalAlignment(0, 1, HasHorizontalAlignment.ALIGN_RIGHT);
    grid.getCellFormatter().setVerticalAlignment(0, 1, HasVerticalAlignment.ALIGN_MIDDLE);

    final Label passwordLabel = new Label("PASSWORD");
    passwordLabel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
    grid.setWidget(1, 0, passwordLabel);
    passwordLabel.setSize("100px", "20px");
    grid.getCellFormatter().setHorizontalAlignment(1, 0, HasHorizontalAlignment.ALIGN_LEFT);
    grid.getCellFormatter().setVerticalAlignment(1, 0, HasVerticalAlignment.ALIGN_MIDDLE);

    grid.setWidget(1, 1, passwordTextBox);
    passwordTextBox.setSize("180px", "15px");
    grid.getCellFormatter().setHorizontalAlignment(1, 1, HasHorizontalAlignment.ALIGN_RIGHT);
    grid.getCellFormatter().setVerticalAlignment(1, 1, HasVerticalAlignment.ALIGN_MIDDLE);
    passwordTextBox.addKeyPressHandler(new KeyPressHandler() {

        @Override
        public void onKeyPress(KeyPressEvent event_) {
            final boolean enterPressed = KeyCodes.KEY_ENTER == event_.getNativeEvent().getKeyCode();
            if (enterPressed) {
                getUserInput();
            }
        }

    });
    final SimplePanel simplePanel_3 = new SimplePanel();
    simplePanel_3.setStyleName("buttonPanel");
    dockPanel.add(simplePanel_3, DockPanel.SOUTH);
    simplePanel_3.setHeight("28px");
    dockPanel.setCellVerticalAlignment(simplePanel_3, HasVerticalAlignment.ALIGN_MIDDLE);
    dockPanel.setCellHorizontalAlignment(simplePanel_3, HasHorizontalAlignment.ALIGN_CENTER);
    loginButton.addClickHandler(new ClickHandler() {

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

    });
    simplePanel_3.setWidget(loginButton);
    loginButton.setText("LOGIN");
    loginButton.setSize("78px", "26px");
}

From source file:gwt.g2d.tetris.client.Tetris.java

License:Apache License

public void initialize() {
    DockPanel panel = new DockPanel();
    parentContainer.add(panel);/* w w w .  jav a  2s  . co  m*/
    panel.add(surface, DockPanel.LINE_START);
    final Button resetButton = new Button("Reset", new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            currPiece = null;
            nextPiece = new Piece();
            matrix = new TetrisMatrix(DEFAULT_NUM_ROWS, DEFAULT_NUM_COLS);
            setLevel(getLevelFromRowsCleared());
            setTotalRowsCleared(0);
            surface.setFocus(true);
        }
    });
    Button previousLevelButton = new Button("Previous level", new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            levelOffset = Math.max(1, levelOffset - 1);
            resetButton.click();
        }
    });
    Button nextLevelButton = new Button("Next level", new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            levelOffset++;
            resetButton.click();
        }
    });

    Panel nextPiecePanel = createPanel(createPanel(createHeaderLabel("Next Piece"), nextPieceSurface),
            createPanel(createHeaderLabel("Lines Cleared"), rowsClearedLabel),
            createPanel(createHeaderLabel("Level"), levelLabel), createPanel(resetButton),
            createPanel(previousLevelButton), createPanel(nextLevelButton));
    nextPiecePanel.setStyleName("sidePanel");
    nextPiecePanel.setHeight(surface.getHeight() + "px");
    panel.add(nextPiecePanel, DockPanel.LINE_END);

    nextPieceSurface.fillBackground(KnownColor.BLACK);

    surface.setFocus(true);
    surface.fillBackground(KnownColor.BLACK);

    initializeKeyHandlers();
}

From source file:gwtdemo.client.LSGWTDemoTable.java

License:Apache License

/**
 * Generate HTML code required for handling Lightstreamer
 * data updates./*w ww. ja  v a 2 s.  c  o m*/
 */
protected void generateLSHtml() {
    //RootPanel rootDiv =;
    DockPanel mainDiv = new DockPanel();

    this.htmlTable.clear();
    this.htmlTable.setWidth("766px");
    this.htmlTable.setCellPadding(2);
    this.htmlTable.setCellSpacing(0);
    this.htmlTable.setBorderWidth(0);

    /* generate header of table */
    for (int i = 0; i < this.fields.length; i++) {
        LSGWTFieldElement elem = this.fields[i];
        this.schemaCache.put(elem.toString(), new Integer(i));
        this.htmlTable.setText(0, i, elem.getName());
        if (i == 0) {
            this.htmlTable.getCellFormatter().setStylePrimaryName(0, i, "tableTitleStockName");
        }
    }
    /* set CSS class */
    this.htmlTable.getRowFormatter().setStylePrimaryName(0, "tableTitle");

    /* generate element fields */
    this.groupCache.clear();
    for (int i = 0; i < this.items.length; i++) {
        String itemId = this.items[i];
        // first row is table headers
        int realRowNum = i + 1;
        this.groupCache.put(itemId, new Integer(realRowNum));
        String styleName = (realRowNum % 2) == 0 ? "coldEven" : "coldOdd";

        for (int n = 0; n < this.fields.length; n++) {
            if (n == 0) {
                this.htmlTable.setText(realRowNum, n, itemId);
                this.htmlTable.getCellFormatter().setStylePrimaryName(realRowNum, n, styleName + "StockName");
            } else {
                this.htmlTable.setText(realRowNum, n, "-");
                this.htmlTable.getCellFormatter().setStylePrimaryName(realRowNum, n, styleName);
            }

        }

        /* set CSS class */
        this.htmlTable.getRowFormatter().setStylePrimaryName(realRowNum, styleName + "Row");

    }

    mainDiv.setStyleName("centrDiv");
    mainDiv.add(this.htmlTable, DockPanel.CENTER);
    RootPanel.get("lsGwtDynamic").add(mainDiv);

}

From source file:mcamara.client.TutorialComposite.java

License:Open Source License

/**
 * Instantiates a new tutorial composite.
 *
 * @param idioma the idioma/*w w w  . ja  va 2s  .c  o  m*/
 */
@SuppressWarnings("deprecation")
public TutorialComposite(String idioma) {
    m = Util.getMensajes(idioma);
    DockPanel dockPanel = new DockPanel();
    initWidget(dockPanel);
    dockPanel.setSize("800", "500");

    panelTitulo = new HorizontalPanel();
    panelTitulo.setSpacing(1);
    panelTitulo.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    panelTitulo.setBorderWidth(0);
    titulo = new Label("New label");
    titulo.setStyleName("gwt-Label-Titulo");
    titulo.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    panelTitulo.add(titulo);
    titulo.setWidth("100%");
    dockPanel.add(panelTitulo, DockPanel.NORTH);
    panelTitulo.setWidth("100%");

    itemsMenuPantallas = new ScrollPanel();
    menuPantallas = new VerticalPanel();
    menuPantallas.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    menuPantallas.setSpacing(1);
    menuPantallas.setBorderWidth(1);
    itemsMenuPantallas.add(menuPantallas);
    menuPantallas.setSize("120px", "100%");
    dockPanel.add(itemsMenuPantallas, DockPanel.WEST);
    itemsMenuPantallas.setSize("100%", "100%");

    VerticalPanel verticalPanel_1 = new VerticalPanel();
    verticalPanel_1.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    verticalPanel_1.setSpacing(5);
    verticalPanel_1.setBorderWidth(0);
    dockPanel.add(verticalPanel_1, DockPanel.CENTER);
    verticalPanel_1.setSize("100%", "100%");

    horizontalPanel = new HorizontalPanel();
    horizontalPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    verticalPanel_1.add(horizontalPanel);
    horizontalPanel.setWidth("80%");

    image = new Image((String) null);
    horizontalPanel.add(image);

    explicacion = new TextArea();
    explicacion.setTextAlignment(TextBoxBase.ALIGN_CENTER);
    explicacion.setEnabled(false);
    explicacion.setVisibleLines(4);
    explicacion.setReadOnly(true);
    explicacion.setAlignment(TextAlignment.LEFT);
    verticalPanel_1.add(explicacion);
    explicacion.setWidth("100%");

    HorizontalPanel horizontalPanel_1 = new HorizontalPanel();
    horizontalPanel_1.setSpacing(1);
    horizontalPanel_1.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT);
    verticalPanel_1.add(horizontalPanel_1);
    horizontalPanel_1.setWidth("100%");

    continuar = new Button(m.continuar());
    horizontalPanel_1.add(continuar);
}

From source file:net.s17fabu.vip.gwt.showcase.client.content.panels.CwDockPanel.java

License:Apache License

/**
 * Initialize this example.//  ww w  .  j  a  v a 2 s .  c  o m
 */
@Override
public Widget onInitialize() {
    // Create a Dock Panel
    DockPanel dock = new DockPanel();
    dock.setStyleName("cw-DockPanel");
    dock.setSpacing(4);
    dock.setHorizontalAlignment(DockPanel.ALIGN_CENTER);

    // Add text all around
    dock.add(new HTML(constants.cwDockPanelNorth1()), DockPanel.NORTH);
    dock.add(new HTML(constants.cwDockPanelSouth1()), DockPanel.SOUTH);
    dock.add(new HTML(constants.cwDockPanelEast()), DockPanel.EAST);
    dock.add(new HTML(constants.cwDockPanelWest()), DockPanel.WEST);
    dock.add(new HTML(constants.cwDockPanelNorth2()), DockPanel.NORTH);
    dock.add(new HTML(constants.cwDockPanelSouth2()), DockPanel.SOUTH);

    // Add scrollable text in the center
    HTML contents = new HTML(constants.cwDockPanelCenter());
    ScrollPanel scroller = new ScrollPanel(contents);
    scroller.setSize("400px", "100px");
    dock.add(scroller, DockPanel.CENTER);

    // Return the content
    dock.ensureDebugId("cwDockPanel");
    return dock;
}

From source file:org.adamtacy.client.ui.effects.impl.browsers.EffectImplementationIE6.java

License:Apache License

/**
 * Reflects an image/*from   w w w .j  a v  a  2  s .co m*/
 */
@Override
public void reflectImage(final NEffectPanel thePanel, final int height, final double opacity, final int gap,
        boolean setUp) {
    final DockPanel container = new DockPanel();
    final Image v = new Image();
    SimplePanel gapPanel;

    Widget w = thePanel.getPanelWidget();
    if (!(w instanceof Image)) {
        w = ((VerticalPanel) w).getWidget(0);
    }

    // For some reason when reloading a page in IE a complete refresh is not
    // made
    // and so this effect is not fired; by adding this load listener overcomes
    // this problem
    // go figure......
    if (!loaded) {
        ((Image) w).addLoadHandler(theIEFix);
        loaded = true;
    } else {
        // ((Image) w).removeLoadHandler(theIEFix);
    }

    gapPanel = new SimplePanel();
    gapPanel.setWidth("100%");
    gapPanel.add(new HTML("&nbsp;"));
    gapPanel.setHeight(gap + "px");

    int imgWidth = w.getOffsetWidth();
    int imgHeight = w.getOffsetHeight();
    int canvasHeight = new Double(imgHeight * height / 100).intValue();

    v.setUrl(((Image) w).getUrl());

    v.getElement().getStyle().setProperty("filter",
            "flipv progid:DXImageTransform.Microsoft.Alpha(opacity=" + (opacity * 100)
                    + ", style=1, finishOpacity=0, startx=0, starty=0, finishx=0, finishy=" + (height * 100)
                    + ")");

    v.setHeight(canvasHeight + "px");
    v.setWidth(imgWidth + "px");

    thePanel.remove(w);

    container.add(w, DockPanel.NORTH);
    container.add(v, DockPanel.SOUTH);
    container.add(gapPanel, DockPanel.CENTER);

    thePanel.add(container);
}

From source file:org.adamtacy.client.ui.effects.impl.browsers.EffectImplementationOpera.java

License:Apache License

/**
 * Reflects an image/* w  w w  . j  a va2  s. c om*/
 */
@Override
public void reflectImage(NEffectPanel thePanel, int height, double opacity, int gap, boolean setUp) {

    DockPanel container;
    Widget w;
    Canvas v;
    SimplePanel gapPanel;

    if (setUp) {
        w = (Image) ((DockPanel) thePanel.getPanelWidget()).getWidget(0);
        v = (Canvas) ((DockPanel) thePanel.getPanelWidget()).getWidget(WHERE_IS_REFLECTION);
        v.setSize(1, 1);
        // v = new Canvas();
        container = (DockPanel) thePanel.getPanelWidget();
        // Remove from panel now as this may make any animations look much
        // smoother
        // If not, there is a danger on slow(er) systems that the reflection hangs
        // out from image until re-drawn.
        container.remove(WHERE_IS_REFLECTION);
    } else {
        container = new DockPanel();
        w = getReflectedImage(thePanel, setUp);
        v = new Canvas();
    }

    gapPanel = new SimplePanel();
    gapPanel.setWidth("100%");
    gapPanel.add(new HTML("&nbsp;"));
    gapPanel.setHeight(gap + "px");

    int imgHeight = w.getOffsetHeight();
    int canvasHeight = (int) ((imgHeight * height) / 100);

    reflect(v.getElement(), w.getElement(), canvasHeight, opacity);

    if (setUp) {
        container.add(v, DockPanel.SOUTH);
    } else {
        container.add(w, DockPanel.NORTH);
        container.add(v, DockPanel.SOUTH);
        thePanel.add(container);
    }
    container.add(gapPanel, DockPanel.CENTER);
    container.getElement().getStyle().setProperty("overflow", "hidden");
    //DOM.setElementAttribute(container.getElement(), "overflow", "hidden");
    container.setHeight(imgHeight + canvasHeight + "px");
}

From source file:org.adamtacy.client.ui.effects.impl.browsers.EffectImplementationStandard.java

License:Apache License

/**
 * Reflects an image by creating a DockPanel where the original image is place
 * in the top and a canvas object containing a refection of the original image
 * is placed below. At the moment I can't seem to reuse the original canvas so
 * if any action is performed requiring the reflection to be re-drawn a new
 * canvas object is required (compare that to the Opera version where reuse is
 * possible)// w  w  w.  ja v  a2s  .  co  m
 * 
 * @param gap
 */
public void reflectImage(NEffectPanel thePanel, int height, double opacity, int gap, boolean setUp) {

    DockPanel container;
    Widget w;
    SimplePanel gapPanel;
    Canvas v;

    w = getReflectedImage(thePanel, setUp);
    if (setUp) {
        v = new Canvas();
        container = (DockPanel) thePanel.getPanelWidget();
        // Remove from panel now as this may make any animations look much
        // smoother
        // If not, there is a danger on slow(er) systems that the reflection hangs
        // out from image until re-drawn.
        container.remove(WHERE_IS_REFLECTION);
    } else {
        container = new DockPanel();
        v = new Canvas();
    }

    gapPanel = new SimplePanel();
    gapPanel.setWidth("100%");
    gapPanel.add(new HTML("&nbsp;"));
    gapPanel.setHeight(gap + "px");

    int imgWidth = w.getOffsetWidth();
    int imgHeight = w.getOffsetHeight();
    int canvasHeight = (int) ((imgHeight * height) / 100);
    v.setSize(imgWidth, canvasHeight);

    reflect(v.getElement(), w.getElement(), canvasHeight, opacity);
    if (setUp) {
        container.add(v, DockPanel.SOUTH);
    } else {
        container.add(w, DockPanel.NORTH);
        container.add(v, DockPanel.SOUTH);
        thePanel.add(container);
    }
    container.add(gapPanel, DockPanel.CENTER);
}