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

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

Introduction

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

Prototype

VerticalAlignmentConstant ALIGN_MIDDLE

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

Click Source Link

Document

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

Usage

From source file:com.novartis.pcs.ontology.webapp.client.view.HistoryPopup.java

License:Apache License

private void addDialogWidgets() {
    VerticalPanel vertPanel = new VerticalPanel();
    HorizontalPanel filterPanel = new HorizontalPanel();
    Label filterLabel = new Label("Keyword Filter:");
    SimplePager.Resources pagerResources = GWT.create(SimplePager.Resources.class);
    SimplePager pager = new SimplePager(TextLocation.CENTER, pagerResources, false, 0, true) {
        @Override/* w  w w .  jav a2  s . co m*/
        public void setPageStart(int index) {
            HasRows display = getDisplay();
            if (display != null) {
                Range range = display.getVisibleRange();
                int pageSize = range.getLength();
                if (isRangeLimited() && display.isRowCountExact()) {
                    index = Math.min(index, display.getRowCount() - 1);
                }
                index = Math.max(0, index);
                if (index != range.getStart()) {
                    display.setVisibleRange(index, pageSize);
                }
            }
        }
    };
    Button closeButton = new Button("Close");
    closeButton.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            dialogBox.hide();
        }
    });

    filterLabel.addStyleName("dialog-label");

    filterPanel.addStyleName("dialog-hpanel");
    filterPanel.add(filterLabel);
    filterPanel.add(filterTextBox);
    filterPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);

    pager.addStyleName("centered-hortz");
    pager.setDisplay(table);

    vertPanel.addStyleName("dialog-vpanel");
    vertPanel.add(filterPanel);
    vertPanel.add(table);
    vertPanel.add(pager);
    vertPanel.add(closeButton);
    vertPanel.setCellHorizontalAlignment(closeButton, HasHorizontalAlignment.ALIGN_CENTER);
    dialogBox.setWidget(vertPanel);
}

From source file:com.objetdirect.gwt.umldrawer.client.LoadingScreen.java

License:Open Source License

/**
 * Constructor of the {@link LoadingScreen}
 * //ww w .  j a  va2s  . com
 */
public LoadingScreen() {
    super();
    final Image loader = new Image("ajax-loader.gif");
    this.loadingPanel = new HorizontalPanel();
    this.loadingPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    this.loadingPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    this.loadingPanel.setSize("100%", "100%");
    this.loadingPanel.add(loader);
    this.loadingPanel.setVisible(false);
    RootPanel.get().add(this.loadingPanel, 0, 0);
}

From source file:com.openkm.frontend.client.widget.foldertree.FolderSelectPopup.java

License:Open Source License

