protected void discard() { if (valueBinding != null) { valueBinding.discard(); } }
@Override public ValueSource<V> getValueSource() { return valueBinding != null ? valueBinding.getSource() : null; }
@Override public boolean isBuffered() { return valueBinding != null && valueBinding.isBuffered(); }
@Override public void setValueSource(ValueSource<V> valueSource) { if (this.valueBinding != null) { valueBinding.unbind(); this.valueBinding = null; } if (valueSource != null) { ValueBinder binder = beanLocator.get(ValueBinder.NAME, ValueBinder.class); this.valueBinding = binder.bind(this, valueSource); valueBindingConnected(valueSource); this.valueBinding.activate(); valueBindingActivated(valueSource); setUiTestId(valueSource); } }
protected boolean isModified() { return valueBinding != null && valueBinding.isModified(); } }
@Override public void commit() { if (valueBinding != null) { valueBinding.write(); } }
@Override public void setBuffered(boolean buffered) { if (valueBinding != null) { valueBinding.setBuffered(buffered); } }
@Override public void setValueSource(ValueSource<V> valueSource) { if (this.valueBinding != null) { valueBinding.unbind(); this.valueBinding = null; } if (valueSource != null) { ValueBinder binder = beanLocator.get(ValueBinder.NAME, ValueBinder.class); this.valueBinding = binder.bind(this, valueSource); valueBindingConnected(valueSource); this.valueBinding.activate(); valueBindingActivated(valueSource); setUiTestId(valueSource); } }
@Override public boolean isModified() { return valueBinding != null && valueBinding.isModified(); }
protected void commit() { if (valueBinding != null) { valueBinding.write(); } }
protected void setBuffered(boolean buffered) { if (valueBinding != null) { valueBinding.setBuffered(buffered); } }
@Override public ValueSource<V> getValueSource() { return valueBinding != null ? valueBinding.getSource() : null; }
@Override public void setValueSource(ValueSource<V> valueSource) { if (this.valueBinding != null) { valueBinding.unbind(); this.valueBinding = null; } if (valueSource != null) { ValueBinder binder = beanLocator.get(ValueBinder.class); this.valueBinding = binder.bind(this, valueSource); valueBindingConnected(valueSource); this.valueBinding.activate(); valueBindingActivated(valueSource); setUiTestId(valueSource); } }
protected boolean isBuffered() { return valueBinding != null && valueBinding.isBuffered(); }
@Override public void discard() { if (valueBinding != null) { valueBinding.discard(); } }
@Override public ValueSource<V> getValueSource() { return valueBinding != null ? valueBinding.getSource() : null; }
@Override protected Collection<V> convertToModel(Set<V> componentRawValue) throws ConversionException { if (valueBinding != null) { Class<?> targetType = valueBinding.getSource().getType(); if (List.class.isAssignableFrom(targetType)) { return new ArrayList<>(componentRawValue != null ? componentRawValue : Collections.emptyList()); } else if (Set.class.isAssignableFrom(targetType)) { return new LinkedHashSet<>(componentRawValue != null ? componentRawValue : Collections.emptySet()); } } return new LinkedHashSet<>(componentRawValue != null ? componentRawValue : Collections.emptySet()); }
@Override protected Collection<V> convertToModel(Set<V> componentRawValue) throws ConversionException { Stream<V> items = optionsBinding == null ? Stream.empty() : optionsBinding.getSource().getOptions().filter(componentRawValue::contains); if (valueBinding != null) { Class<?> targetType = valueBinding.getSource().getType(); if (List.class.isAssignableFrom(targetType)) { return items.collect(Collectors.toList()); } else if (Set.class.isAssignableFrom(targetType)) { return items.collect(Collectors.toCollection(LinkedHashSet::new)); } } return items.collect(Collectors.toCollection(LinkedHashSet::new)); }
protected String convertToPresentation(V modelValue) { if (formatter != null) { return formatter.apply(modelValue); } if (valueBinding != null && valueBinding.getSource() instanceof EntityValueSource) { EntityValueSource entityValueSource = (EntityValueSource) valueBinding.getSource(); MetaProperty metaProperty = entityValueSource.getMetaPropertyPath().getMetaProperty(); return metadataTools.format(modelValue, metaProperty); } return metadataTools.format(modelValue); }
protected String generateDefaultItemCaption(V item) { if (valueBinding != null && valueBinding.getSource() instanceof EntityValueSource) { EntityValueSource entityValueSource = (EntityValueSource) valueBinding.getSource(); return metadataTools.format(item, entityValueSource.getMetaPropertyPath().getMetaProperty()); } return metadataTools.format(item); }