VALUE - is the generic type of the value. Typically bound to
List<SELECTION>.SELECTION - is the generic type of the individual row from the master list.DETAIL - is the generic type of the actual value representing the <SELECTION> that gets set in
the details panel.public abstract class AbstractUiWidgetCustomMasterDetail<VALUE,SELECTION,DETAIL> extends UiWidgetCustomComposite<VALUE,UiWidgetRegular,UiWidgetDynamicPanel<UiWidgetRegular>>
custom composite widget that
implements the UI pattern master/detail (panel). It combines a master
panel that allows selecting an object that automatically gets displayed in
the details panel and can typically be edited there.| Modifier and Type | Class and Description |
|---|---|
private class |
AbstractUiWidgetCustomMasterDetail.Handler
This inner class implements the handler-interfaces.
|
AbstractUiWidget.AccessHelper, AbstractUiWidget.EventSender, AbstractUiWidget.HandlerContainer| Modifier and Type | Field and Description |
|---|---|
private UiHandlerDetailsForSelection<SELECTION,DETAIL> |
handlerDetailsForSelection |
STYLE_HEADERHTML_ATTRIBUTE_ID, ID_SEPARATOR, PROPERTY_IDPROPERTY_STYLES, STYLE_PATTERN_MULTIPLE, STYLE_PATTERN_SINGLEWAI_ARIA| Constructor and Description |
|---|
AbstractUiWidgetCustomMasterDetail(UiContext context,
UiWidgetDynamicPanel<UiWidgetRegular> delegate,
Class<VALUE> valueClass)
The constructor.
|
AbstractUiWidgetCustomMasterDetail(UiContext context,
UiWidgetDynamicPanel<UiWidgetRegular> delegate,
Class<VALUE> valueClass,
UiHandlerDetailsForSelection<SELECTION,DETAIL> handlerDetailsForSelection)
The constructor.
|
| Modifier and Type | Method and Description |
|---|---|
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 |
doInitialize()
This method is called from
UiWidgetCustom.initialize() but only if called for the first time. |
protected void |
doSetMode(UiMode mode)
This method actually changes the
mode. |
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 abstract UiWidgetCustom<DETAIL,?> |
getDetailPanel()
This method gets the details panel showing the
detail for the
current selection from the master list. |
protected DETAIL |
getDetailsForSelection(SELECTION selection)
This method gets the >DETAIL&ls; for the given <SELECTION>.
|
protected abstract UiFeatureSelectedValue<SELECTION> |
getMasterList()
This method gets the actual widget containing a list of <SELECTION> to choose from.
|
protected abstract UiWidgetWithValue<VALUE> |
getMasterPanel() |
protected void |
onMasterListSelection(Collection<SELECTION> selectedValues,
UiEventSelectionChange<SELECTION> event)
This method is called if the selection of the
master list has changed. |
getChild, getChild, getChildCount, getChildIndexaddStyle, clearMessages, clearValidity, dispose, 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, setFocused, setId, setMode, setMode, setModeFixed, setParent, setPrimaryStyle, setStyles, setTooltip, setVisible, setVisibleaddChangeHandler, addEventHandler, addValidator, clearMessagesLocal, clearValidationFailure, convertValueToString, 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, setValue, toStringaddValidatorMandatory, createValidationFailure, getValue, getValueAndValidate, handleGetValueError, resetValue, setValue, setValueForUser, validateclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetContext, getParent, getSizeclearMessagesaddEventHandler, removeEventHandlersetModegetModesetModeFixedgetModeFixedsetIdgetIdsetTooltipgetTooltipgetVisibleFlag, isVisible, setVisible, setVisibleisVisibleRecursivesetEnabledisEnabledaddStyle, removeStylehasStylesetStylesgetStylessetPrimaryStylegetPrimaryStyledisposeisDisposedisModifiedgetAriaRolevalidategetValuegetValueAndValidate, getValueDirectaddChangeHandler, removeChangeHandlerresetValue, setValue, setValue, setValueForUsergetOriginalValue, getValueOrExceptionaddValidatorMandatory, isMandatoryaddValidator, removeValidatorprivate UiHandlerDetailsForSelection<SELECTION,DETAIL> handlerDetailsForSelection
getDetailsForSelection(Object)public AbstractUiWidgetCustomMasterDetail(UiContext context, UiWidgetDynamicPanel<UiWidgetRegular> delegate, Class<VALUE> valueClass)
context - is the context.delegate - is the delegate.valueClass - is the value class.public AbstractUiWidgetCustomMasterDetail(UiContext context, UiWidgetDynamicPanel<UiWidgetRegular> delegate, Class<VALUE> valueClass, UiHandlerDetailsForSelection<SELECTION,DETAIL> handlerDetailsForSelection)
context - is the context.delegate - is the delegate.valueClass - is the value class.handlerDetailsForSelection - is the UiHandlerDetailsForSelection to use by
getDetailsForSelection(Object).protected abstract UiWidgetWithValue<VALUE> getMasterPanel()
master list.protected abstract UiFeatureSelectedValue<SELECTION> getMasterList()
master panel. A selection in the master list will
automatically trigger an update of the details panel. details panel can only display a single <DETAIL> at a time. Therefore
if multi-selection is enabled,
nothing will be displayed in the details panel. This may still make sense to
allow mass-operations such as
remove in the master panel.protected abstract UiWidgetCustom<DETAIL,?> getDetailPanel()
detail for the
current selection from the master list. If the <DETAIL> should be
editable for the user, this details panel will typically be an editor.protected void doInitialize()
UiWidgetCustom.initialize() but only if called for the first time. You may override
this method to add additional initialization logic. Then do not forget the super call. doInitialize in class UiWidgetCustom<VALUE,UiWidgetDynamicPanel<UiWidgetRegular>>protected void doSetMode(UiMode mode)
mode.doSetMode in class UiWidgetCustom<VALUE,UiWidgetDynamicPanel<UiWidgetRegular>>mode - is the new UiMode to set.protected 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) .
data-binding you could override this
method and manually implement the binding like in the following example:protected Person doGetValue(Person template,You may also mix the advanced data-binding with custom logic implemented in this method.ValidationStatestate) { Person result = super.doGetValue(template, state); // if the attribute is a datatype we can supply null (instead of result.getFirstName()) result.setFirstName(this.widgetFirstName.getValueDirect(null, state)); result.setLastName(this.widgetLastName.getValueDirect(null, state)); Address address = this.widgetAddressPanel.getValueDirect(result.getAddress(), state); this.widgetAddressExtraPanel.getValueDirect(address, state); result.setAddress(address); ... return result; }
doGetValue in class UiWidgetCustomComposite<VALUE,UiWidgetRegular,UiWidgetDynamicPanel<UiWidgetRegular>>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 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).
data-binding you could override this
method and manually implement the binding like in the following example:
protected void doSetValue(Person value) {
this.widgetFirstName.setValue(value?.getFirstName());
this.widgetLastName.setValue(value?.getLastName());
...
}
doSetValue in class UiWidgetCustomComposite<VALUE,UiWidgetRegular,UiWidgetDynamicPanel<UiWidgetRegular>>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)protected void onMasterListSelection(Collection<SELECTION> selectedValues, UiEventSelectionChange<SELECTION> event)
master list has changed.selectedValues - are the currently selected values.event - is the selection change event.protected DETAIL getDetailsForSelection(SELECTION selection)
selection - is the current selection.UiHandlerDetailsForSelectionCopyright © 2001–2016 mmm-Team. All rights reserved.