public FolderSelectPopup() {
    // Establishes auto-close when click outside
    super(false, true);

    vPanel = new VerticalPanel();
    vPanel.setWidth("450");
    vPanel.setHeight("400");
    hPanel = new HorizontalPanel();
    hListPanel = new HorizontalPanel();
    hContextPanel = new HorizontalPanel();

    contextTxt = new HTML(Main.i18n("search.context"));
    contextListBox = new ListBox();
    contextListBox.setStyleName("okm-Select");

    contextListBox.addChangeHandler(new ChangeHandler() {
        @Override//from   w ww. j  a  v  a 2  s  .co  m
        public void onChange(ChangeEvent event) {
            folderSelectTree
                    .changeView(Integer.parseInt(contextListBox.getValue(contextListBox.getSelectedIndex())));
        }
    });
    hContextPanel.add(contextTxt);
    hContextPanel.add(new HTML("  "));
    hContextPanel.add(contextListBox);
    hContextPanel.setCellVerticalAlignment(contextTxt, HasVerticalAlignment.ALIGN_MIDDLE);

    hListPanel.add(hContextPanel);
    hListPanel.setWidth("440");

    scrollDirectoryPanel = new ScrollPanel();
    scrollDirectoryPanel.setSize("440", "350");
    scrollDirectoryPanel.setStyleName("okm-Popup-text");
    verticalDirectoryPanel = new VerticalPanel();
    verticalDirectoryPanel.setSize("100%", "100%");
    folderSelectTree = new FolderSelectTree();
    folderSelectTree.setSize("100%", "100%");

    verticalDirectoryPanel.add(folderSelectTree);
    scrollDirectoryPanel.add(verticalDirectoryPanel);

    cancelButton = new Button(Main.i18n("button.cancel"), new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            action = ACTION_NONE;
            hide();
        }
    });

    actionButton = new Button(Main.i18n("button.move"), new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            executeAction(folderSelectTree.getActualPath(), false);
        }
    });

    status.setWidth("430");
    status.setWordWrap(true);
    status.setStyleName("fancyfileupload-pending");
    status.setVisible(false);

    vPanel.add(new HTML("<br>"));
    vPanel.add(hListPanel);
    vPanel.add(new HTML("<br>"));
    vPanel.add(scrollDirectoryPanel);
    vPanel.add(status);
    vPanel.add(new HTML("<br>"));
    hPanel.add(cancelButton);
    HTML space = new HTML();
    space.setWidth("50");
    hPanel.add(space);
    hPanel.add(actionButton);
    vPanel.add(hPanel);
    vPanel.add(new HTML("<br>"));

    vPanel.setCellHorizontalAlignment(hListPanel, HasAlignment.ALIGN_CENTER);
    vPanel.setCellHorizontalAlignment(scrollDirectoryPanel, HasAlignment.ALIGN_CENTER);
    vPanel.setCellHorizontalAlignment(status, HasAlignment.ALIGN_CENTER);
    vPanel.setCellHorizontalAlignment(hPanel, HasAlignment.ALIGN_CENTER);
    vPanel.setCellHeight(scrollDirectoryPanel, "350");

    cancelButton.setStyleName("okm-NoButton");
    actionButton.setStyleName("okm-YesButton");

    massiveStatus = new com.openkm.frontend.client.widget.massive.Status(this);
    massiveStatus.setStyleName("okm-StatusPopup");

    super.hide();
    setWidget(vPanel);
}

From source file:com.openkm.frontend.client.widget.form.FolderSelectPopup.java

License:Open Source License

/**
 * FolderSelectPopup//w  w  w  . j  a v a2s.c o  m
 */
public FolderSelectPopup() {
    // Establishes auto-close when click outside
    super(false, true);

    vPanel = new VerticalPanel();
    vPanel.setWidth("300");
    vPanel.setHeight("200");
    hPanel = new HorizontalPanel();
    hListPanel = new HorizontalPanel();
    hContextPanel = new HorizontalPanel();

    contextTxt = new HTML(Main.i18n("search.context"));
    contextListBox = new ListBox();
    contextListBox.setStyleName("okm-Select");

    contextListBox.addChangeHandler(new ChangeHandler() {
        @Override
        public void onChange(ChangeEvent event) {
            folderSelectTree
                    .changeView(Integer.parseInt(contextListBox.getValue(contextListBox.getSelectedIndex())));
        }
    });
    hContextPanel.add(contextTxt);
    hContextPanel.add(new HTML("&nbsp;&nbsp;"));
    hContextPanel.add(contextListBox);
    hContextPanel.setCellVerticalAlignment(contextTxt, HasVerticalAlignment.ALIGN_MIDDLE);

    hListPanel.add(hContextPanel);
    hListPanel.setWidth("290");

    setText(Main.i18n("search.folder.filter"));

    scrollDirectoryPanel = new ScrollPanel();
    scrollDirectoryPanel.setSize("290", "150");
    scrollDirectoryPanel.setStyleName("okm-Popup-text");
    verticalDirectoryPanel = new VerticalPanel();
    verticalDirectoryPanel.setSize("100%", "100%");
    folderSelectTree = new FolderSelectTree();
    folderSelectTree.setSize("100%", "100%");

    verticalDirectoryPanel.add(folderSelectTree);
    scrollDirectoryPanel.add(verticalDirectoryPanel);

    cancelButton = new Button(Main.i18n("button.cancel"), new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            hide();
        }
    });

    actionButton = new Button(Main.i18n("button.select"), new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            textBox.setValue(folderSelectTree.getActualPath());
            if (propertyHandler != null) {
                propertyHandler.metadataValueChanged();
            }
            hide();
        }
    });

    vPanel.add(new HTML("<br>"));
    vPanel.add(hListPanel);
    vPanel.add(new HTML("<br>"));
    vPanel.add(scrollDirectoryPanel);
    vPanel.add(new HTML("<br>"));
    hPanel.add(cancelButton);
    HTML space = new HTML();
    space.setWidth("50");
    hPanel.add(space);
    hPanel.add(actionButton);
    vPanel.add(hPanel);
    vPanel.add(new HTML("<br>"));

    vPanel.setCellHorizontalAlignment(hListPanel, HasAlignment.ALIGN_CENTER);
    vPanel.setCellHorizontalAlignment(scrollDirectoryPanel, HasAlignment.ALIGN_CENTER);
    vPanel.setCellHorizontalAlignment(hPanel, HasAlignment.ALIGN_CENTER);
    vPanel.setCellHeight(scrollDirectoryPanel, "150");

    cancelButton.setStyleName("okm-Input");
    actionButton.setStyleName("okm-Input");

    super.hide();
    setWidget(vPanel);
}

