Example usage for com.vaadin.ui Alignment MIDDLE_RIGHT

List of usage examples for com.vaadin.ui Alignment MIDDLE_RIGHT

Introduction

In this page you can find the example usage for com.vaadin.ui Alignment MIDDLE_RIGHT.

Prototype

Alignment MIDDLE_RIGHT

To view the source code for com.vaadin.ui Alignment MIDDLE_RIGHT.

Click Source Link

Usage

From source file:org.eclipse.skalli.view.component.Tray.java

License:Open Source License

private ComponentContainer createContent(String caption, String description, ThemeResource icon,
        boolean isRequired) {
    CssLayout layout = new CssLayout();
    layout.setStyleName(STYLE_TRAY);//from  w w  w.  j  av  a 2  s . c om
    layout.setMargin(true);

    HorizontalLayout header = new HorizontalLayout();
    header.setSpacing(true);
    header.setStyleName(STYLE_TRAY_HEADER);
    header.setWidth("100%");

    this.icon = icon;
    trayIcon = new Embedded(null, icon);
    trayIcon.setStyleName(STYLE_TRAY_HEADER_ICON);
    header.addComponent(trayIcon);
    header.setComponentAlignment(trayIcon, Alignment.MIDDLE_LEFT);
    header.setExpandRatio(trayIcon, 0);

    Label captionLabel = new Label(StringEscapeUtils.escapeHtml(caption), Label.CONTENT_XHTML);
    captionLabel.setStyleName(STYLE_TRAY_HEADER_LABEL);
    header.addComponent(captionLabel);
    header.setExpandRatio(captionLabel, 1);
    header.setComponentAlignment(captionLabel, Alignment.MIDDLE_LEFT);

    this.isRequired = isRequired;
    if (!isRequired) {
        activator = new NativeButton("", new ToggleEnabledListener());
        header.addComponent(activator);
        header.setExpandRatio(activator, 0);
        header.setComponentAlignment(activator, Alignment.MIDDLE_RIGHT);
    }

    opener = new NativeButton("", new ToggleVisibleListener());
    header.addComponent(opener);
    header.setExpandRatio(opener, 0);
    header.setComponentAlignment(opener, Alignment.MIDDLE_RIGHT);

    layout.addComponent(header);

    CssLayout content = new CssLayout();
    Label descriptionLabel = new Label(HtmlUtils.clean(description), Label.CONTENT_XHTML);
    descriptionLabel.setStyleName(STYLE_TRAY_DESCRIPTION);
    content.addComponent(descriptionLabel);

    layout.addComponent(content);
    setCompositionRoot(layout);
    return content;
}

From source file:org.eclipse.skalli.view.internal.window.ProjectEditPanelEntry.java

License:Open Source License

@SuppressWarnings("deprecation")
private void layoutLinkButton(Button button, HorizontalLayout layout, ClickListener listener) {
    button.setStyle(Button.STYLE_LINK);
    button.addListener(listener);/* w ww .j  a  v a  2s.  c  om*/
    layout.addComponent(button);
    layout.setExpandRatio(button, 0);
    layout.setComponentAlignment(button, Alignment.MIDDLE_RIGHT);
}

From source file:org.eclipse.skalli.view.internal.window.ProjectEditPanelEntry.java

License:Open Source License

private void layoutIconButton(Button button, HorizontalLayout layout, ClickListener listener) {
    button.addListener(listener);//from www .  j a  v a2 s  . c  om
    layout.addComponent(button);
    layout.setExpandRatio(button, 0);
    layout.setComponentAlignment(button, Alignment.MIDDLE_RIGHT);
}

From source file:org.escidoc.browser.elabsmodul.views.helpers.LabsLayoutHelper.java

License:Open Source License

