VALUE - is the generic type of the value.DELEGATE - is the generic type of the delegate.public abstract class UiWidgetCustom<VALUE,DELEGATE extends UiWidget> extends AbstractUiWidget<VALUE> implements UiWidgetWithValue<VALUE>
widget implemented via delegation
to another widget. It is therefore toolkit independent and can be implemented as a regular class. This
makes the programming model of this UI-Toolkit easy to use. field
widgets for custom datatypes and composites for editors of particular business
objects.AbstractUiWidget.AccessHelper, AbstractUiWidget.EventSender, AbstractUiWidget.HandlerContainer| Modifier and Type | Field and Description |
|---|---|
private DELEGATE |
delegate |
private boolean |
initialized |
private Class<VALUE> |
valueClass |
STYLE_HEADERHTML_ATTRIBUTE_ID, ID_SEPARATOR, PROPERTY_IDPROPERTY_STYLES, STYLE_PATTERN_MULTIPLE, STYLE_PATTERN_SINGLEWAI_ARIA| Constructor and Description |
|---|
UiWidgetCustom(UiContext context,
DELEGATE delegate,
Class<VALUE> valueClass)
The constructor.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
addStyle(String style)
This method adds the given
style to the styles. |
void |
clearMessages()
This method is clearing all messages.
|
protected void |
clearValidity()
This method may clear potential state information from previous validations.
|
void |
dispose()
This method disposes this object.
|
protected void |
doInitialize()
This method is called from
initialize() but only if called for the first time. |
protected void |
doSetMode(UiMode mode)
This method actually changes the
mode. |
protected void |
doValidate(ValidationState state,
VALUE value)
This method is called from
AbstractUiFeatureValueAndValidation.validate(ValidationState) and performs the actual validation of this
object. |
Role |
getAriaRole()
This method gets the
Accessibility.WAI_ARIA role of this object. |
protected DELEGATE |
getDelegate()
This method gets the underlying
widget that is adapted
by this widget. |
protected static <WIDGET extends UiWidget> |
getDelegate(UiWidgetCustom<?,WIDGET> customWidget)
This method gets the
delegate of the given widget. |
String |
getId()
This method gets the unique identifier of this object.
|
UiMode |
getMode()
This method gets the current
UiMode of this object. |
UiMode |
getModeFixed()
This method gets the fixed
UiMode of this object. |
UiWidgetComposite<?> |
getParent() |
String |
getPrimaryStyle()
This method gets the primary
style of this object. |
Size |
getSize() |
String |
getSource() |
String |
getStyles()
This method gets the style(s) (also called style-name(s)) of this object.
|
String |
getTooltip()
This method gets the tooltip of this object.
|
Class<VALUE> |
getValueClass() |
AttributeWriteFlagAdvanced |
getVisibleFlag()
This method gets advanced visibility support.
|
protected UiWidgetAdapter |
getWidgetAdapter()
This method gets or creates the
UiWidgetAdapter. |
boolean |
hasStyle(String style)
This method checks if the given
style is contained in the set of styles
of this object. |
boolean |
hasWidgetAdapter() |
protected void |
initialize()
This method initializes this widget.
|
boolean |
isDisposed()
This method tests if this object has been
disposed. |
boolean |
isEnabled()
This method determines if this object is enabled.
|
protected boolean |
isModifiedRecursive() |
boolean |
isVisible()
This method determines if this object is
set to
visible. |
boolean |
isVisibleRecursive()
This method determines if this object is actually visible for the end-user.
|
protected void |
removeFromParent()
This method removes this widget from its
parent. |
boolean |
removeStyle(String style)
This method removes the given
style from the styles. |
void |
setEnabled(boolean enabled)
This method sets the
enabled status of this object. |
boolean |
setFocused()
This method sets the
focus to this object. |
void |
setId(String id)
This method set the
ID of this object. |
void |
setMode(UiMode mode)
This method sets the
mode of this object. |
protected void |
setMode(UiMode mode,
boolean programmatic) |
void |
setModeFixed(UiMode mode)
This method sets the
fixed mode of this object. |
protected void |
setParent(UiWidgetComposite<?> parent)
This method sets the
parent. |
void |
setPrimaryStyle(String primaryStyle)
This method sets the
primary style. |
void |
setStyles(String styles)
This method clears all
styles and sets them to the given styles. |
void |
setTooltip(String tooltip)
This method sets the tooltip text of this object.
|
void |
setVisible(boolean visible)
This method shows or hides this object.
|
void |
setVisible(boolean visible,
boolean programmatic)
This method shows or hides this object.
|
addChangeHandler, addEventHandler, addValidator, clearMessagesLocal, clearValidationFailure, convertValueToString, doGetValue, doSetValue, 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, waitgetValuegetValueAndValidate, getValueDirectaddChangeHandler, removeChangeHandlerresetValue, setValue, setValue, setValueForUsergetOriginalValue, getValueOrExceptionaddValidatorMandatory, isMandatoryaddValidator, removeValidatorvalidategetContextaddEventHandler, removeEventHandlerisModifiedprivate final DELEGATE extends UiWidget delegate
getDelegate()private final Class<VALUE> valueClass
getValueClass()private boolean initialized
initialize()public Class<VALUE> getValueClass()
getValueClass in class AbstractUiWidget<VALUE>public void clearMessages()
validation failures
as well as other messages such as infos, errors, or warnings
(e.g. in a message-panel). This is a recursive operation that is propagated to all potential children.clearMessages in interface UiFeatureMessagesclearMessages in class AbstractUiWidget<VALUE>public boolean setFocused()
focus to this object. setFocused in interface AttributeWriteOnlyFocusedtrue if the focus has been set successfully, false otherwise.protected void clearValidity()
validity recursively.clearValidity in class AbstractUiWidget<VALUE>protected final DELEGATE getDelegate()
widget that is adapted
by this widget.widget.protected static final <WIDGET extends UiWidget> WIDGET getDelegate(UiWidgetCustom<?,WIDGET> customWidget)
delegate of the given widget.protected boolean isModifiedRecursive()
isModifiedRecursive in class AbstractUiWidget<VALUE>true if a child or descendant of this object is modified,
false otherwise.protected UiWidgetAdapter getWidgetAdapter()
UiWidgetAdapter. UiWidgetAdapter is created. For the purpose of lazy
instantiation this should happen as late as possible. Use AbstractUiWidget.hasWidgetAdapter() to prevent
unnecessary creation.getWidgetAdapter in class AbstractUiWidget<VALUE>UiWidgetAdapter.public boolean hasWidgetAdapter()
hasWidgetAdapter in class AbstractUiWidget<VALUE>true if the UiWidgetAdapter has already been created. Otherwise false (if AbstractUiWidget.getWidgetAdapter() has never been called
yet).public final UiWidgetComposite<?> getParent()
getParent in interface UiWidgetnull if NOT attached to the UI or if this is a root
widget (e.g. UiWidgetMainWindow).public final void dispose()
dispose in interface AttributeWriteDisposedpublic final boolean isDisposed()
disposed. A disposed object can
NOT be used anymore.isDisposed in interface AttributeReadDisposedtrue if this object has been disposed.AttributeWriteDisposed.dispose()public final boolean isVisible()
set to
visible.
AttributeWriteVisibleAdvanced.getVisibleFlag().getFlag(). If you want
to read the value that has been set via AttributeWriteVisibleAdvanced.setVisible(boolean) you would need to do
AttributeWriteVisibleAdvanced.getVisibleFlag().getFlag(null)
instead. See AttributeWriteVisibleAdvanced.getVisibleFlag() for more information.isVisible in interface AttributeReadVisibleisVisible in interface AttributeWriteVisibleAdvancedtrue if programmatically set visible, false if directly
programmatically hidden.AttributeReadVisibleRecursive.isVisibleRecursive()public final void setVisible(boolean visible)
AttributeWriteVisibleAdvanced.isVisible(). It is an efficient shortcut for
AttributeWriteVisibleAdvanced.getVisibleFlag().setFlag(visible, null).setVisible in interface AttributeWriteVisiblesetVisible in interface AttributeWriteVisibleAdvancedvisible - is the new visibility status of this object. If true, the object will be
shown (and raised), if false the object will be hidden (iconified).AttributeWriteVisibleAdvanced.isVisible()public void setVisible(boolean visible,
boolean programmatic)
setVisible in interface AttributeWriteVisibleAdvancedvisible - is the new visibility status of this object. If true, the object will be
shown (and raised), if false the object will be hidden (iconified).programmatic - - see UiEvent.isProgrammatic().AttributeWriteVisibleAdvanced.isVisible()public AttributeWriteFlagAdvanced getVisibleFlag()
boolean attribute or property.
However, this is leading to various problems if you have multiple aspects that influence the flag. E.g.
assume you have some dynamic effect that is showing or hiding a widget. Additionally the widget is in a
collapsable section, tab-panel, or the like that is also showing or hiding the widget. Further, there
might be an authorization in your application as a cross-cutting concern that hides widgets from the UI
according to the current roles and permissions of the user. If this is all based on a simple boolean flag
you will end up in a mess and with a buggy application. So the dynamic effect or even worse the
authorization will hide the widget but after the user collapses and then expands a panel it becomes
visible again. You do not want to deal with bugs like this. AttributeWriteVisibleAdvanced.isVisible() for reading visibility.getVisibleFlag in interface AttributeWriteVisibleAdvancedmutable flag for advanced visibility support.public final boolean isVisibleRecursive()
AttributeReadVisible.isVisible() it also takes its parent objects into account. So it only returns true
if the object is actually attached to the UI and physically in the current dialogue (it may still be
clipped from the screen or scrolled out of the visible panel).isVisibleRecursive in interface AttributeReadVisibleRecursivetrue if visible to the end-user, false otherwise.public final boolean isEnabled()
isEnabled in interface AttributeReadEnabledtrue if this object is enabled, false if this object is disabled.public final void setEnabled(boolean enabled)
enabled status of this object. If it is disabled, the user can
not interact with the object.setEnabled in interface AttributeWriteEnabledenabled - - if true the object will be enabled, else the object will be disabled.public final UiMode getMode()
UiMode of this object.getMode in interface AttributeReadModeUiMode.public final void setMode(UiMode mode)
mode of this object. It will change the object to view or edit mode. This is a recursive operation that will also apply to all
descendants of this object. If a fixed mode is set (not
null), this method will have no effect and recursive calls will stop at this object.setMode in interface AttributeWriteModesetMode in class AbstractUiWidget<VALUE>mode - is the new UiMode to set.protected void setMode(UiMode mode, boolean programmatic)
setMode in class AbstractUiWidget<VALUE>mode - is the new UiMode to set.programmatic - - see UiEvent.isProgrammatic().AbstractUiWidget.setMode(UiMode)protected void doSetMode(UiMode mode)
mode.mode - is the new UiMode to set.public final UiMode getModeFixed()
UiMode of this object. While a fixed UiMode is
set (NOT null)
changing the mode will have no effect.getModeFixed in interface AttributeReadModeFixedUiMode or null if the UiMode may be
changed.public void setModeFixed(UiMode mode)
fixed mode of this object. This will
set the mode to the given
mode (if not null, recursively) and then mark the mode as fixed so
AttributeWriteMode.setMode(UiMode) will have no effect anymore. The fixed
mode itself will NOT be set recursively. UiMode.VIEW in order to prevent a UI widget (a
field or even an entire sub-dialog) from switching to edit-mode (UiMode.EDIT) so the UI widget
will always remain read-only.setModeFixed in interface AttributeWriteModeFixedmode - is the new fixed UiMode to set. May be null to unset fixation.public final String getTooltip()
getTooltip in interface AttributeReadTooltippublic final void setTooltip(String tooltip)
setTooltip in interface AttributeWriteTooltiptooltip - is the new tooltip text or null to disable the tooltip.AttributeReadTooltip.getTooltip()public Size getSize()
public Role getAriaRole()
Accessibility.WAI_ARIA role of this object. UiWidget) is supposed to provide high-level
widgets and support setting the according Role and their attributes automatically. Therefore
users should only use this for special situations e.g. for setting aria-hidden intentionally for a visible object.getAriaRole in interface AttributeReadAriaRoleRole or null if NOT set.Accessibilitypublic final void setPrimaryStyle(String primaryStyle)
primary style.setPrimaryStyle in interface AttributeWritePrimaryStyleprimaryStyle - is the new value for primary style.AttributeReadStyles.getStyles()public final String getStyles()
class attribute of HTML
elements that are then configured via some cascading style sheet (CSS). AttributeReadStyles.STYLE_PATTERN_SINGLE. Any number of styles or in other words
the result of this has to match AttributeReadStyles.STYLE_PATTERN_MULTIPLE. The first style is called the
primary style.getStyles in interface AttributeReadStylespublic final void setStyles(String styles)
styles and sets them to the given styles. This
will also update the primary style.setStyles in interface AttributeWriteStylesstyles - are the styles of this object. Either a single style or a list of styles separated by
whitespaces. Use the empty string to unset all styles.public final String getPrimaryStyle()
style of this object.getPrimaryStyle in interface AttributeReadPrimaryStylenull if NOT defined.public final boolean addStyle(String style)
style to the styles.addStyle in interface AttributeWriteStylesAdvancedstyle - is the style to add. If this style is already contained in the styles,
this will have no effect.true if the styles has actually been added, false if it was already
present before.public final boolean removeStyle(String style)
style from the styles.removeStyle in interface AttributeWriteStylesAdvancedstyle - is the style to remove. If this style is NOT contained in the styles,
this will have no effect.true if the given style has actually been removed, false
otherwise (if it was NOT present).public final boolean hasStyle(String style)
style is contained in the set of styles
of this object.hasStyle in interface AttributeReadStylesAdvancedstyle - is the style to check.style is active.public final String getId()
[a-zA-Z][a-zA-Z0-9_$]*.
Invalid IDs (e.g. containing colon, hash or period) are not accepted to prevent you from later having
problems with CSS selectors.getId in interface AttributeReadHtmlIdgetId in interface AttributeReadId<String>AttributeReadHtmlId.ID_SEPARATORpublic final void setId(String id)
ID of this object. Use this method to give the object a meaningful
identifier after creation. AttributeReadHtmlId.getId() for the syntax constraints of IDs.setId in interface AttributeWriteHtmlIdsetId in interface AttributeWriteId<String>id - is the new ID for the object.protected void removeFromParent()
parent. The parent is
set to null and the native widget is removed from its parent.removeFromParent in class AbstractUiWidget<VALUE>protected void setParent(UiWidgetComposite<?> parent)
parent.setParent in class AbstractUiWidget<VALUE>parent - is the new parent.protected final void initialize()
setParent(UiWidgetComposite) so initialization is performed before the widget is actually
attached to the screen for the first time. The first call of this method delegates to
doInitialize(). Further calls of this method will have no effect. protected void doInitialize()
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. protected void doValidate(ValidationState state, VALUE value)
AbstractUiFeatureValueAndValidation.validate(ValidationState) and performs the actual validation of this
object. This method performs the recursive validation of potential children of this widget excluding the
validation of this widget itself. A legal implementation of a composite widget needs to call
AbstractUiFeatureValueAndValidation.validate(ValidationState) on all child widgets.doValidate in class AbstractUiWidget<VALUE>state - is the ValidationState. Never null.value - is the current value of this object that has already be determined.public String getSource()
getSource in class AbstractUiWidget<VALUE>String representation of this object that qualifies as source description that might be
displayed to end-users (unlike AbstractUiWidget.toString() what is for debugging only).Copyright © 2001–2016 mmm-Team. All rights reserved.