From source file:com.openkm.frontend.client.widget.UserPopup.java

License:Open Source License

/**
 * User popup//from w w  w  .ja  v a2s.  c o m
 */
public UserPopup() {

    // Establishes auto-close when click outside
    super(false, true);

    vPanel = new VerticalPanel();
    userFlexTable = new FlexTable();
    mailFlexTable = new FlexTable();

    userGroupBoxPanel = new GroupBoxPanel();
    userGroupBoxPanel.setCaption(Main.i18n("user.preferences.user.data"));
    userGroupBoxPanel.add(userFlexTable);

    mailGroupBoxPanel = new GroupBoxPanel();
    mailGroupBoxPanel.setCaption(Main.i18n("user.preferences.mail.data"));
    mailGroupBoxPanel.add(mailFlexTable);

    userId = new HTML(Main.i18n("user.preferences.user"));
    userName = new HTML(Main.i18n("user.preferences.name"));
    userPassword = new HTML(Main.i18n("user.preferences.password"));
    userMail = new HTML(Main.i18n("user.preferences.mail"));
    userRoles = new HTML(Main.i18n("user.preferences.roles"));
    mailProtocol = new HTML(Main.i18n("user.preferences.mail.protocol"));
    mailHost = new HTML(Main.i18n("user.preferences.mail.host"));
    mailUser = new HTML(Main.i18n("user.preferences.mail.user"));
    mailPassword = new HTML(Main.i18n("user.preferences.mail.user.password"));
    mailFolder = new HTML(Main.i18n("user.preferences.mail.folder"));
    userPasswordText = new PasswordTextBox();
    userPasswordTextVerify = new PasswordTextBox();
    userNameText = new HTML("");
    userMailText = new TextBox();
    rolesPanel = new HTML();
    mailUserPasswordText = new PasswordTextBox();
    passwordError = new HTML(Main.i18n("user.preferences.password.error"));
    passwordValidationError = new HTML("");
    mailPasswordError = new HTML(Main.i18n("user.preferences.mail.password.error.void"));
    mailError = new HTML(Main.i18n("user.preferences.mail.error"));
    mailTestError = new HTML(Main.i18n("user.preferences.mail.test.error"));
    mailTestOK = new HTML(Main.i18n("user.preferences.mail.test.ok"));

    passwordError.setVisible(false);
    passwordValidationError.setVisible(false);
    mailPasswordError.setVisible(false);
    mailError.setVisible(false);
    mailTestError.setVisible(false);
    mailTestOK.setVisible(false);

    mailHostText = new TextBox();
    mailUserText = new TextBox();
    mailFolderText = new TextBox();
    mailProtocolList = new ListBox();

    mailProtocolList.addItem("POP3", "pop3");
    mailProtocolList.addItem("POP3S", "pop3s");
    mailProtocolList.addItem("IMAP", "imap");
    mailProtocolList.addItem("IMAPS", "imaps");

    acceptButton = new Button(Main.i18n("button.accept"), new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            passwordError.setVisible(false);
            passwordValidationError.setVisible(false);
            mailPasswordError.setVisible(false);
            mailError.setVisible(false);
            mailTestError.setVisible(false);
            mailTestOK.setVisible(false);

            // Password always must be equals
            if (!userPasswordText.getText().equals(userPasswordTextVerify.getText())) {
                passwordError.setVisible(true);
                // Case creation
            } else if (Main.get().workspaceUserProperties.getWorkspace().getMailID() < 0
                    && mailUserPasswordText.getText().equals("") && (mailFolderText.getText().length() > 0
                            || mailUserText.getText().length() > 0 || mailHostText.getText().length() > 0)) {
                mailPasswordError.setVisible(true);
                // Case update
            } else if ((mailUserPasswordText.getText().length() > 0 || mailFolderText.getText().length() > 0
                    || mailUserText.getText().length() > 0 || mailHostText.getText().length() > 0)
                    && !(mailFolderText.getText().length() > 0 && mailUserText.getText().length() > 0
                            && mailHostText.getText().length() > 0)) {
                mailError.setVisible(true);
            } else {
                final GWTWorkspace workspace = new GWTWorkspace();
                String proto = mailProtocolList.getValue(mailProtocolList.getSelectedIndex());
                workspace.setUser(Main.get().workspaceUserProperties.getUser());
                workspace.setEmail(userMailText.getText());
                workspace.setMailFolder(mailFolderText.getText());
                workspace.setMailProtocol(proto);
                workspace.setMailHost(mailHostText.getText());
                workspace.setMailUser(mailUserText.getText());
                workspace.setMailPassword(mailUserPasswordText.getText());
                workspace.setPassword(userPasswordText.getText());
                workspace.setMailID(Main.get().workspaceUserProperties.getWorkspace().getMailID());

                // First must validate password
                workspaceService.isValidPassword(userPasswordText.getText(), new AsyncCallback<String>() {
                    @Override
                    public void onSuccess(String result) {
                        if (result.equals("")) {
                            workspaceService.updateUserWorkspace(workspace, callbackUpdateUserWorkspace);
                        } else {
                            passwordValidationError.setHTML(result);
                            passwordValidationError.setVisible(true);
                        }
                    }

                    @Override
                    public void onFailure(Throwable caught) {
                        Main.get().showError("callbackIsValidPassword", caught);
                    }
                });
            }
        }
    });

    cancelButton = new Button(Main.i18n("button.cancel"), new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            hide();
        }
    });

    testButton = new Button(Main.i18n("button.test"), new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            mailTestError.setVisible(false);
            mailTestOK.setVisible(false);
            testButton.setEnabled(false);
            String proto = mailProtocolList.getValue(mailProtocolList.getSelectedIndex());
            generalService.testMailConnection(proto, mailHostText.getText(), mailUserText.getText(),
                    mailUserPasswordText.getText(), mailFolderText.getText(), new AsyncCallback<GWTTestMail>() {
                        @Override
                        public void onSuccess(GWTTestMail result) {
                            if (!result.isError()) {
                                mailTestError.setVisible(false);
                                mailTestOK.setVisible(true);
                            } else {
                                mailTestError.setHTML(Main.i18n("user.preferences.mail.test.error") + "<br>"
                                        + result.getErrorMsg());
                                mailTestError.setVisible(true);
                                mailTestOK.setVisible(false);
                            }

                            testButton.setEnabled(true);
                        }

                        @Override
                        public void onFailure(Throwable caught) {
                            mailTestError.setVisible(false);
                            mailTestOK.setVisible(false);
                            testButton.setEnabled(true);
                            Main.get().showError("testMailConnection", caught);
                        }
                    });
        }
    });

    deleteButton = new Button(Main.i18n("button.delete"), new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            long Id = Main.get().workspaceUserProperties.getWorkspace().getMailID();

            if (Id >= 0) {
                workspaceService.deleteMailAccount(Id, callbackDeleteMailAccount);
            }
        }
    });

    hPanel = new HorizontalPanel();
    hPanel.add(cancelButton);
    hPanel.add(new HTML("&nbsp;&nbsp;"));
    hPanel.add(acceptButton);

    userFlexTable.setCellPadding(0);
    userFlexTable.setCellSpacing(2);
    userFlexTable.setWidth("455");

    userFlexTable.setWidget(0, 0, userId);
    userFlexTable.setWidget(1, 0, userName);
    userFlexTable.setWidget(2, 0, userPassword);
    userFlexTable.setWidget(3, 0, userMail);
    userFlexTable.setWidget(4, 0, userRoles);

    userFlexTable.setWidget(1, 1, userNameText);
    userFlexTable.setWidget(2, 1, userPasswordText);
    userFlexTable.setWidget(2, 2, userPasswordTextVerify);
    userFlexTable.setWidget(3, 1, userMailText);
    userFlexTable.setWidget(4, 1, rolesPanel);

    userFlexTable.getFlexCellFormatter().setVerticalAlignment(4, 0, HasAlignment.ALIGN_TOP);
    userFlexTable.getFlexCellFormatter().setColSpan(3, 1, 2);
    userFlexTable.getFlexCellFormatter().setColSpan(4, 1, 2);

    mailFlexTable.setCellPadding(0);
    mailFlexTable.setCellSpacing(2);
    mailFlexTable.setWidth("455");

    mailFlexTable.setWidget(1, 0, mailProtocol);
    mailFlexTable.setWidget(2, 0, mailHost);
    mailFlexTable.setWidget(3, 0, mailUser);
    mailFlexTable.setWidget(4, 0, mailPassword);
    mailFlexTable.setWidget(5, 0, mailFolder);

    mailFlexTable.setWidget(1, 1, mailProtocolList);
    mailFlexTable.setWidget(2, 1, mailHostText);
    mailFlexTable.setWidget(3, 1, mailUserText);
    mailFlexTable.setWidget(4, 1, mailUserPasswordText);
    mailFlexTable.setWidget(5, 1, mailFolderText);

    HorizontalPanel hMailButtonPanel = new HorizontalPanel();
    hMailButtonPanel.add(deleteButton);
    hMailButtonPanel.add(new HTML("&nbsp;"));
    hMailButtonPanel.add(testButton);
    mailFlexTable.setWidget(6, 0, hMailButtonPanel);

    mailFlexTable.getFlexCellFormatter().setColSpan(1, 1, 2);
    mailFlexTable.getFlexCellFormatter().setColSpan(6, 0, 3);
    mailFlexTable.getFlexCellFormatter().setAlignment(6, 0, HasHorizontalAlignment.ALIGN_CENTER,
            HasVerticalAlignment.ALIGN_MIDDLE);

    userMailText.setWidth("200");
    mailHostText.setWidth("200");
    mailUserText.setWidth("150");
    mailUserPasswordText.setWidth("150");
    mailFolderText.setWidth("150");
    rolesPanel.setWidth("350");
    userGroupBoxPanel.setWidth("460");
    mailGroupBoxPanel.setWidth("460");

    vPanel.setWidth("470");
    vPanel.setHeight("195");

    vPanel.add(new HTML("<br>"));
    vPanel.add(userGroupBoxPanel);
    vPanel.add(new HTML("<br>"));
    vPanel.add(mailGroupBoxPanel);
    vPanel.add(passwordError);
    vPanel.add(passwordValidationError);
    vPanel.add(mailPasswordError);
    vPanel.add(mailError);
    vPanel.add(mailTestError);
    vPanel.add(mailTestOK);
    vPanel.add(new HTML("<br>"));
    vPanel.add(hPanel);
    vPanel.add(new HTML("<br>"));

    vPanel.setCellHorizontalAlignment(userGroupBoxPanel, HasAlignment.ALIGN_CENTER);
    vPanel.setCellHorizontalAlignment(mailGroupBoxPanel, HasAlignment.ALIGN_CENTER);
    vPanel.setCellHorizontalAlignment(hPanel, HasAlignment.ALIGN_CENTER);
    vPanel.setCellHorizontalAlignment(passwordError, HasAlignment.ALIGN_CENTER);
    vPanel.setCellHorizontalAlignment(passwordValidationError, HasAlignment.ALIGN_CENTER);
    vPanel.setCellHorizontalAlignment(mailPasswordError, HasAlignment.ALIGN_CENTER);
    vPanel.setCellHorizontalAlignment(mailError, HasAlignment.ALIGN_CENTER);
    vPanel.setCellHorizontalAlignment(mailTestError, HasAlignment.ALIGN_CENTER);
    vPanel.setCellHorizontalAlignment(mailTestOK, HasAlignment.ALIGN_CENTER);

    userId.addStyleName("okm-NoWrap");
    userName.addStyleName("okm-NoWrap");
    userPassword.addStyleName("okm-NoWrap");
    userMail.addStyleName("okm-NoWrap");
    mailHost.addStyleName("okm-NoWrap");
    mailUser.addStyleName("okm-NoWrap");
    mailPassword.addStyleName("okm-NoWrap");
    mailFolder.addStyleName("okm-NoWrap");
    userPasswordText.setStyleName("okm-Input");
    userPasswordTextVerify.setStyleName("okm-Input");
    userMailText.setStyleName("okm-Input");
    mailProtocolList.setStyleName("okm-Input");
    mailHostText.setStyleName("okm-Input");
    mailUserText.setStyleName("okm-Input");
    mailUserPasswordText.setStyleName("okm-Input");
    mailFolderText.setStyleName("okm-Input");
    passwordError.setStyleName("okm-Input-Error");
    passwordValidationError.setStyleName("okm-Input-Error");
    mailPasswordError.setStyleName("okm-Input-Error");
    mailError.setStyleName("okm-Input-Error");
    mailTestError.setStyleName("okm-Input-Error");
    mailTestOK.setStyleName("okm-Input-Ok");
    acceptButton.setStyleName("okm-YesButton");
    cancelButton.setStyleName("okm-NoButton");
    deleteButton.setStyleName("okm-DeleteButton");
    testButton.setStyleName("okm-YesButton");

    super.hide();
    setWidget(vPanel);
}

