com.vaadin.v7.ui.Label.setValue()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(8.0k)|赞(0)|评价(0)|浏览(154)

本文整理了Java中com.vaadin.v7.ui.Label.setValue()方法的一些代码示例,展示了Label.setValue()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Label.setValue()方法的具体详情如下:
包路径:com.vaadin.v7.ui.Label
类名称:Label
方法名:setValue

Label.setValue介绍

[英]Set the value of the label. Value of the label is the XML contents of the label. Since Vaadin 7.2, changing the value of Label instance with that method will fire ValueChangeEvent.
[中]设置标签的值。标签的值是标签的XML内容。自Vaadin 7.2以来,使用该方法更改Label实例的值将触发ValueChangeEvent。

代码示例

代码示例来源:origin: OpenNMS/opennms

private void debug() {
  if (!debugEnabled) {
    return;
  }
  String debug = "#" + iteration + ", i=" + index + ", w=" + waitFor;
  debugLabel.setValue(debug);
}

代码示例来源:origin: OpenNMS/opennms

public ConfirmationDialog withDescription(String description) {
  label.setValue(description);
  return this;
}

代码示例来源:origin: OpenNMS/opennms

public void setLabelText(String label) {
    label = String.format("%s. This may take a while ...", label);
    this.label.setValue(label);
  }
}

代码示例来源:origin: OpenNMS/opennms

public void setSemanticZoomLevelLabel(int semanticZoomLevel) {
  m_zoomLevelLabel.setValue(String.valueOf(semanticZoomLevel));
  m_szlOutBtn.setEnabled(semanticZoomLevel > 0);
}

代码示例来源:origin: viritin/viritin

private void render() {
  if (text != null) {
    setContentMode(ContentMode.HTML);
    StringBuilder sb = new StringBuilder("<h");
    sb.append(headerLevel);
    sb.append(">");
    sb.append(Jsoup.clean(text, getWhitelist()));
    sb.append("</h");
    sb.append(headerLevel);
    sb.append(">");
    super.setValue(sb.toString());
    text = null;
  }
}

代码示例来源:origin: com.vaadin/vaadin-compatibility-server

/**
 * Creates a new instance of Label with text-contents.
 *
 * @param content
 * @param contentMode
 */
public Label(String content, ContentMode contentMode) {
  setValue(content);
  setContentMode(contentMode);
  setWidth(100, Unit.PERCENTAGE);
}

代码示例来源:origin: info.magnolia.dam/magnolia-dam-app

/**
 * Add Title.
 * @deprecated since 2.5 with no replacement.
 */
@Deprecated
protected Component getFileDetailHeader() {
  Label label = new Label();
  label.setValue(i18n.translate("dam.assets.filePreview.header"));
  label.addStyleName(ValoTheme.LABEL_BOLD);
  return label;
}

代码示例来源:origin: viritin/viritin

protected void updateLabel() {
  String caption;
  if (captionGenerator != null) {
    caption = captionGenerator.getCaption(getValue());
  } else {
    caption = getValue().toString();
  }
  label.setValue(caption);
}

代码示例来源:origin: info.magnolia.contacts/magnolia-contacts

private Label createInfoLabel(String caption, String propertyName, Item fileItem) throws RepositoryException {
  Label label = new Label("", ContentMode.TEXT);
  label.setCaption(caption + ": ");
  label.setValue(fileItem.getItemProperty(propertyName).getValue().toString());
  return label;
}

代码示例来源:origin: info.magnolia.ui/magnolia-ui-vaadin-common-widgets

public void setMessage(String message) {
  this.message = message;
  if (getContent() != null && getContent() instanceof Label) {
    ((Label) getContent()).setValue(message);
  }
}

代码示例来源:origin: info.magnolia.dam/magnolia-dam-app

/**
 * Add File Name.<br>
 */
protected Component getFileDetailFileName() {
  Label label = new Label();
  label.setCaption(i18n.translate("dam.assets.filePreview.title"));
  label.setValue(PathUtil.stripExtension(currentAsset.getFileName()));
  return label;
}

代码示例来源:origin: info.magnolia.dam/magnolia-dam-app

/**
   * Add File Format.<br>
   */
  protected Component getFileDetailFileFormat() {
    Label label = new Label();
    label.setCaption(i18n.translate("dam.assets.filePreview.format"));
    label.setValue(PathUtil.getExtension(currentAsset.getFileName()));
    return label;
  }
}

代码示例来源:origin: com.vaadin/vaadin-compatibility-server

@Override
public void readDesign(Element design, DesignContext designContext) {
  super.readDesign(design, designContext);
  String innerHtml = design.html();
  boolean plainText = design.hasAttr(DESIGN_ATTR_PLAIN_TEXT);
  if (plainText) {
    setContentMode(ContentMode.TEXT);
  } else {
    setContentMode(ContentMode.HTML);
  }
  if (innerHtml != null && !"".equals(innerHtml)) {
    if (plainText) {
      innerHtml = DesignFormatter.decodeFromTextNode(innerHtml);
    }
    setValue(innerHtml);
  }
}

