Example usage for com.vaadin.ui HorizontalLayout setStyleName

List of usage examples for com.vaadin.ui HorizontalLayout setStyleName

Introduction

In this page you can find the example usage for com.vaadin.ui HorizontalLayout setStyleName.

Prototype

@Override
    public void setStyleName(String style) 

Source Link

Usage

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

License:Open Source License

private void renderComboBoxes() {
    int size = comboBoxEntries.size();
    int last = size - 1;
    for (int i = 0; i <= last; ++i) {
        ComboBoxElement comboBoxEntry = comboBoxEntries.get(i);
        HorizontalLayout horLayout = new HorizontalLayout();
        horLayout.setStyleName(STYLE_LINE_LAYOUT);
        ComboBox comboBox = comboBoxEntry.comboBox;
        if (comboBox.getValue() == null) {
            comboBox.setEnabled(!readOnly);
        } else {/*from  w  w  w  . j a  v a2 s .c  om*/
            comboBox.setReadOnly(readOnly);
        }
        horLayout.addComponent(comboBox);
        if (!readOnly) {
            if (size > 1) {
                Button b = createRemoveButton();
                comboBoxEntry.removeButton = b;
                horLayout.addComponent(b);
            }
            if (size < maxSize && i == last) {
                horLayout.addComponent(createAddButton());
            }
        }
        layout.addComponent(horLayout);
    }
}

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 ww.java2  s.  c o m*/
    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("serial")
private ComponentContainer createTray() {
    CssLayout layout = new CssLayout();
    layout.setStyleName(STYLE_TRAY);// w  w w .j  ava 2s .co  m
    layout.setMargin(true);

    HorizontalLayout header = new HorizontalLayout();
    header.setSpacing(true);
    header.setStyleName(STYLE_TRAY_HEADER);
    header.setWidth("100%"); //$NON-NLS-1$

    trayIcon = new Embedded();
    trayIcon.setStyleName(STYLE_TRAY_HEADER_ICON);

    final String icon = formService.getIconPath();
    if (StringUtils.isNotBlank(icon)) {
        trayIcon.setSource(new StreamResource(new ExtensionStreamSource(formService.getClass(), icon),
                FilenameUtils.getName(icon), application));
    }
    header.addComponent(trayIcon);
    header.setComponentAlignment(trayIcon, Alignment.MIDDLE_LEFT);
    header.setExpandRatio(trayIcon, 0);

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

    editButton = new Button();
    layoutLinkButton(editButton, header, new ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            switch (state) {
            case DISABLED:
                setState(TrayState.EDITABLE_VISIBLE);
                break;
            case INHERITED_VISIBLE:
                setState(TrayState.EDITABLE_VISIBLE);
                break;
            case INHERITED_INVISIBLE:
                setState(TrayState.EDITABLE_VISIBLE);
                break;
            }
        }
    });

    inheritButton = new Button();
    layoutLinkButton(inheritButton, header, new ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            form.commit();
            switch (state) {
            case DISABLED:
                setState(TrayState.INHERITED_VISIBLE);
                break;
            case EDITABLE_VISIBLE:
                setState(TrayState.INHERITED_VISIBLE);
                break;
            case EDITABLE_INVISIBLE:
                setState(TrayState.INHERITED_VISIBLE);
                break;
            }
        }
    });

    disableButton = new Button();
    layoutLinkButton(disableButton, header, new ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            form.commit();
            switch (state) {
            case EDITABLE_INVISIBLE:
                setState(TrayState.DISABLED);
                break;
            case EDITABLE_VISIBLE:
                setState(TrayState.DISABLED);
                break;
            case INHERITED_INVISIBLE:
                setState(TrayState.DISABLED);
                break;
            case INHERITED_VISIBLE:
                setState(TrayState.DISABLED);
                break;
            }
        }
    });

    visibleButton = new NativeButton();
    layoutIconButton(visibleButton, header, new ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            switch (state) {
            case EDITABLE_INVISIBLE:
                setState(TrayState.EDITABLE_VISIBLE);
                break;
            case EDITABLE_VISIBLE:
                setState(TrayState.EDITABLE_INVISIBLE);
                break;
            case INHERITED_INVISIBLE:
                setState(TrayState.INHERITED_VISIBLE);
                break;
            case INHERITED_VISIBLE:
                setState(TrayState.INHERITED_INVISIBLE);
                break;
            }
        }
    });

    layout.addComponent(header);

    CssLayout content = new CssLayout();
    Label descriptionLabel = new Label(extensionService.getDescription(), Label.CONTENT_XHTML);
    descriptionLabel.setStyleName(STYLE_TRAY_DESCRIPTION);
    content.addComponent(descriptionLabel);

    layout.addComponent(content);
    return layout;
}

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 va  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 a  v a  2s.com*/
    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);// ww w.  j  a va 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(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 createHorizontalLayoutWithELabsLabelAndRelatedDataForRig(final String labelTxt,
        Property dataProperty, RigBean rigBean, final IRigAction controller, LabsRigTableHelper helper,
        boolean required) {
    synchronized (LOCK_1) {
        Preconditions.checkNotNull(labelTxt, "Label is null");
        Preconditions.checkNotNull(dataProperty, "DataSource is null");
        Preconditions.checkNotNull(rigBean, "RigBean is null");
        Preconditions.checkNotNull(helper, "Helper is null");
        Preconditions.checkNotNull(controller, "Controller is null");
        HorizontalLayout horizontalLayout = new HorizontalLayout();
        horizontalLayout.setSizeUndefined();
        horizontalLayout.setEnabled(true);
        horizontalLayout.setSpacing(true);
        horizontalLayout.setStyleName(STYLE_ELABS_HOR_PANEL_FOR_TABLE);
        Label label = new Label();
        label.setWidth(LABEL_WIDTH);//w ww.j a va 2 s .  c  o m
        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.setStyleName(STYLE_ELABS_HOR_PANEL);
        horizontalLayout.addComponent(label, 0);
        horizontalLayout.addComponent(helper.createTableLayoutForRig(rigBean, controller), 1);
        horizontalLayout.setComponentAlignment(label, Alignment.TOP_LEFT);
        return horizontalLayout;
    }
}

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