From source file:com.ponysdk.core.terminal.ui.converter.GWTConverter.java

License:Apache License

public static final VerticalAlignmentConstant asVerticalAlignmentConstant(final byte byteValue) {
    final PVerticalAlignment alignment = PVerticalAlignment.fromRawValue(byteValue);
    if (PVerticalAlignment.ALIGN_TOP == alignment)
        return HasVerticalAlignment.ALIGN_TOP;
    else if (PVerticalAlignment.ALIGN_MIDDLE == alignment)
        return HasVerticalAlignment.ALIGN_MIDDLE;
    else if (PVerticalAlignment.ALIGN_BOTTOM == alignment)
        return HasVerticalAlignment.ALIGN_BOTTOM;
    else/*from   w ww . j a  va2  s  .c o m*/
        throw new IllegalArgumentException("Undefined alignement : " + byteValue);
}

From source file:com.ponysdk.ui.terminal.basic.PVerticalAlignment.java

License:Apache License

public VerticalAlignmentConstant asVerticalAlignmentConstant() {
    switch (this) {
    case ALIGN_TOP:
        return HasVerticalAlignment.ALIGN_TOP;
    case ALIGN_MIDDLE:
        return HasVerticalAlignment.ALIGN_MIDDLE;
    case ALIGN_BOTTOM:
        return HasVerticalAlignment.ALIGN_BOTTOM;
    default://w  ww .  j a v  a2s  .co m
        throw new IllegalArgumentException("Undefined alignement");
    }
}

