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

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

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

Layout.replaceComponent介绍

暂无

代码示例

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

getLayout().replaceComponent(oldField, newField);
fields.put(propertyId, newField);
newField.addListener(fieldValueChangeListener);

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

private void initialize() {
  optionsField = formFieldFactory.createField(definition.getField(), locale);
  layout.addComponent(optionsField);
  optionsField.addValueChangeListener(e -> {
    if (e.getOldValue() == null || e.getOldValue() == null) {
      return;
    }
    EditorView<T> oldView = subForm(e.getOldValue());
    EditorView<T> newView = subForm(e.getValue());
    layout.replaceComponent(oldView.asVaadinComponent(), newView.asVaadinComponent());
  });
  definition.getForms().forEach(formDefinition -> {
    ItemProviderStrategy<T> subFormProviderStrategy = create(((ComplexPropertyDefinition<T>) formDefinition).getItemProvider(), formDefinition, itemProviderStrategy);
    EditorView<T> subForm = getViewProvider().create(formDefinition);
    subForms.put(formDefinition.getName(), Pair.of(subForm, subFormProviderStrategy));
  });
  binder = ConfiguredBinder.withPropertySet(propertySetFactory.fromFieldDefinitions(Collections.singletonList(definition.getField()), locale));
  binder.forField(optionsField)
      .withConverter(new StringToOptionDefinitionConverter(definition.getField()))
      .bind(resolvePropertyNameByLocale(definition.getField().getName(), locale, definition.getField().isI18n()));
}

相关文章