public interface PropertyInputGroup extends BoundComponentGroup<com.holonplatform.core.property.Property<?>,Input<?>>, ValueHolder<com.holonplatform.core.property.PropertyBox,GroupValueChangeEvent<com.holonplatform.core.property.PropertyBox,com.holonplatform.core.property.Property<?>,Input<?>,PropertyInputGroup>>, Validatable
BoundComponentGroup which handles Input elements type and uses a Property set to bind and
identify the elements within the group.
As a ValueHolder, allows to manage the overall group elements value, represented by a PropertyBox
instance.
The refresh() and refresh(Property) methods can be used to refresh the group elements values, for
example to recalculate any virtual group element value which depends on other elements value.
The PropertyInputGroup is Validatable and supports Validator registration both for the single
group element and for the overall group value. See the
InputGroupConfigurator.PropertySetInputGroupConfigurator.withValidator(Property, Validator) and
InputGroupConfigurator.withValidator(Validator) methods.
By default, the Input components to bind to each property are obtained using the PropertyRenderers
registered in the context PropertyRendererRegistry, if available. The bind(...) methods of the
PropertyInputGroupBuilder can be used to provided a specific renderer or Input of one or more group
property.
The convenience methods setEnabled(boolean) and setReadOnly(boolean) can be used to change the
enabled / read-only state for all the property bound Inputs.
BoundComponentGroup.Binding<P,C extends HasComponent>ValueHolder.ValueChangeEvent<V>, ValueHolder.ValueChangeListener<V,E extends ValueHolder.ValueChangeEvent<V>>| Modifier and Type | Method and Description |
|---|---|
static <P extends com.holonplatform.core.property.Property> |
builder(Iterable<P> properties)
Get a
PropertyInputGroupBuilder to create and setup a PropertyInputGroup. |
static PropertyInputGroupBuilder |
builder(com.holonplatform.core.property.Property<?>... properties)
Get a
PropertyInputGroupBuilder to create and setup a PropertyInputGroup. |
<T> Optional<Input<T>> |
getInput(com.holonplatform.core.property.Property<T> property)
Get the
Input bound to the given property, if available. |
com.holonplatform.core.property.PropertyBox |
getValue()
Get the current property values collected into a
PropertyBox, using the group configured properties as
property set. |
com.holonplatform.core.property.PropertyBox |
getValue(boolean validate)
Get the current property values collected into a
PropertyBox, using the group configured properties as
property set. |
Optional<com.holonplatform.core.property.PropertyBox> |
getValueIfValid()
Get the current property values collected into a
PropertyBox, using the group configured properties as
property set, only if the property bound Inputs and this PropertyInputGroup are valid |
void |
refresh()
Refresh the value of all available
Inputs, using current value. |
<T> boolean |
refresh(com.holonplatform.core.property.Property<T> property)
Refresh the value of the
Input bound to given property, using current value. |
default <T> Input<T> |
requireInput(com.holonplatform.core.property.Property<T> property)
Get the
Input bound to the given property, throwing a Property.PropertyNotFoundException if
not available. |
void |
setEnabled(boolean enabled)
Updates the enabled state of all the group inputs.
|
void |
setReadOnly(boolean readOnly)
Set the read-only mode for all the group inputs.
|
void |
setValue(com.holonplatform.core.property.PropertyBox value)
Set the current property values using a
PropertyBox, loading the values to the available property bound
Inputs through the ValueHolder.setValue(Object) method. |
void |
setValue(com.holonplatform.core.property.PropertyBox value,
boolean validate)
Set the current property values using a
PropertyBox, loading the values to the available property bound
Inputs through the ValueHolder.setValue(Object) method. |
void |
validate()
Checks the validity of each input component of the group and of the group value against every registered
validator, if any.
|
getBindings, getElement, requireElementgetComponents, getElementsgetProperties, hasPropertyaddValueChangeListener, clear, getEmptyValue, getValueIfPresent, isEmpty<T> Optional<Input<T>> getInput(com.holonplatform.core.property.Property<T> property)
Input bound to the given property, if available.default <T> Input<T> requireInput(com.holonplatform.core.property.Property<T> property)
Input bound to the given property, throwing a Property.PropertyNotFoundException if
not available.void refresh()
Inputs, using current value.
Each input value will be replaced by the value of the Property to which the input is bound, obtained from
the current PropertyBox value.
<T> boolean refresh(com.holonplatform.core.property.Property<T> property)
Input bound to given property, using current value.
The input value will be replaced by the value of the Property to which the input is bound, obtained from
the current PropertyBox value.
com.holonplatform.core.property.PropertyBox getValue(boolean validate)
PropertyBox, using the group configured properties as
property set.
For each property with a bound Input component, the property value is obtained from the Input
component through the ValueHolder.getValue() method.
validate - true to check the validity of the property bound Inputs and of this
PropertyInputGroup before returing the value, throwing a Validator.ValidationException if the
validation is not successful.PropertyBox containing the property values (never null)com.holonplatform.core.Validator.ValidationException - If validate is true and an Input value is not validcom.holonplatform.core.property.PropertyBox getValue()
PropertyBox, using the group configured properties as
property set.
For each property with a bound Input component, the property value is obtained from the Input
component through the ValueHolder.getValue() method.
The group Inputs and the group value validation is performed before returning the value, throwing a
Validator.ValidationException if the validation is not successful.
getValue in interface ValueHolder<com.holonplatform.core.property.PropertyBox,GroupValueChangeEvent<com.holonplatform.core.property.PropertyBox,com.holonplatform.core.property.Property<?>,Input<?>,PropertyInputGroup>>PropertyBox containing the property values (never null)com.holonplatform.core.Validator.ValidationException - If one or more input is not valid or the group value is not validgetValue(boolean),
getValueIfValid()Optional<com.holonplatform.core.property.PropertyBox> getValueIfValid()
PropertyBox, using the group configured properties as
property set, only if the property bound Inputs and this PropertyInputGroup are valid
For each property with a bound Input component, the property value is obtained from the Input
component through the ValueHolder.getValue() method.
PropertyBox containing the property values, or an empty Optional if validation failedvoid setValue(com.holonplatform.core.property.PropertyBox value,
boolean validate)
PropertyBox, loading the values to the available property bound
Inputs through the ValueHolder.setValue(Object) method.
Only the properties which belong to the group's property set are taken into account.
value - the PropertyBox which contains the property values to load. If null, all the
Input components are cleared.validate - true to check the validity of the property bound Inputs and of this
PropertyInputGroup, throwing a Validator.ValidationException if the validation is not successful.com.holonplatform.core.Validator.ValidationException - If validate is true and validation failsvoid setValue(com.holonplatform.core.property.PropertyBox value)
PropertyBox, loading the values to the available property bound
Inputs through the ValueHolder.setValue(Object) method.
Only the properties which belong to the group's property set are taken into account.
By default, no value validation is performed using this method.
setValue in interface ValueHolder<com.holonplatform.core.property.PropertyBox,GroupValueChangeEvent<com.holonplatform.core.property.PropertyBox,com.holonplatform.core.property.Property<?>,Input<?>,PropertyInputGroup>>value - the PropertyBox which contains the property values to load. If null, all the
Input components are cleared.setValue(PropertyBox, boolean)void setReadOnly(boolean readOnly)
readOnly - true to set all inputs as read-only, false to unsetvoid setEnabled(boolean enabled)
enabled - true to enable all group inputs, false to disable themvoid validate()
throws com.holonplatform.core.Validator.ValidationException
validate in interface Validatablecom.holonplatform.core.Validator.ValidationException - If validation failsstatic <P extends com.holonplatform.core.property.Property> PropertyInputGroupBuilder builder(Iterable<P> properties)
PropertyInputGroupBuilder to create and setup a PropertyInputGroup.P - Property typeproperties - The property set (not null)PropertyInputGroupBuilderstatic PropertyInputGroupBuilder builder(com.holonplatform.core.property.Property<?>... properties)
PropertyInputGroupBuilder to create and setup a PropertyInputGroup.properties - The property set (not null)PropertyInputGroupBuilderCopyright © 2020 The Holon Platform. All rights reserved.