From source file:com.ponysdk.ui.terminal.ui.PTCellPanel.java

License:Apache License

@Override
public void update(final PTInstruction update, final UIService uiService) {

    if (update.containsKey(PROPERTY.CELL_HORIZONTAL_ALIGNMENT)) {
        final PHorizontalAlignment horizontalAlignment = PHorizontalAlignment.values()[update
                .getInt(PROPERTY.CELL_HORIZONTAL_ALIGNMENT)];
        final Widget w = asWidget(update.getLong(PROPERTY.CELL), uiService);
        switch (horizontalAlignment) {
        case ALIGN_LEFT:
            uiObject.setCellHorizontalAlignment(w, HasHorizontalAlignment.ALIGN_LEFT);
            break;
        case ALIGN_CENTER:
            uiObject.setCellHorizontalAlignment(w, HasHorizontalAlignment.ALIGN_CENTER);
            break;
        case ALIGN_RIGHT:
            uiObject.setCellHorizontalAlignment(w, HasHorizontalAlignment.ALIGN_RIGHT);
            break;
        default://from w  w w  .j a  v a 2s  .c o  m
            break;
        }
    } else if (update.containsKey(PROPERTY.CELL_VERTICAL_ALIGNMENT)) {
        final PVerticalAlignment verticalAlignment = PVerticalAlignment.values()[update
                .getInt(PROPERTY.CELL_VERTICAL_ALIGNMENT)];
        final Widget w = asWidget(update.getLong(PROPERTY.CELL), uiService);
        switch (verticalAlignment) {
        case ALIGN_TOP:
            uiObject.setCellVerticalAlignment(w, HasVerticalAlignment.ALIGN_TOP);
            break;
        case ALIGN_MIDDLE:
            uiObject.setCellVerticalAlignment(w, HasVerticalAlignment.ALIGN_MIDDLE);
            break;
        case ALIGN_BOTTOM:
            uiObject.setCellVerticalAlignment(w, HasVerticalAlignment.ALIGN_BOTTOM);
            break;
        default:
            break;
        }
    } else if (update.containsKey(PROPERTY.CELL_WIDTH)) {
        uiObject.setCellWidth(asWidget(update.getLong(PROPERTY.CELL), uiService),
                update.get(PROPERTY.CELL_WIDTH).isString().stringValue());
    } else if (update.containsKey(PROPERTY.CELL_HEIGHT)) {
        uiObject.setCellHeight(asWidget(update.getLong(PROPERTY.CELL), uiService),
                update.get(PROPERTY.CELL_HEIGHT).isString().stringValue());
    } else {
        super.update(update, uiService);
    }
}

