Example usage for com.vaadin.ui Label setDescription

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

Introduction

In this page you can find the example usage for com.vaadin.ui Label 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 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);// ww w  . java  2s .com
        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 av a 2 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  .  c o  m
 * @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.escidoc.browser.elabsmodul.views.helpers.ResourcePropertiesViewHelper.java

License:Open Source License

public Panel generatePropertiesView() {
    // Item title
    String resourceType = resourceProxy.getType().toString();
    if (this.type != null && this.type.length() > 0) {
        resourceType = this.type;
    }//from  w ww  .j a v  a  2  s. c  om
    final Label titleLabel = new Label(resourceType.substring(0, 1).toUpperCase()
            + resourceType.substring(1).toLowerCase() + ": " + resourceProxy.getName());
    titleLabel.setDescription("header");
    titleLabel.setStyleName("h2 fullwidth");

    // HR Ruler
    final Label descRuler = new Label("<hr/>", Label.CONTENT_RAW);
    descRuler.setStyleName("hr");

    // ItemProperties View
    final CssLayout propertiesView = new CssLayout();
    propertiesView.setWidth("100%");
    propertiesView.setHeight("100%");

    final Label descMetadata1 = new Label("ID: " + resourceProxy.getId());
    final Label descMetadata2 = new Label(
            LAST_MODIFIED_BY + " " + resourceProxy.getModifier() + " on " + resourceProxy.getModifiedOn(),
            Label.CONTENT_XHTML);

    final Panel pnlPropertiesLeft = buildLeftPanel();
    pnlPropertiesLeft.setWidth("40%");
    pnlPropertiesLeft.setHeight("20px");
    pnlPropertiesLeft.setStyleName(FLOAT_LEFT);
    pnlPropertiesLeft.addStyleName(Runo.PANEL_LIGHT);
    pnlPropertiesLeft.getLayout().setMargin(false);
    pnlPropertiesLeft.addComponent(descMetadata1);

    final Panel pnlPropertiesRight = buildRightPanel();
    pnlPropertiesRight.setWidth("60%");
    pnlPropertiesRight.setHeight("20px");
    pnlPropertiesRight.setStyleName(FLOAT_RIGHT);
    pnlPropertiesRight.addStyleName(Runo.PANEL_LIGHT);
    pnlPropertiesRight.getLayout().setMargin(false);
    pnlPropertiesRight.addComponent(descMetadata2);

    propertiesView.addComponent(pnlPropertiesLeft);
    propertiesView.addComponent(pnlPropertiesRight);

    Panel viewHandler = buildmainView();

    new BreadCrumbMenu(viewHandler, breadCrumbModel, serviceLocation);

    viewHandler.addComponent(titleLabel);
    viewHandler.addComponent(descRuler);
    viewHandler.addComponent(propertiesView);

    return viewHandler;
}

From source file:org.escidoc.browser.ui.maincontent.ContainerView.java

License:Open Source License

/**
 * Building the Header Element that shows the title of the Container
 *//*from w w  w  . j  a v  a  2  s.  c om*/
private void bindNameToHeader(CssLayout cssLayout) {
    final Label headerContext = new Label(ViewConstants.RESOURCE_NAME_CONTAINER + resourceProxy.getName());
    headerContext.setStyleName("h1 fullwidth floatleft");
    headerContext.setWidth("80%");
    headerContext.setDescription(ViewConstants.DESC_HEADER);
    cssLayout.addComponent(headerContext);
}

From source file:org.escidoc.browser.ui.maincontent.ContextView.java

License:Open Source License

private VerticalLayout bindNameToHeader() {
    headerLayout = new VerticalLayout();
    headerLayout.setMargin(false);//from  w  ww.j  a va 2s  . co  m
    headerLayout.setWidth("100%");
    final Label headerContext = new Label(ViewConstants.RESOURCE_NAME_CONTEXT + resourceProxy.getName());
    headerContext.setStyleName("h1 fullwidth");
    headerContext.setDescription(ViewConstants.RESOURCE_NAME_CONTEXT);
    headerLayout.addComponent(headerContext);
    return headerLayout;
}

From source file:org.escidoc.browser.ui.maincontent.FolderView.java

License:Open Source License

private VerticalLayout bindNameToHeader() {
    VerticalLayout headerLayout = new VerticalLayout();
    headerLayout.setMargin(false);//from  w ww  .  ja va  2s .c  om
    headerLayout.setWidth("100%");
    final Label headerContext = new Label(ViewConstants.RESOURCE_NAME_CONTEXT + resourceProxy.getName());
    headerContext.setStyleName("h1 fullwidth");
    headerContext.setDescription(ViewConstants.RESOURCE_NAME_CONTEXT);
    headerLayout.addComponent(headerContext);
    return headerLayout;
}

From source file:org.escidoc.browser.ui.maincontent.OrgUnitView.java

License:Open Source License

private VerticalLayout bindNameToHeader() {
    VerticalLayout headerLayout = new VerticalLayout();
    headerLayout.setMargin(false);//from   w w w  .j  av a2 s.co m
    headerLayout.setWidth("100%");
    final Label headerContext = new Label("Organizational Unit: " + resourceProxy.getName());
    headerContext.setStyleName("h1 fullwidth");
    headerContext.setDescription("Organizational Unit");
    headerLayout.addComponent(headerContext);
    return headerLayout;
}

From source file:org.opennms.features.topology.plugins.topo.bsm.info.SimulationModeEnabledPanelItem.java

License:Open Source License

@Override
public Component getComponent(GraphContainer container) {
    Label label = new Label("Simulation Mode Enabled");
    label.setDescription("Simulation Mode is enabled");
    label.setIcon(FontAwesome.EXCLAMATION_TRIANGLE);
    label.addStyleName("warning");

    HorizontalLayout layout = new HorizontalLayout();
    layout.addComponent(label);//from   ww  w. jav  a2 s .c  o  m
    layout.addStyleName("simulation");
    return layout;
}

From source file:org.opennms.features.topology.plugins.topo.bsm.info.SimulationModeEnabledPanelItemProvider.java

License:Open Source License

private Component createComponent() {
    Label label = new Label("Simulation Mode Enabled");
    label.setDescription("Simulation Mode is enabled");
    label.setIcon(FontAwesome.EXCLAMATION_TRIANGLE);
    label.addStyleName("warning");

    HorizontalLayout layout = new HorizontalLayout();
    layout.addComponent(label);/*from   w ww  .j  a va2s  .com*/
    layout.addStyleName("simulation");
    return layout;
}