public static HorizontalLayout createHorizontalLayoutWithELabsLabelAndLabelData(final String labelTxt,
        Property dataProperty, boolean required) {
    Preconditions.checkNotNull(labelTxt, "Label is null");
    Preconditions.checkNotNull(dataProperty, "DataSource is null");
    HorizontalLayout horizontalLayout = new HorizontalLayout();
    horizontalLayout.setSizeUndefined();
    horizontalLayout.setDescription(USER_DESCR_ON_HOR_LAYOUT_TO_EDIT);
    horizontalLayout.setEnabled(true);//from   ww  w  . j  a  v a 2  s  . c o  m
    horizontalLayout.setSpacing(true);
    horizontalLayout.setHeight(HOR_PANEL_HEIGHT);
    Label label = new Label();
    label.setWidth(LABEL_WIDTH);
    label.setValue(DIV_ALIGN_RIGHT + (required ? ELabsViewContants.REQUIRED_SIGN : "") + labelTxt + DIV_END);
    label.setContentMode(Label.CONTENT_XHTML);
    label.setDescription(USER_DESCR_ON_LABEL_TO_EDIT);
    Label textLabel = new Label(dataProperty);
    textLabel.setWidth(TEXT_WIDTH);
    textLabel.setDescription(USER_DESCR_ON_LABEL_TO_EDIT);
    textLabel.setStyleName(STYLE_ELABS_TEXT_AS_LABEL);
    horizontalLayout.setStyleName(STYLE_ELABS_HOR_PANEL);
    horizontalLayout.addComponent(label, 0);
    horizontalLayout.addComponent(textLabel, 1);
    horizontalLayout.setComponentAlignment(label, Alignment.MIDDLE_LEFT);
    horizontalLayout.setComponentAlignment(textLabel, Alignment.MIDDLE_RIGHT);
    return horizontalLayout;
}

From source file:org.escidoc.browser.elabsmodul.views.helpers.LabsLayoutHelper.java

License:Open Source License

public static HorizontalLayout createHorizontalLayoutWithELabsLabelAndStaticComboData(final String labelTxt,
        String value, boolean required) {
    Preconditions.checkNotNull(labelTxt, "Label is null");
    HorizontalLayout horizontalLayout = new HorizontalLayout();
    horizontalLayout.setSizeUndefined();
    horizontalLayout.setDescription(USER_DESCR_ON_HOR_LAYOUT_TO_EDIT);
    horizontalLayout.setEnabled(true);//from  w  w  w.j ava  2s .c om
    horizontalLayout.setSpacing(true);
    horizontalLayout.setHeight(HOR_PANEL_HEIGHT);
    Label label = new Label();
    label.setWidth(LABEL_WIDTH);
    label.setValue(DIV_ALIGN_RIGHT + (required ? ELabsViewContants.REQUIRED_SIGN : "") + labelTxt + DIV_END);
    label.setContentMode(Label.CONTENT_XHTML);
    label.setDescription(USER_DESCR_ON_LABEL_TO_EDIT);
    Label textLabel = new Label(value);
    textLabel.setWidth(TEXT_WIDTH);
    textLabel.setDescription(USER_DESCR_ON_LABEL_TO_EDIT);
    textLabel.setStyleName(STYLE_ELABS_TEXT_AS_LABEL);
    horizontalLayout.setStyleName(STYLE_ELABS_HOR_PANEL);
    horizontalLayout.addComponent(label, 0);
    horizontalLayout.addComponent(textLabel, 1);
    horizontalLayout.setComponentAlignment(label, Alignment.MIDDLE_LEFT);
    horizontalLayout.setComponentAlignment(textLabel, Alignment.MIDDLE_RIGHT);
    return horizontalLayout;
}

From source file:org.escidoc.browser.elabsmodul.views.helpers.LabsLayoutHelper.java

License:Open Source License

public static HorizontalLayout createHorizontalLayoutWithELabsLabelAndLabelComplexData(final String labelTxt,
        String dataTxt, boolean required) {
    Preconditions.checkNotNull(labelTxt, "Label is null");
    HorizontalLayout horizontalLayout = new HorizontalLayout();
    horizontalLayout.setSizeUndefined();
    horizontalLayout.setDescription(USER_DESCR_ON_HOR_LAYOUT_TO_EDIT);
    horizontalLayout.setEnabled(true);//w w w  .  j  av  a 2s  .c o m
    horizontalLayout.setSpacing(true);
    horizontalLayout.setHeight(HOR_PANEL_HEIGHT);
    Label label = new Label();
    label.setWidth(LABEL_WIDTH);
    label.setValue(DIV_ALIGN_RIGHT + (required ? ELabsViewContants.REQUIRED_SIGN : "") + labelTxt + DIV_END);
    label.setContentMode(Label.CONTENT_XHTML);
    label.setDescription(USER_DESCR_ON_LABEL_TO_EDIT);
    Label textLabel = new Label(dataTxt);
    textLabel.setWidth(TEXT_WIDTH);
    textLabel.setDescription(USER_DESCR_ON_LABEL_TO_EDIT);
    textLabel.setStyleName(STYLE_ELABS_TEXT_AS_LABEL);
    horizontalLayout.setStyleName(STYLE_ELABS_HOR_PANEL);
    horizontalLayout.addComponent(label, 0);
    horizontalLayout.addComponent(textLabel, 1);
    horizontalLayout.setComponentAlignment(label, Alignment.MIDDLE_LEFT);
    horizontalLayout.setComponentAlignment(textLabel, Alignment.MIDDLE_RIGHT);
    return horizontalLayout;
}