From source file:com.ponysdk.ui.terminal.ui.PTHorizontalPanel.java

License:Apache License

@Override
public void update(final PTInstruction update, final UIService uiService) {
    if (update.containsKey(PROPERTY.BORDER_WIDTH)) {
        uiObject.setBorderWidth(update.getInt(PROPERTY.BORDER_WIDTH));
    } else if (update.containsKey(PROPERTY.SPACING)) {
        uiObject.setSpacing(update.getInt(PROPERTY.SPACING));
    } else if (update.containsKey(PROPERTY.HORIZONTAL_ALIGNMENT)) {
        final PHorizontalAlignment horizontalAlignment = PHorizontalAlignment.values()[update
                .getInt(PROPERTY.HORIZONTAL_ALIGNMENT)];
        switch (horizontalAlignment) {
        case ALIGN_LEFT:
            uiObject.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
            break;
        case ALIGN_CENTER:
            uiObject.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
            break;
        case ALIGN_RIGHT:
            uiObject.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT);
            break;
        default://from   www.  j av  a  2  s . co m
            break;
        }
    } else if (update.containsKey(PROPERTY.VERTICAL_ALIGNMENT)) {
        final PVerticalAlignment verticalAlignment = PVerticalAlignment.values()[update
                .getInt(PROPERTY.VERTICAL_ALIGNMENT)];
        switch (verticalAlignment) {
        case ALIGN_TOP:
            uiObject.setVerticalAlignment(HasVerticalAlignment.ALIGN_TOP);
            break;
        case ALIGN_MIDDLE:
            uiObject.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
            break;
        case ALIGN_BOTTOM:
            uiObject.setVerticalAlignment(HasVerticalAlignment.ALIGN_BOTTOM);
            break;
        default:
            break;
        }
    } else {
        super.update(update, uiService);
    }

}

