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

x33g5p2x  于2022-01-23 转载在 其他  
字(6.6k)|赞(0)|评价(0)|浏览(161)

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

Label.setValue介绍

[英]Sets the text to be shown in the label.
[中]设置要在标签中显示的文本。

代码示例

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

/**
 * Creates a new instance with the given text and content mode.
 *
 * @param text
 *            the text to set
 * @param contentMode
 *            the content mode to use
 * @since 8.0
 */
public Label(String text, ContentMode contentMode) {
  setValue(text);
  setContentMode(contentMode);
}

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

/**
 * The default binder level status handler.
 * <p>
 * Passes all field related results to the Binding status handlers. All
 * other status changes are displayed in the status label, if one has been
 * set with {@link #setStatusLabel(Label)}.
 *
 * @param binderStatus
 *            status of validation results from binding and/or bean level
 *            validators
 */
protected void handleBinderValidationStatus(
    BinderValidationStatus<BEAN> binderStatus) {
  // let field events go to binding status handlers
  binderStatus.notifyBindingValidationStatusHandlers();
  // show first possible error or OK status in the label if set
  if (getStatusLabel().isPresent()) {
    String statusMessage = binderStatus.getBeanValidationErrors()
        .stream().findFirst().map(ValidationResult::getErrorMessage)
        .orElse("");
    getStatusLabel().get().setValue(statusMessage);
  }
}

代码示例来源:origin: com.vaadin/vaadin-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 && !innerHtml.isEmpty()) {
    if (plainText) {
      innerHtml = DesignFormatter.decodeFromTextNode(innerHtml);
    }
    setValue(innerHtml);
  }
}

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

Label label) {
return withValidationStatusHandler(status -> {
  label.setValue(status.getMessage().orElse(""));

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

getStatusLabel().ifPresent(label -> label.setValue(""));

代码示例来源:origin: de.mhus.lib/mhu-lib-vaadin

@Override
public void setInformation(String name, String description) {
  if (this.description == null) return;
  this.description.setValue("<b>" + name + "</b><br/>" + description);
}

代码示例来源:origin: com.github.markash/components

@Override
  public void enter(ViewChangeListener.ViewChangeEvent event) {
    message.setValue(String.format("No such view: %s", event.getViewName()));
  }
}

代码示例来源:origin: com.github.markash/statistics-card

protected void updateStatisticLabel() {
  if (this.statLabel != null) {
    this.statLabel.setValue(getStatisticLabel());
  }
}

代码示例来源:origin: peholmst/vaadin4spring

@Override
  public void enter(ViewChangeListener.ViewChangeEvent event) {
    message.setValue(String.format("Sorry, but you don't have access to the view <b>%s</b>.", event.getViewName()));
  }
}

代码示例来源:origin: de.mhus.lib/mhu-lib-vaadin6

@Override
public void doUpdate(DataConnector data) throws MException {
  if (field == null) return;
  if (data.getTaskName().equals(DataSource.CONNECTOR_TASK_DATA)) {
    description.setValue(data.getString("sdf"));
    return;
  }
}

代码示例来源:origin: eclipse/hawkbit

private void generateGatewayToken() {
  gatewayTokenkeyLabel.setValue(securityTokenGenerator.generateToken());
  keyChanged = true;
  notifyConfigurationChanged();
}

代码示例来源:origin: uk.q3c.krail/krail

protected void displayInfo() {
  doSetPersistenceInfo();
  nameLabel.setValue(translate.from(persistenceInfo.getName()));
  descriptionLabel.setValue(translate.from(persistenceInfo.getDescription()));
  connectionUrlLabel.setValue(persistenceInfo.getConnectionUrl());
  I18NKey valueKey = persistenceInfo.isVolatilePersistence() ? LabelKey.Yes : LabelKey.No;
  volatileLabel.setValue(translate.from(valueKey));
  loadData();
}

代码示例来源:origin: eclipse/hawkbit

/**
 * Clears the textfield and resets the validation icon.
 */
public void clear() {
  queryTextField.clear();
  validationIcon.setValue(FontAwesome.CHECK_CIRCLE.getHtml());
  validationIcon.setStyleName("hide-status-label");
}

代码示例来源:origin: eclipse/hawkbit

private Label getMandatoryLabel(final String key) {
  final Label mandatoryLabel = getLabel(i18n.getMessage(key));
  mandatoryLabel.setContentMode(ContentMode.HTML);
  mandatoryLabel.setValue(mandatoryLabel.getValue().concat(" <span style='color:#ed473b'>*</span>"));
  return mandatoryLabel;
}

代码示例来源:origin: eclipse/hawkbit

/**
 * Shows the validation success icon in the textfield
 * 
 * @param text
 *            the text to store in the UI state object
 */
public void showValidationSuccesIcon(final String text) {
  validationIcon.setValue(FontAwesome.CHECK_CIRCLE.getHtml());
  validationIcon.setStyleName(SPUIStyleDefinitions.SUCCESS_ICON);
  filterManagementUIState.setFilterQueryValue(text);
  filterManagementUIState.setIsFilterByInvalidFilterQuery(Boolean.FALSE);
}

代码示例来源:origin: com.haulmont.cuba/cuba-web

@Inject
public void setBeanLocator(BeanLocator beanLocator) {
  super.setBeanLocator(beanLocator);
  UserSessionSource uss = beanLocator.get(UserSessionSource.NAME);
  TimeZone timeZone = uss.getUserSession().getTimeZone();
  TimeZones timeZones = beanLocator.get(TimeZones.NAME);
  component.setValue(timeZones.getDisplayNameShort(timeZone));
  if (timeZone == null) {
    // hidden by default if timeZone is null
    setVisible(false);
  }
}

代码示例来源:origin: fi.vm.sade.organisaatio/organisaatio-ui-widgets

@Override
public void valueChange(Property.ValueChangeEvent event) {
  super.valueChange(event);
  if (event.getProperty() != null && event.getProperty().getValue() != null &&
      event.getProperty().getValue().getClass().isAssignableFrom(OrgStructure.class)) {
    selectedOrg = (OrgStructure) event.getProperty().getValue();
    name.setValue(OrganisaatioNameUtil.getPreferredOrganisaatioNameForLanguage(selectedOrg, I18N.getLocale().getLanguage()));
    popup.closeWindow();
  }
}

代码示例来源:origin: eclipse/hawkbit

@EventBusListenerMethod(scope = EventScope.UI)
void onEvent(final CustomFilterUIEvent custFUIEvent) {
  if (custFUIEvent == CustomFilterUIEvent.UPDATE_TARGET_FILTER_SEARCH_ICON) {
    validationIcon.setValue(FontAwesome.CHECK_CIRCLE.getHtml());
    if (!isValidationError()) {
      validationIcon.setStyleName(SPUIStyleDefinitions.SUCCESS_ICON);
    } else {
      validationIcon.setStyleName(SPUIStyleDefinitions.ERROR_ICON);
    }
  }
}

代码示例来源:origin: eclipse/hawkbit

private Component buildVersionInfo() {
  final Label label = new Label();
  label.setSizeFull();
  label.setStyleName("version-layout");
  label.setValue(serverProperties.getBuild().getVersion());
  return label;
}

代码示例来源:origin: org.rapidpm.vaadin/nano-vaadin-v08

public BasicTestUI() {
 label.setId(LABEL_ID);
 label.setValue(valueOf(counter));
 button.setId(BUTTON_ID);
 button.setCaption(BUTTON_ID);
 button.addClickListener(e -> label.setValue(valueOf(++counter)));
 setCompositionRoot(new VerticalLayout(button, label));
}

相关文章