From source file:org.escidoc.browser.elabsmodul.views.helpers.LabsLayoutHelper.java

License:Open Source License

public static HorizontalLayout createHorizontalLayoutWithELabsLabelAndCheckBoxData(final String labelTxt,
        final String checkBoxDescription, Property dataProperty, boolean required) {
    final HorizontalLayout horizontalLayout = new HorizontalLayout();
    horizontalLayout.setSizeUndefined();
    horizontalLayout.setDescription(USER_DESCR_ON_HOR_LAYOUT_TO_EDIT);
    horizontalLayout.setEnabled(true);//w  ww.j  av a  2s .c  o m
    horizontalLayout.setSpacing(true);
    horizontalLayout.setHeight(HOR_PANEL_HEIGHT);
    horizontalLayout.setStyleName(STYLE_ELABS_HOR_PANEL);
    Label label = new Label();
    label.setWidth(LABEL_WIDTH);
    label.setValue(DIV_ALIGN_RIGHT + (required ? ELabsViewContants.REQUIRED_SIGN : "") + labelTxt + DIV_END);
    label.setContentMode(Label.CONTENT_XHTML);
    label.setDescription(USER_DESCR_ON_LABEL_TO_EDIT);
    final CheckBox checkBox = new CheckBox(checkBoxDescription, dataProperty);
    checkBox.setEnabled(true);
    checkBox.setVisible(true);
    checkBox.setWidth(TEXT_WIDTH);
    checkBox.setStyleName(STYLE_ELABS_TEXT_AS_LABEL);
    checkBox.setDescription(USER_DESCR_ON_LABEL_TO_EDIT);
    horizontalLayout.addComponent(label, 0);
    horizontalLayout.addComponent(checkBox, 1);
    horizontalLayout.setComponentAlignment(label, Alignment.MIDDLE_LEFT);
    horizontalLayout.setComponentAlignment(checkBox, Alignment.MIDDLE_RIGHT);
    return horizontalLayout;
}

From source file:org.escidoc.browser.elabsmodul.views.listeners.LabsClientViewEventHandler.java

License:Open Source License

