T - The type of the form item's value.public abstract class AbstractFormItem<T> extends Object implements FormItem<T>
A form item carries three different values:
TTThe value and the expression value are mutual exclusive. Only one of them is allowed to be non-null.
| Modifier and Type | Method and Description |
|---|---|
protected void |
addAppearance(Form.State state,
org.jboss.hal.ballroom.form.Appearance<T> appearance) |
void |
addResolveExpressionHandler(ResolveExpressionEvent.ResolveExpressionHandler handler) |
void |
addValidationHandler(FormItemValidation<T> validationHandler) |
com.google.gwt.event.shared.HandlerRegistration |
addValueChangeHandler(com.google.gwt.event.logical.shared.ValueChangeHandler<T> valueChangeHandler) |
elemental2.dom.HTMLElement |
asElement(Form.State state) |
void |
assignDefaultValue(T defaultValue)
Stores the default value for later use.
|
void |
attach()
Calls
SuggestHandler.attach() in case there was one registered. |
void |
clearError()
Clears any error markers.
|
void |
clearValue()
Sets the value and expression value to
null, clears any error marker and
shows the default value (if any). |
void |
detach() |
void |
fireEvent(com.google.gwt.event.shared.GwtEvent<?> gwtEvent) |
String |
getExpressionValue() |
String |
getId(Form.State state) |
String |
getLabel() |
String |
getName() |
int |
getTabIndex() |
T |
getValue() |
boolean |
isDeprecated() |
boolean |
isEnabled() |
boolean |
isExpressionAllowed() |
boolean |
isExpressionValue() |
boolean |
isModified() |
boolean |
isRequired() |
boolean |
isRestricted() |
boolean |
isUndefined() |
void |
mask() |
protected void |
modifyExpressionValue(String newExpressionValue)
Assigns a new value to the internal expression value and adjusts the
modified and undefined
flags. |
protected void |
modifyValue(T newValue)
Assigns a new value to the internal value and adjusts the
modified and undefined flags. |
void |
onSuggest(String suggestion) |
void |
registerSuggestHandler(SuggestHandler suggestHandler) |
protected void |
remember(com.google.web.bindery.event.shared.HandlerRegistration handler)
Store the event handler registration to remove them in
detach(). |
void |
setAccessKey(char accessKey) |
void |
setDeprecated(org.jboss.hal.dmr.Deprecation deprecation) |
void |
setEnabled(boolean enabled) |
void |
setExpressionAllowed(boolean expressionAllowed) |
void |
setExpressionValue(String expressionValue)
Sets the form item's expression value, applies the
Decoration.EXPRESSION decoration and shows the
expression value in the appearances. |
void |
setFocus(boolean focus) |
void |
setId(String id) |
void |
setLabel(String label) |
void |
setModified(boolean modified) |
void |
setName(String name) |
void |
setRequired(boolean required) |
void |
setRestricted(boolean restricted) |
void |
setTabIndex(int index) |
void |
setUndefined(boolean undefined) |
void |
setValue(T value) |
void |
setValue(T value,
boolean fireEvent)
Sets the form item's value and shows the value in the appearances.
|
void |
showError(String message)
Shows the specified error message.
|
void |
unmask() |
boolean |
validate() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitisEmpty, supportsExpressionsprotected void addAppearance(Form.State state, org.jboss.hal.ballroom.form.Appearance<T> appearance)
protected void remember(com.google.web.bindery.event.shared.HandlerRegistration handler)
detach().public elemental2.dom.HTMLElement asElement(Form.State state)
public void attach()
SuggestHandler.attach() in case there was one registered. If you override this method, please
call super.attach() to keep this behaviour.attach in interface Attachablepublic void detach()
detach in interface Attachablepublic String getId(Form.State state)
public T getValue()
public void setValue(T value)
public void setValue(T value, boolean fireEvent)
null.
Does not touch the modified and undefined flags. Should be called from business code like form
mapping.setValue in interface com.google.gwt.user.client.ui.HasValue<T>protected void modifyValue(T newValue)
modified and undefined flags.
Should be called from change handlers. Does not update any appearances nor apply / unapply decorations.public void clearValue()
null, clears any error marker and
shows the default value (if any). Does not touch the modified and undefined flags. Should be
called from business code like form mapping.clearValue in interface FormItem<T>public void assignDefaultValue(T defaultValue)
setValue(Object) (if the
value is null or empty) and clearValue(). Calling this method will not immediately
show the default value.assignDefaultValue in interface FormItem<T>public void fireEvent(com.google.gwt.event.shared.GwtEvent<?> gwtEvent)
fireEvent in interface com.google.gwt.event.shared.HasHandlerspublic com.google.gwt.event.shared.HandlerRegistration addValueChangeHandler(com.google.gwt.event.logical.shared.ValueChangeHandler<T> valueChangeHandler)
addValueChangeHandler in interface com.google.gwt.event.logical.shared.HasValueChangeHandlers<T>public String getName()
getName in interface com.google.gwt.user.client.ui.HasNamepublic void setName(String name)
setName in interface com.google.gwt.user.client.ui.HasNamepublic void addValidationHandler(FormItemValidation<T> validationHandler)
addValidationHandler in interface FormItem<T>public void clearError()
clearError in interface FormItem<T>public void showError(String message)
public boolean isExpressionAllowed()
isExpressionAllowed in interface FormItem<T>public void setExpressionAllowed(boolean expressionAllowed)
setExpressionAllowed in interface FormItem<T>public boolean isExpressionValue()
isExpressionValue in interface FormItem<T>public String getExpressionValue()
getExpressionValue in interface FormItem<T>public void setExpressionValue(String expressionValue)
Decoration.EXPRESSION decoration and shows the
expression value in the appearances. Sets the value to null. Does not touch the modified and
undefined flags. Should be called from business code like form mapping.setExpressionValue in interface FormItem<T>protected void modifyExpressionValue(String newExpressionValue)
modified and undefined
flags. Does not update any appearances nor apply / unapply decorations. Should be called from change handlers.public void addResolveExpressionHandler(ResolveExpressionEvent.ResolveExpressionHandler handler)
addResolveExpressionHandler in interface FormItem<T>public void registerSuggestHandler(SuggestHandler suggestHandler)
registerSuggestHandler in interface FormItem<T>public void onSuggest(String suggestion)
public boolean isRestricted()
isRestricted in interface FormItem<T>public void setRestricted(boolean restricted)
setRestricted in interface FormItem<T>public boolean isEnabled()
isEnabled in interface com.google.gwt.user.client.ui.HasEnabledpublic void setEnabled(boolean enabled)
setEnabled in interface com.google.gwt.user.client.ui.HasEnabledpublic int getTabIndex()
getTabIndex in interface com.google.gwt.user.client.ui.Focusablepublic void setTabIndex(int index)
setTabIndex in interface com.google.gwt.user.client.ui.Focusablepublic void setAccessKey(char accessKey)
setAccessKey in interface com.google.gwt.user.client.ui.Focusablepublic void setFocus(boolean focus)
setFocus in interface com.google.gwt.user.client.ui.Focusablepublic boolean isRequired()
isRequired in interface FormItem<T>public void setRequired(boolean required)
setRequired in interface FormItem<T>public final boolean isModified()
isModified in interface FormItem<T>public void setModified(boolean modified)
setModified in interface FormItem<T>public final boolean isUndefined()
isUndefined in interface FormItem<T>public void setUndefined(boolean undefined)
setUndefined in interface FormItem<T>public boolean isDeprecated()
isDeprecated in interface FormItem<T>public void setDeprecated(org.jboss.hal.dmr.Deprecation deprecation)
setDeprecated in interface FormItem<T>Copyright © 2018 JBoss, a division of Red Hat. All rights reserved.