Example usage for com.vaadin.ui HorizontalLayout setDescription

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

Introduction

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

Prototype

public void setDescription(String description) 

Source Link

Document

Sets the component's description.

Usage

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 w  w  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 ww w  . java2s.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(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);/*from ww  w . j a va 2 s.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(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);//from  www. ja  v a2  s  .c  om
    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.helpers.LabsLayoutHelper.java

License:Open Source License

/**
 * Returns with a label based on the edited field.
 * //from   w w  w. j a  v a 2  s  .com
 * @param property
 * @return boolean an element switch happened or not
 */
public static boolean switchToLabelFromEditedField(HorizontalLayout parentLayout) {
    Preconditions.checkNotNull(parentLayout, "ParentLayout on DynamicLayout is null");
    Component staticLabelComponent = null, dataComponent = null;
    try {
        staticLabelComponent = parentLayout.getComponent(0);
        dataComponent = parentLayout.getComponent(1);
    } catch (IndexOutOfBoundsException e) {
        LOG.error("This layout should contain only 2 components!");
        return false;
    }
    Property dataProperty = null;
    Label label = null;
    if (dataComponent instanceof TextField) {
        dataProperty = ((TextField) dataComponent).getPropertyDataSource();
        label = new Label(dataProperty);
    } else if (dataComponent instanceof ComboBox) {
        if (((ComboBox) dataComponent).getValue() instanceof String) {
            dataProperty = ((ComboBox) dataComponent).getPropertyDataSource();
            if (dataProperty == null) {
                label = new Label((String) ((ComboBox) dataComponent).getValue());
            } else {
                label = new Label(dataProperty);
            }
        } else if (((ComboBox) dataComponent).getValue() instanceof RigBean) {
            label = new Label(((RigBean) ((ComboBox) dataComponent).getValue()).getComplexId());
        } else if (((ComboBox) dataComponent).getValue() instanceof UserBean) {
            label = new Label(((UserBean) ((ComboBox) dataComponent).getValue()).getComplexId());
        } else if (((ComboBox) dataComponent).getValue() instanceof OrgUnitBean) {
            label = new Label(((OrgUnitBean) ((ComboBox) dataComponent).getValue()).getComplexId());
        } else if (((ComboBox) dataComponent).getValue() instanceof FileFormatBean) {
            label = new Label(((FileFormatBean) ((ComboBox) dataComponent).getValue()).getTitle());
        } else {
            LOG.error("Incorrect data type at the switch to label");
        }
    } else if (dataComponent instanceof Label) {
        label = (Label) dataComponent;
    } else if (dataComponent instanceof CheckBox || dataComponent instanceof VerticalLayout) {
        return true;
    }

    if (label == null) {
        LOG.debug("The wrong dataComponent is " + dataComponent.toString());
        return false;
    }
    label.setWidth(TEXT_WIDTH);
    label.setStyleName(STYLE_ELABS_TEXT_AS_LABEL);
    label.setDescription(USER_DESCR_ON_LABEL_TO_EDIT);
    parentLayout.replaceComponent(dataComponent, label);
    parentLayout.setComponentAlignment(label, Alignment.MIDDLE_LEFT);
    ((Label) staticLabelComponent).setDescription(USER_DESCR_ON_LABEL_TO_EDIT);
    parentLayout.setDescription(USER_DESCR_ON_HOR_LAYOUT_TO_EDIT);
    return true;
}

From source file:org.opennms.features.topology.app.internal.ui.LayoutHintComponent.java

License:Open Source License

public LayoutHintComponent(LayoutManager layoutManager, GraphContainer graphContainer) {
    this.layoutManager = layoutManager;

    final Label icon = new Label();
    icon.setIcon(FontAwesome.INFO_CIRCLE);
    final Label text = new Label("A manual layout exists for the current selection.");

    final HorizontalLayout layout = new HorizontalLayout();
    layout.addComponent(icon);/*from  www .ja va  2 s.co  m*/
    layout.addComponent(text);
    layout.setDescription("Click to apply the manual layout");
    layout.addLayoutClickListener(
            (event) -> graphContainer.setLayoutAlgorithm(new ManualLayoutAlgorithm(layoutManager)));
    layout.setSpacing(true);
    setCompositionRoot(layout);
}