@Override
public void layoutClick(LayoutClickEvent event) {
    final Component component = event.getComponent();
    final Component childComponent = event.getChildComponent();

    synchronized (component) {
        if (!(component instanceof VerticalLayout)) {
            LOG.error("Wrong EventHandler function!");
            return;
        }//from  w  w  w .  ja  v a 2 s.  c o  m
        Component modifiedComponent = this.containerPanel.getModifiedComponent();
        if (event.getButton() == ItemClickEvent.BUTTON_MIDDLE) {
            return;
        }
        if (modifiedComponent != null
                && (childComponent == null || !modifiedComponent.equals(childComponent))) {
            Component dataComponent = ((HorizontalLayout) modifiedComponent).getComponent(1);

            if (!(dataComponent instanceof TextField) && !(dataComponent instanceof ComboBox)) {
                LOG.error("ModifiedComponent's dataComponent should be Text or Combo element!");
                return;
            }
            LabsLayoutHelper.switchToLabelFromEditedField((HorizontalLayout) modifiedComponent);
            this.containerPanel.setModifiedComponent(null);
        }
        // else {
        // LOG.debug("Nothing was modified");
        // }

        if (childComponent instanceof HorizontalLayout) {

            if (!registeredComponents.contains(childComponent)) {
                return;
            }

            final Component labelComponent = ((HorizontalLayout) childComponent).getComponent(0);
            final Component dataComponent = ((HorizontalLayout) childComponent).getComponent(1);

            if (dataComponent instanceof AbstractComponent) {
                containerAction.showButtonLayout();
            }

            if (dataComponent instanceof Label) {
                if (this.containerPanel.getModifiedComponent() != null) {
                    LOG.error("LastModifiedComponent must be saved already at this point!!!");
                    return;
                }
                this.containerPanel.setModifiedComponent(childComponent);

                final String queryTextforFileFormat = ELabsViewContants.DIV_ALIGN_RIGHT
                        + ELabsViewContants.L_INSTRUMENT_FILE_FORMAT + ELabsViewContants.DIV_END;
                final String queryTextforDuration = ELabsViewContants.DIV_ALIGN_RIGHT
                        + ELabsViewContants.REQUIRED_SIGN + ELabsViewContants.L_INVESTIGATION_DURATION
                        + ELabsViewContants.DIV_END;
                Component newComponent = null;
                if (queryTextforFileFormat.equals(((Label) labelComponent).getValue())
                        && ELabsCache.getFileFormats().isEmpty()) {
                    newComponent = LabsLayoutHelper.createStaticComboBoxFieldFromLabel(
                            ((Label) dataComponent).getPropertyDataSource());
                } else if (queryTextforFileFormat.equals(((Label) labelComponent).getValue())
                        && !ELabsCache.getFileFormats().isEmpty()) {
                    return;
                } else if (queryTextforDuration.equals(((Label) labelComponent).getValue())) {
                    this.containerPanel.setModifiedComponent(null);
                    return;
                } else {
                    newComponent = LabsLayoutHelper
                            .createTextFieldFromLabel(((Label) dataComponent).getPropertyDataSource());
                }
                ((HorizontalLayout) childComponent).replaceComponent(dataComponent, newComponent);
                ((HorizontalLayout) childComponent).setComponentAlignment(newComponent, Alignment.MIDDLE_RIGHT);
                ((Label) ((HorizontalLayout) childComponent).getComponent(0))
                        .setDescription(USER_DESCR_ON_LABEL_TO_SAVE);
                ((HorizontalLayout) childComponent).setDescription(USER_DESCR_ON_HOR_LAYOUT_TO_SAVE);
                this.mainComponent.setDescription(USER_DESCR_ON_FORM_LAYOUT_TO_SAVE);
            } else if (dataComponent instanceof ComboBox) {
                this.containerPanel.setModifiedComponent(childComponent);
            } else if (dataComponent instanceof TextField) {
                if (((HorizontalLayout) childComponent).getComponent(1).equals(dataComponent)) {
                    ((TextField) dataComponent).setDescription(USER_DESCR_ON_TEXTFIELD_TO_SAVE_OR_CANCEL);
                } else {
                    LabsLayoutHelper.switchToLabelFromEditedField((HorizontalLayout) childComponent);
                    this.containerPanel.setModifiedComponent(null);
                }
            } else if (dataComponent instanceof CheckBox) {
                final boolean value = (Boolean) ((CheckBox) dataComponent).getValue();
                ((CheckBox) dataComponent).setValue(!value);
            }
        }
    }
}

From source file:org.escidoc.browser.ui.GroupRolesView.java

License:Open Source License

private VerticalLayout addRoleExcludeInformation() {
    VerticalLayout rlexclude = new VerticalLayout();
    final Label content = new Label("<ul><li>The following Roles have been excluded from this view: <br />"
            + ViewConstants.roleExcludeList.toString() + "</li></ul>", Label.CONTENT_RAW);
    content.setWidth("300px");

    final PopupView popup = new PopupView("?", content);
    popup.setHideOnMouseOut(true);/*from w  ww.  j ava2s. c  om*/
    popup.addListener(new PopupVisibilityListener() {
        @Override
        public void popupVisibilityChange(PopupVisibilityEvent event) {
        }
    });

    popup.addStyleName("paddingright10");
    rlexclude.addComponent(popup);
    rlexclude.setComponentAlignment(popup, Alignment.MIDDLE_RIGHT);
    rlexclude.setMargin(true);
    return rlexclude;
}

From source file:org.escidoc.browser.ui.landingview.LandingViewImpl.java

License:Open Source License

private void addStartButton() {
    startButtonListener.setInputField(escidocServiceUrl);
    startButton.addListener(startButtonListener);
    startButton.setClickShortcut(KeyCode.ENTER);
    startButton.addStyleName("primary");
    horizontalLayout.addComponent(startButton);
    horizontalLayout.setComponentAlignment(startButton, Alignment.MIDDLE_RIGHT);
}