From source file:com.ponysdk.ui.terminal.ui.PTVerticalPanel.java

License:Apache License

@Override
public void update(final PTInstruction update, final UIService uiService) {
    if (update.containsKey(PROPERTY.BORDER_WIDTH)) {
        uiObject.setBorderWidth(update.getInt(PROPERTY.BORDER_WIDTH));
    } else if (update.containsKey(PROPERTY.SPACING)) {
        uiObject.setSpacing(update.getInt(PROPERTY.SPACING));
    } else if (update.containsKey(PROPERTY.HORIZONTAL_ALIGNMENT)) {
        final PHorizontalAlignment horizontalAlignment = PHorizontalAlignment.values()[update
                .getInt(PROPERTY.HORIZONTAL_ALIGNMENT)];
        switch (horizontalAlignment) {
        case ALIGN_LEFT:
            uiObject.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
            break;
        case ALIGN_CENTER:
            uiObject.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
            break;
        case ALIGN_RIGHT:
            uiObject.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT);
            break;
        default:/*  w  w  w . j ava2 s . c om*/
            break;
        }
    } else if (update.containsKey(PROPERTY.VERTICAL_ALIGNMENT)) {
        final PVerticalAlignment verticalAlignment = PVerticalAlignment.values()[update
                .getInt(PROPERTY.VERTICAL_ALIGNMENT)];
        switch (verticalAlignment) {
        case ALIGN_TOP:
            uiObject.setVerticalAlignment(HasVerticalAlignment.ALIGN_TOP);
            break;
        case ALIGN_MIDDLE:
            uiObject.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
            break;
        case ALIGN_BOTTOM:
            uiObject.setVerticalAlignment(HasVerticalAlignment.ALIGN_BOTTOM);
            break;
        default:
            break;
        }
    } else {
        super.update(update, uiService);
    }
}