List of usage examples for com.vaadin.ui Label setWidth
@Override public void setWidth(String width)
From source file:org.escidoc.browser.controller.ContentModelView.java
License:Open Source License
private HorizontalLayout bindProperties() { HorizontalLayout hlProperties = new HorizontalLayout(); hlProperties.setWidth("100%"); VerticalLayout vlLeft = new VerticalLayout(); VerticalLayout vlRight = new VerticalLayout(); final Label descMetadata1 = new Label("ID: " + resourceProxy.getId()); vlLeft.addComponent(descMetadata1);// w w w . j a v a2s .c om // RIGHT SIDE final Label descMetadata2 = new Label(ViewConstants.CREATED_BY + " " + resourceProxy.getCreator() + " on " + resourceProxy.getCreatedOn() + "<br/>", Label.CONTENT_XHTML); descMetadata2.setStyleName("floatright columnheight50"); descMetadata2.setWidth("65%"); vlRight.addComponent(descMetadata2); hlProperties.addComponent(vlLeft); hlProperties.setExpandRatio(vlLeft, 0.4f); hlProperties.addComponent(vlRight); hlProperties.setExpandRatio(vlRight, 0.6f); return hlProperties; }
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);// ww w .ja 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 ww w . j ava2 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(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 . ja v a2s. co 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); label.setValue(// w w w. ja v a2 s . c om 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); label.setValue(/*from www. j a v a2s. c om*/ 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 .ja va2 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. * /*w ww .jav a 2s . co 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.LabsLayoutHelper.java
License:Open Source License
public static HorizontalLayout createButtonLayout() { final HorizontalLayout horizontalLayout = new HorizontalLayout(); horizontalLayout.setSpacing(true);//from ww w .j av a2 s .c o m final Button saveButton = new Button("Save"); saveButton.setIcon(ELabsViewContants.ICON_16_OK); final Label blank = new Label(""); blank.setWidth(LABEL_WIDTH); horizontalLayout.addComponent(blank, 0); horizontalLayout.addComponent(saveButton, 1); return horizontalLayout; }
From source file:org.escidoc.browser.elabsmodul.views.InvestigationSeriesView.java
License:Open Source License
private Component createButtonLayout() { HorizontalLayout horizontalLayout = new HorizontalLayout(); horizontalLayout.setSpacing(true);//from w w w . j a v a2 s. com Label blank = new Label(""); blank.setWidth(LABEL_WIDTH); horizontalLayout.addComponent(blank, 0); horizontalLayout.addComponent(this.saveButton, 1); return horizontalLayout; }