VALUE
- is the generic type of the value
.public class UiDataBindingPojoComposite<VALUE> extends UiDataBindingPojo<VALUE>
UiDataBinding
for composite custom
widgets.Modifier and Type | Field and Description |
---|---|
private Map<TypedProperty<?>,List<UiWidgetWithValue<?>>> |
property2widgetMap |
Constructor and Description |
---|
UiDataBindingPojoComposite(AbstractUiWidget<VALUE> widget,
UiDataBindingAdapter<VALUE> adapter)
The constructor.
|
Modifier and Type | Method and Description |
---|---|
<P> void |
bind(TypedProperty<P> property,
UiWidgetWithValue<P> widget)
This method binds the given widget to the given property.
|
<P> UiWidgetWithValue<P> |
createAndBind(TypedProperty<P> property,
String label)
This method is like
UiDataBinding.createAndBind(TypedProperty) but using the given label instead
of deriving it automatically. |
protected <P> UiWidgetWithValue<P> |
createWidget(TypedProperty<P> property,
String label)
|
protected VALUE |
doGetValue(VALUE template,
ValidationState state)
This method is called from
AbstractUiFeatureValueAndValidation.getValueOrException(Object) . |
protected void |
doSetValue(VALUE value,
boolean forUser)
This method is called from
AbstractUiDataBinding.setValue(Object, boolean) . |
private boolean |
verifyNotInList(List<UiWidgetWithValue<?>> list,
UiWidgetWithValue<?> widget,
TypedProperty<?> property)
|
createCopyOfValue, createNewValue, createPropertyAccessor, createPropertyAccessor, getAdapter
addChangeHandler, createAndBind, createValidationFailure, getLabel, getLogger, getOriginalValue, getRecentValue, getSource, getValidity, getValueDirect, getWidget, isModified, removeChangeHandler, setMandatory, setModified, setValidity, setValue, toString
addValidator, doValidate, isMandatory, isMandatory, removeValidator
addValidatorMandatory, clearValidity, getValue, getValueAndValidate, getValueOrException, handleGetValueError, resetValue, setValue, setValueForUser, validate
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
doValidate
getValueAndValidate
resetValue, setValue, setValueForUser
getValue, getValueOrException
addValidatorMandatory, isMandatory
addValidator, removeValidator
validate
private final Map<TypedProperty<?>,List<UiWidgetWithValue<?>>> property2widgetMap
bind(TypedProperty, UiWidgetWithValue)
public UiDataBindingPojoComposite(AbstractUiWidget<VALUE> widget, UiDataBindingAdapter<VALUE> adapter)
widget
- is the widget
to bind.adapter
- is the UiDataBindingAdapter
.public <P> void bind(TypedProperty<P> property, UiWidgetWithValue<P> widget)
UiFeatureValueAndValidation.getValueDirect(Object, net.sf.mmm.util.validation.api.ValidationState)
and therefore all
other getValue*
methods will automatically
read the value
of the
given widget and set it to the given property of the <VALUE> to return.AttributeWriteValueAdvanced.setValue(Object, boolean)
and therefore all other setValue*
methods will
automatically get the property-value of the given property from the <VALUE>-object and
set that property-value
to the given widget.bind
in interface UiDataBinding<VALUE>
bind
in class AbstractUiDataBinding<VALUE>
P
- is the generic type of the property value
.property
- is the TypedProperty
representing the property to bind. It has to be a property
of <VALUE>.widget
- is the value based widget
to bind to the given property.UiDataBinding.createAndBind(TypedProperty)
private boolean verifyNotInList(List<UiWidgetWithValue<?>> list, UiWidgetWithValue<?> widget, TypedProperty<?> property)
list
- is the List
to check.widget
- is the UiWidgetWithValue
to check.property
- is the TypedProperty
used for the potential error mesasage.true
.public <P> UiWidgetWithValue<P> createAndBind(TypedProperty<P> property, String label)
UiDataBinding.createAndBind(TypedProperty)
but using the given label
instead
of deriving it automatically.createAndBind
in interface UiDataBinding<VALUE>
createAndBind
in class AbstractUiDataBinding<VALUE>
P
- is the generic type of the property value
.property
- is the TypedProperty
representing the property to bind. It has to be a property
of <VALUE> and contain its property type
.label
- is the label to use for the widget. See
UiWidgetField.getLabel()
.bound
.protected <P> UiWidgetWithValue<P> createWidget(TypedProperty<P> property, String label)
P
- is the generic property type
.property
- is the TypedProperty
.label
- is the label for the widget or null
to determine automatically.UiWidgetWithValue
for the given input.protected VALUE doGetValue(VALUE template, ValidationState state)
AbstractUiFeatureValueAndValidation.getValueOrException(Object)
. It has to be implemented with the custom
logic to get the value from the view. The implementation of this method has to correspond with the
implementation of AbstractUiDataBinding.doSetValue(Object, boolean)
. A typical implementation of this method for a
composite widget should look like this:doGetValue
in class AbstractUiDataBinding<VALUE>
template
- is the object where the data is filled in. May only be null
if
AbstractUiDataBinding.createNewValue()
does.state
- is the ValidationState
. May be null
(if the validation is omitted).
Should only be used to propagate to AbstractUiDataBinding.getValueDirect(Object, ValidationState)
of children.null
if empty. If <VALUE> is
String
the empty String
has to be returned if no value has been entered. In case
<VALUE> is a mutable object (java bean) and template
is NOT null
,
this method is supposed to return template
after the value(s) of this object have
been assigned. If template
is null
this method has to create a new
instance of <VALUE>. It is forbidden and an explicit bug-pattern to modify the
original value
. This is required to support operations such as
AbstractUiFeatureValueAndValidation.resetValue()
.AbstractUiDataBinding.doSetValue(Object, boolean)
protected void doSetValue(VALUE value, boolean forUser)
AbstractUiDataBinding.setValue(Object, boolean)
. It has to be implemented with the custom
logic to set the value in the view. The implementation of this method has to correspond with the
implementation of AbstractUiDataBinding.doGetValue(Object, ValidationState)
.doSetValue
in class AbstractUiDataBinding<VALUE>
value
- is the value to set. Typically a composite object (e.g. java bean) so its attributes are set
to fields (see UiWidgetField
).forUser
- true
if called from AbstractUiFeatureValueAndValidation.setValueForUser(Object)
, false
if
set from AbstractUiFeatureValueAndValidation.setValue(Object)
.AbstractUiDataBinding.doGetValue(Object, ValidationState)
Copyright © 2001–2016 mmm-Team. All rights reserved.