VALUE - is the generic type of the value. Typically a custom
Datatype.DELEGATE_VALUE - is the generic type of the delegates value.DELEGATE - is the generic type of the delegate.public abstract class UiWidgetCustomFieldAtomic<VALUE,DELEGATE_VALUE,DELEGATE extends UiWidgetField<DELEGATE_VALUE>> extends UiWidgetCustomField<VALUE,DELEGATE>
custom field widget that is
build out of a single field widget.UiWidgetCustomField.EventHandlerAdapterAbstractUiWidget.AccessHelper, AbstractUiWidget.EventSender, AbstractUiWidget.HandlerContainerSTYLE_FIELD, STYLE_LABEL, STYLE_MANDATORY, STYLE_VIEWSTYLE_HEADERHTML_ATTRIBUTE_ID, ID_SEPARATOR, PROPERTY_IDPROPERTY_STYLES, STYLE_PATTERN_MULTIPLE, STYLE_PATTERN_SINGLEWAI_ARIAPROPERTY_LABELACCESS_KEY_NONE, HTML_ATTRIBUTE_ACCESS_KEY| Constructor and Description |
|---|
UiWidgetCustomFieldAtomic(UiContext context,
DELEGATE delegate,
Class<VALUE> valueClass)
The constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addFocusHandler(UiHandlerEventFocus handler)
This method adds the given
UiHandlerEventFocus to this object. |
protected abstract DELEGATE_VALUE |
convertValueForDelegate(VALUE value)
This method converts the given
value that is going to be set in this widget to the value of
the delegate widget. |
protected abstract VALUE |
convertValueFromDelegate(DELEGATE_VALUE value)
This method converts the given
value from the delegate widget to the
value of this widget. |
protected String |
convertValueToString(VALUE value)
Converts the given value to
String. |
protected VALUE |
doGetValue(VALUE template,
ValidationState state)
This method is called from the
data-binding triggered by API methods such as
AbstractUiFeatureValueAndValidation.getValue(). |
protected void |
doSetValue(VALUE value,
boolean forUser)
This method is called from the
data-binding triggered by API methods such as
AbstractUiWidget.setValue(Object, boolean). |
protected UiWidgetField<?> |
getFirstField()
This method gets the first active field contained in this custom field.
|
protected DELEGATE_VALUE |
getNullValueForDelegate()
This method gets the value for the
delegate widget in case null is
provided as value for this widget. |
boolean |
isTrimValue()
|
boolean |
removeFocusHandler(UiHandlerEventFocus handler)
This method removes the given
UiHandlerEventFocus from this object. |
void |
setTrimValue(boolean trimValue)
This method sets the
trimValue flag. |
getAccessKey, getChild, getChild, getChildCount, getChildIndex, getEventHandlerAdapter, getLabel, getLabelWidget, getNullValue, getValidationFailure, getValueAsString, isFocused, setAccessKey, setFocused, setLabel, setValidationFailure, setValueAsString, toStringaddStyle, clearMessages, clearValidity, dispose, doInitialize, doSetMode, doValidate, getAriaRole, getDelegate, getDelegate, getId, getMode, getModeFixed, getParent, getPrimaryStyle, getSize, getSource, getStyles, getTooltip, getValueClass, getVisibleFlag, getWidgetAdapter, hasStyle, hasWidgetAdapter, initialize, isDisposed, isEnabled, isModifiedRecursive, isVisible, isVisibleRecursive, removeFromParent, removeStyle, setEnabled, setId, setMode, setMode, setModeFixed, setParent, setPrimaryStyle, setStyles, setTooltip, setVisible, setVisibleaddChangeHandler, addEventHandler, addValidator, clearMessagesLocal, clearValidationFailure, fireEvent, fireValueChange, getBasicUtil, getContext, getDataBinding, getDataBinding, getDataBindingForWidget, getEventSender, getFactory, getLogger, getObserverSource, getOriginalValue, getRecentValue, getValueDirect, getValueOrException, getWidgetAdapter, hasEventSender, isMandatory, isModified, removeChangeHandler, removeEventHandler, removeFromParent, removeValidator, setMandatory, setModified, setParent, setValueaddValidatorMandatory, createValidationFailure, getValue, getValueAndValidate, handleGetValueError, resetValue, setValue, setValueForUser, validateclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetContext, getParent, getSizeclearMessagesaddEventHandler, removeEventHandlersetModegetModesetModeFixedgetModeFixedsetIdgetIdsetTooltipgetTooltipgetVisibleFlag, isVisible, setVisible, setVisibleisVisibleRecursivesetEnabledisEnabledaddStyle, removeStylehasStylesetStylesgetStylessetPrimaryStylegetPrimaryStyledisposeisDisposedisModifiedgetAriaRolegetValuegetValueAndValidate, getValueDirectaddChangeHandler, removeChangeHandlerresetValue, setValue, setValue, setValueForUsergetOriginalValue, getValueOrExceptionaddValidatorMandatory, isMandatoryaddValidator, removeValidatorprotected final VALUE doGetValue(VALUE template, ValidationState state) throws RuntimeException
data-binding triggered by API methods such as
AbstractUiFeatureValueAndValidation.getValue(). In many cases the data-binding already performs the
required work to do. However, here is the place to implemented the custom logic to get the value from the
actual widget. The following cases have to be distinguished:
native
fields this method has to get the actual
value from the underlying native widget (text-box, password-field, etc.).custom fields this
method will be responsible to convert from the delegates value (see
UiWidgetCustom.getDelegate()) to the proper value type. E.g. if you want to create a custom
widget to edit your own datatype such as CustomerNumber based on a
UiWidgetTextField you need to convert from String
to CustomerNumber.custom composite widgets
you should use AbstractUiWidget.getDataBinding().
UiDataBinding.createAndBind(net.sf.mmm.util.pojo.path.api.TypedProperty)
that gives you high-level support and makes your live easy. Then there is no need to override this
method.Void, there is nothing to do here.AbstractUiWidget.doSetValue(Object, boolean) .doGetValue in class AbstractUiWidget<VALUE>template - is the object where the data is filled in. May only be null if according to
data-binding (e.g. if <VALUE> is an (immutable)
Datatype).state - is the ValidationState. May be null (if the validation is omitted).
Should only be used to propagate to AbstractUiWidget.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) the template is NOT
null and is to be returned by this method after the value(s) of this widget have
been assigned. For immutable datatypes
template will be null and this method has to create a new instance of
<VALUE> based on the end-users input in the widget.RuntimeExceptionAbstractUiWidget.doSetValue(Object, boolean)protected abstract VALUE convertValueFromDelegate(DELEGATE_VALUE value)
value from the delegate widget to the
value of this widget. This typically has to be implemented with your custom datatype conversion. In case
that <VALUE> and <DELEGATE_VALUE> are the same you can just return the given
value.
protected MyDatatype convertValueFromDelegate(String value) {
return new MyDatatype(value);
}
value - is the value of the delegate. Never null.protected abstract DELEGATE_VALUE convertValueForDelegate(VALUE value)
value that is going to be set in this widget to the value of
the delegate widget. This typically has to be implemented with your custom
datatype conversion. In case that <VALUE> and <DELEGATE_VALUE> are the same you can
just return the given value.
protected String convertValueForDelegate(MyDatatype value) {
return value.getValue().
}
value - is the value to convert. Never null.delegate widgetprotected String convertValueToString(VALUE value)
String.convertValueToString in class AbstractUiWidget<VALUE>value - is the value to convert.String representation to display the given value.protected DELEGATE_VALUE getNullValueForDelegate()
delegate widget in case null is
provided as value for this widget. The default implementation return null. Override to
change.null-value.protected final void doSetValue(VALUE value, boolean forUser)
data-binding triggered by API methods such as
AbstractUiWidget.setValue(Object, boolean). In many cases the data-binding already
performs the required work to do. However, here is the place to implemented the custom logic to get the
value from the actual widget. For details see AbstractUiWidget.doGetValue(Object, ValidationState).doSetValue in class AbstractUiWidget<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).AbstractUiWidget.doGetValue(Object, ValidationState)public boolean isTrimValue()
value of this object should be automatically trimmed. The default value is
true. E.g. if a text field widget supports this property and it is true the
value entered by the end-user will automatically be trimmed. If you want prevent
this (e.g. if the end-user shall provide a separator, indentation, substitution variable, or the like)
you need to set it to false.public void setTrimValue(boolean trimValue)
trimValue flag.trimValue - is the new value of AttributeReadTrimValue.isTrimValue().public final void addFocusHandler(UiHandlerEventFocus handler)
UiHandlerEventFocus to this object.addFocusHandler in interface UiFeatureFocusaddFocusHandler in class UiWidgetCustomField<VALUE,DELEGATE extends UiWidgetField<DELEGATE_VALUE>>handler - is the UiHandlerEventFocus to add.public final boolean removeFocusHandler(UiHandlerEventFocus handler)
UiHandlerEventFocus from this object.removeFocusHandler in interface UiFeatureFocusremoveFocusHandler in class UiWidgetCustomField<VALUE,DELEGATE extends UiWidgetField<DELEGATE_VALUE>>handler - is the UiHandlerEventFocus to remove.true if the handler has been removed successfully, false
if it was NOT registered and nothing has changed.protected UiWidgetField<?> getFirstField()
delegate itself but also a child of the delegate in case of a composite custom
field.getFirstField in class UiWidgetCustomField<VALUE,DELEGATE extends UiWidgetField<DELEGATE_VALUE>>UiWidgetCustom.getDelegate()Copyright © 2001–2016 mmm-Team. All rights reserved.