License:Open Source License

public static HorizontalLayout createHorizontalLayoutWithPublicationDataForStudy(final String labelTxt,
        Property dataProperty, boolean isMotNotResPublication, LabsStudyTableHelper helper, boolean required) {
    synchronized (LOCK_2) {
        Preconditions.checkNotNull(labelTxt, "Label is null");
        Preconditions.checkNotNull(dataProperty, "DataSource is null");
        Preconditions.checkNotNull(helper, "Helper is null");
        HorizontalLayout horizontalLayout = new HorizontalLayout();
        horizontalLayout.setSizeUndefined();
        horizontalLayout.setEnabled(true);
        horizontalLayout.setSpacing(true);
        horizontalLayout.setStyleName(STYLE_ELABS_HOR_PANEL_FOR_TABLE);
        Label label = new Label();
        label.setWidth(LABEL_WIDTH);/*from   ww  w . j  a v  a2 s.  c  om*/
        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.setStyleName(STYLE_ELABS_HOR_PANEL);
        horizontalLayout.addComponent(label, 0);
        if (isMotNotResPublication) {
            horizontalLayout.addComponent(helper.createTableLayoutForMotPublications(), 1);
        } else {
            horizontalLayout.addComponent(helper.createTableLayoutForResPublications(), 1);
        }
        horizontalLayout.setComponentAlignment(label, Alignment.TOP_LEFT);
        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);/*from  w w  w .j  a  v a2  s.  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.ui.mainpage.Footer.java

License:Open Source License

private void buildView(final EscidocServiceLocation serviceLocation) {
    Label lblBaseUrl = new Label(ViewConstants.PRODUCT_NAME + ViewConstants.VERSION + " on "
            + serviceLocation.getEscidocUri().toString() + "", Label.CONTENT_RAW);
    footerLayout.addComponent(lblBaseUrl);
    footerLayout.setExpandRatio(lblBaseUrl, 1f);

    HorizontalLayout hl = new HorizontalLayout();
    hl.setWidth("150px");
    hl.setStyleName("floatright");

    hl.setMargin(false);//w w  w .  j  a v  a 2 s .co  m

    final Button btnChange = new Button(ViewConstants.CHANGE, new Button.ClickListener() {
        @Override
        public void buttonClick(final ClickEvent event) {
            footerLayout.getApplication().close();
        }
    });
    btnChange.setStyleName(Reindeer.BUTTON_LINK);
    hl.addComponent(btnChange);

    footerLayout.addComponent(hl);
    // footerLayout.setExpandRatio(hl, 0.1f);

}