VALUE
- is the generic type of the value
. Typically a custom
Datatype
.DELEGATE
- is the generic type of the delegate
.public abstract class UiWidgetCustomField<VALUE,DELEGATE extends UiWidgetComposite<?>> extends UiWidgetCustom<VALUE,DELEGATE> implements UiWidgetField<VALUE>
custom widget
that is a field widget
. The major usecase is to create field widgets
for custom
Datatype
based on existing field widgets
. UiWidgetFactoryDatatype.createForDatatype(Class)
Modifier and Type | Class and Description |
---|---|
class |
UiWidgetCustomField.EventHandlerAdapter
This inner class is an
event handler that adapts from the internal fields to this
composite custom widget. |
AbstractUiWidget.AccessHelper, AbstractUiWidget.EventSender, AbstractUiWidget.HandlerContainer
Modifier and Type | Field and Description |
---|---|
private UiWidgetCustomField.EventHandlerAdapter |
eventHandlerAdapter |
private UiFeature |
focusField
The sub-field that currently has the focus or
null . |
STYLE_FIELD, STYLE_LABEL, STYLE_MANDATORY, STYLE_VIEW
STYLE_HEADER
HTML_ATTRIBUTE_ID, ID_SEPARATOR, PROPERTY_ID
PROPERTY_STYLES, STYLE_PATTERN_MULTIPLE, STYLE_PATTERN_SINGLE
WAI_ARIA
PROPERTY_LABEL
ACCESS_KEY_NONE, HTML_ATTRIBUTE_ACCESS_KEY
Constructor and Description |
---|
UiWidgetCustomField(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. |
char |
getAccessKey()
This method gets the access key of this object.
|
UiWidget |
getChild(int index)
This method gets the child at the given index.
|
UiWidget |
getChild(String id)
This method gets the child with the given
id . |
int |
getChildCount()
This method gets the number of children in this composite.
|
int |
getChildIndex(UiWidget child)
This method determines the index of the given
child in the list of children of this composite. |
(package private) UiWidgetCustomField.EventHandlerAdapter |
getEventHandlerAdapter() |
(package private) abstract UiWidgetField<?> |
getFirstField()
This method gets the first active field contained in this custom field.
|
String |
getLabel()
This method gets the label of this object.
|
UiWidgetLabel |
getLabelWidget()
This method gets the
label widget associated with this field. |
protected VALUE |
getNullValue()
This method gets the value in case the
delegate widget returns null
as value. |
String |
getValidationFailure()
This method gets the validation failure of this object.
|
String |
getValueAsString()
|
boolean |
isFocused()
This method determines if this object currently has the focus.
|
boolean |
removeFocusHandler(UiHandlerEventFocus handler)
This method removes the given
UiHandlerEventFocus from this object. |
void |
setAccessKey(char accessKey)
This method sets the
accessKey attribute of this object. |
boolean |
setFocused()
This method sets the
focus to this object. |
void |
setLabel(String label)
This method sets the
label of this object. |
void |
setValidationFailure(String validationFailure)
This method sets the
validation failure . |
void |
setValueAsString(String value)
This method sets the
valueAsString of this object. |
String |
toString() |
addStyle, 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, setVisible
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
addValidatorMandatory, createValidationFailure, getValue, getValueAndValidate, handleGetValueError, resetValue, setValue, setValueForUser, validate
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getContext, getParent, getSize
clearMessages
addEventHandler, removeEventHandler
setMode
getMode
setModeFixed
getModeFixed
setId
getId
setTooltip
getTooltip
getVisibleFlag, isVisible, setVisible, setVisible
isVisibleRecursive
setEnabled
isEnabled
addStyle, removeStyle
hasStyle
setStyles
getStyles
setPrimaryStyle
getPrimaryStyle
dispose
isDisposed
isModified
getAriaRole
getValue
getValueAndValidate, getValueDirect
addChangeHandler, removeChangeHandler
resetValue, setValue, setValue, setValueForUser
getOriginalValue, getValueOrException
addValidatorMandatory, isMandatory
addValidator, removeValidator
setTrimValue
isTrimValue
private final UiWidgetCustomField.EventHandlerAdapter eventHandlerAdapter
getEventHandlerAdapter()
private UiFeature focusField
null
.UiWidgetCustomField.EventHandlerAdapter getEventHandlerAdapter()
UiWidgetCustomField.EventHandlerAdapter
.protected VALUE getNullValue()
delegate widget
returns null
as value. The default implementation return null
. Override to change.null
-value.public String getValueAsString()
value
as
String
. It returns the value as it is entered by the end-user that may be invalid.getValueAsString
in interface AttributeReadValueAsString
String
if the field is blank.public void setValueAsString(String value)
valueAsString
of this object. setValueAsString
in interface AttributeWriteValueAsString
value
- is the new value
as it would have been entered by the user.public String toString()
toString
in class AbstractUiWidget<VALUE>
abstract UiWidgetField<?> getFirstField()
delegate
itself but also a child of the delegate in case of a composite custom
field.UiWidgetCustom.getDelegate()
public String getLabel()
UiWidgetField
) has an associated label widget
. This
method gets its label text. Please note that the label widget
is not contained
in this field widget itself, so if you regularly add this field widget to some other widget you will not
see the label. However, UiWidgetGridPanel
also
automatically
adds
the label widget
. The recommended use-case is to create a form to view
and edit your business object extending
UiWidgetCustomGridPanel
and use
UiDataBinding
. UiWidgetField.getLabelWidget()
.getLabel()
this method
prevents actually creating the label widget
if it does NOT yet exist. Further
it will only return what has been set via UiWidgetField.setLabel(String)
and NOT what has potentially been set
via UiWidgetField.getLabelWidget()
. setLabel
(what should be avoided).getLabel
in interface AttributeReadLabel
getLabel
in interface UiWidgetField<VALUE>
public void setLabel(String label)
label
of this object.setLabel
in interface AttributeWriteLabel
setLabel
in interface UiWidgetField<VALUE>
label
- is the new label
to set.UiWidgetField.getLabel()
public UiWidgetLabel getLabelWidget()
label widget
associated with this field. UiWidgetField.getLabel()
and
UiWidgetField.setLabel(String)
. Be aware that some native toolkits (e.g. SmartGWT) already implement field
widgets including the label. In this case this method will return a different view on the same native
widget.getLabelWidget
in interface UiWidgetField<VALUE>
public int getChildIndex(UiWidget child)
child
in the list of children
of this composite. getChildIndex
in interface UiWidgetAbstractComposite
child
- is the potential child
.index
of the given child
or -1
if it is NOT
a child
of this composite.List.indexOf(Object)
public UiWidget getChild(int index) throws IndexOutOfBoundsException
getChild
in interface UiWidgetAbstractComposite
getChild
in interface UiWidgetComposite<UiWidget>
index
- is the index of the requested child. Has to be in the range from 0
to
UiWidgetAbstractComposite.getChildCount()
- 1
.IndexOutOfBoundsException
- if the given index
is out of bounds.List.get(int)
public UiWidget getChild(String id)
id
.getChild
in interface UiWidgetAbstractComposite
getChild
in interface UiWidgetComposite<UiWidget>
id
- is the ID
of the requested child
.child
with the given id
or null
if no such
child
exists.public int getChildCount()
getChildCount
in interface UiWidgetAbstractComposite
public boolean setFocused()
focus
to this object. setFocused
in interface AttributeWriteOnlyFocused
setFocused
in class UiWidgetCustom<VALUE,DELEGATE extends UiWidgetComposite<?>>
true
if the focus has been set successfully, false
otherwise.public boolean isFocused()
isFocused
in interface AttributeReadFocused
true
if this object is focused, false
otherwise.public void addFocusHandler(UiHandlerEventFocus handler)
UiHandlerEventFocus
to this object.addFocusHandler
in interface UiFeatureFocus
handler
- is the UiHandlerEventFocus
to add.public boolean removeFocusHandler(UiHandlerEventFocus handler)
UiHandlerEventFocus
from this object.removeFocusHandler
in interface UiFeatureFocus
handler
- is the UiHandlerEventFocus
to remove.true
if the handler
has been removed successfully, false
if it was NOT registered
and nothing has changed.public void setAccessKey(char accessKey)
accessKey
attribute of this object.setAccessKey
in interface AttributeWriteAccessKey
accessKey
- is the new value of AttributeReadAccessKey.getAccessKey()
. Use AttributeReadAccessKey.ACCESS_KEY_NONE
to unset.public char getAccessKey()
focus
.getAccessKey
in interface AttributeReadAccessKey
AttributeReadAccessKey.ACCESS_KEY_NONE
if no access key is defined.public void setValidationFailure(String validationFailure)
validation failure
. UiFeatureValidation
. This
method is only intended as back-door for very special cases (e.g. you have to use your own validator
infrastructure and perform validation outside this framework). It is not recommended to use this method
as an API user.setValidationFailure
in interface AttributeWriteValidationFailure
validationFailure
- is the validation failure text. The empty string or null
will clear
the error and mark the field as valid. Otherwise the field will be invalid.public String getValidationFailure()
getValidationFailure
in interface AttributeReadValidationFailure
null
for no error.Copyright © 2001–2016 mmm-Team. All rights reserved.