代码示例来源:origin: info.magnolia.dam/magnolia-dam-app

/**
 * Add File Info.
 */
protected Component getFileDetailSize() {
  Label label = new Label();
  label.setCaption(i18n.translate("dam.assets.filePreview.size"));
  label.setValue(FileUtils.byteCountToDisplaySize(currentAsset.getFileSize()));
  return label;
}

代码示例来源:origin: info.magnolia.dam/magnolia-dam-app

/**
 * Add File Info.
 */
@Override
protected Component getFileDetailSize() {
  Label label = new Label();
  label.setCaption(i18n.translate(fileDetailSizeCaption));
  StringBuilder sb = new StringBuilder();
  if (getValue().isImage()) {
    sb.append(getValue().getWidth() + " x " + getValue().getHeight() + ", ");
  }
  sb.append(FileUtils.byteCountToDisplaySize(getValue().getFileSize()));
  if (getValue().getDuration() > 0) {
    sb.append("(x:x min)");
  }
  label.setValue(sb.toString());
  return label;
}

代码示例来源:origin: OpenNMS/opennms

private void updateLabel(String viewName) {
  label.setValue(generateLabel(viewName));
  UiState uiState = UiState.valueOf(viewName);
  if (uiState.hasUi()) {
    helpPopupView.setContent(new HelpContent(UiState.valueOf(viewName)));
  }
}

代码示例来源:origin: info.magnolia.ui/magnolia-ui-vaadin-common-widgets

private void updateItemDescription() {
    String description = null;
    final Object itemId = getValue();
    final Item item = getContainerDataSource().getItem(itemId);

    boolean isDescriptionBlank = true;
    if (item != null) {
      Property property = item.getItemProperty(descriptionPropertyName);

      if (property != null && property.getValue() != null) {
        description = property.getValue().toString();
      }
      isDescriptionBlank = StringUtils.isBlank(description);
      descriptionLabel.setValue(isDescriptionBlank ? "" : description);
    }

    if (isDescriptionBlank) {
      mainLayout.removeStyleName("has-description");
    } else {
      mainLayout.addStyleName("has-description");
    }

    descriptionLabel.setVisible(!isDescriptionBlank);
  }
}

代码示例来源:origin: OpenNMS/opennms

@Override
public void selectionChanged(SelectionChangedEvent event) {
  Object selectedBean = event.getSelectedBean();
  if (selectedBean instanceof Mbean) {
    captionLabel.setValue(String.format(CAPTION_FORMAT, "MBean Attributes"));
    nameEditForm.setParameter(MBEAN_FORM_PARAMETER);
    nameEditForm.selectionChanged(event);
    attributesTable.modelChanged(event.getSelectedItem(), event.getSelectedBean(), controller.getContainer(Attrib.class, selectedBean));
    setContent(contentLayout);
    return;
  }
  if (selectedBean instanceof CompAttrib) {
    captionLabel.setValue(String.format(CAPTION_FORMAT, "Composite Members"));
    nameEditForm.setParameter(COMPOSITE_FORM_PARAMETER);
    nameEditForm.selectionChanged(event);
    attributesTable.modelChanged(event.getSelectedItem(), event.getSelectedBean(), controller.getContainer(CompMember.class, selectedBean));
    setContent(contentLayout);
    return;
  }
  setContent(emptyLayout);
}

代码示例来源:origin: OpenNMS/opennms

/**
 * Wraps the provided component in order to fit it better in the Info Panel.
 * E.g. a caption is added to better difference between components.
 *
 * @param component The component to wrap.
 * @param title the title of the component to wrap.
 * @param id the id of the wrapped component.
 * @return The wrapped component.
 */
private Component wrap(Component component, String title, String id) {
  Label label = new Label();
  label.addStyleName("info-panel-item-label");
  if (title != null) {
    label.setValue(title);
  }
  VerticalLayout layout = new VerticalLayout();
  layout.addStyleName("info-panel-item");
  layout.addComponent(label);
  layout.addComponent(component);
  layout.setMargin(true);
  if (id != null) {
    layout.setId(id);
  }
  return layout;
}

代码示例来源:origin: OpenNMS/opennms

public InfoDialog(String caption, String description) {
  setCaption(caption);
  setModal(true);
  setResizable(false);
  setClosable(false);
  setWidth(400, Unit.PIXELS);
  setHeight(200, Unit.PIXELS);
  okButton = UIHelper.createButton("ok", null, null, event -> InfoDialog.this.close());
  okButton.setId("infoDialog.button.ok");
  label.setValue(description);
  final HorizontalLayout buttonLayout = new HorizontalLayout(okButton);
  buttonLayout.setSpacing(true);
  layout.setSpacing(true);
  layout.setMargin(true);
  layout.setSizeFull();
  layout.addComponent(label);
  layout.addComponent(buttonLayout);
  layout.setComponentAlignment(buttonLayout, Alignment.BOTTOM_RIGHT);
  setContent(layout);
  center();
}

相关文章