T - the value typepublic abstract class WInputComponentWithValue<T> extends ComponentWithValue<T>
ComponentWithValue.ValueChangeListenerImpl, ComponentWithValue.ValueProperty<T>refreshingform, INTERNAL_STATE_RECORD_PROPERTY| Modifier | Constructor and Description |
|---|---|
protected |
WInputComponentWithValue(Class<T> valueType)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addValidator(ClosureHolder validator)
Adds a validator.
|
protected abstract com.vaadin.ui.AbstractField<?> |
createWidget()
Called once, to create the actual Vaadin component.
|
protected void |
fireValueChanged() |
void |
focus()
Sets the focus for this component if the component is
Component.Focusable. |
ClosureHolder |
getOnChange()
Gets the closure handling the value change event.
|
ListHolder |
getValidationErrors()
Returns all validation errors produced by the validators attached to this
component.
|
com.vaadin.ui.AbstractField<?> |
getWidget()
Gets the Vaadin representation of this component.
|
void |
inferValidator(CollectionHolder tags)
Infers validators for the provided tags.
|
boolean |
isConvertible()
Indicates if the field value is convertible or not.
|
boolean |
isImmediate()
Returns the immediate mode of the component.
|
boolean |
isRequired()
Is this field required.
|
boolean |
isValid()
Tests the current value against registered validators if the field is not
empty.
|
void |
preventGC(Set<ValueHolder> set)
Override for all components which are actively using some record holders, not directly linked to the model.
|
void |
removeAllValidators()
Removes all validators.
|
protected void |
restoreInternalState(Map<String,Object> state)
Restores the UI state of this component which was previously written
by
FormComponent.writeInternalState(Map). |
void |
setImmediate(boolean immediate)
Sets the component's immediate mode to the specified status.
|
void |
setOnChange(ClosureHolder onChange)
Sets the on change handler
|
void |
setRequired(boolean required)
Sets the required flag.
|
protected void |
writeInternalState(Map<String,Object> state)
Writes the UI state of this component to the provided map.
|
getBinding, getProperty, isFullyInitialized, onPropertyValueSet, refresh, refreshBinding, setPropertyaddDataErrorMessage, addStyleName, attach, call, clearDataErrorMessages, createEvent, equals, getCaption, getComponentAlignment, getContextClickHandler, getCustomErrorMessage, getDataErrorMessages, getDescription, getExpandRatio, getHasChildrenAdapter, getHeight, getIcon, getModelingId, getNamespace, getStyleName, getTabIndex, getWidth, hashCode, isEnabled, isReadOnly, isVisible, localize, markAsDirty, removeStyleName, restoreState, saveState, setCaption, setComponentAlignment, setContextClickHandler, setContextMenuItems, setCustomErrorMessage, setDescription, setEnabled, setExpandRatio, setHeight, setIcon, setReadOnly, setStyleName, setTabIndex, setVisible, setWidth, toStringprotected abstract com.vaadin.ui.AbstractField<?> createWidget()
FormComponentcreateWidget in class FormComponentpublic com.vaadin.ui.AbstractField<?> getWidget()
FormComponentgetWidget in class FormComponentpublic void setRequired(boolean required)
required - public boolean isRequired()
true if the field is required, otherwise
false.public void focus()
Component.Focusable.public boolean isImmediate()
Certain operations such as adding a value change listener will set the
component into immediate mode if setImmediate(boolean) has not
been explicitly called with false.
public void setImmediate(boolean immediate)
immediate - the boolean value specifying if the component should be in the
immediate mode after the call.public void setOnChange(ClosureHolder onChange)
onChange - protected void fireValueChanged()
public ClosureHolder getOnChange()
null if no closure was set.public void inferValidator(CollectionHolder tags)
tags - public void removeAllValidators()
public void addValidator(ClosureHolder validator)
validator - public boolean isConvertible()
isConvertible in class ComponentWithValue<T>true if the field value is convertible.public boolean isValid()
ComponentWithValueisValid in class ComponentWithValue<T>true if all registered validators claim that the
current value is valid or if the field is empty and not required,
false otherwise.public ListHolder getValidationErrors()
ComponentWithValuenull).
Note: does NOT contain error set by from FormComponent.setCustomErrorMessage(java.lang.String) method.getValidationErrors in class ComponentWithValue<T>public void preventGC(Set<ValueHolder> set)
FormComponentWTabSheet maintains a set of opened tabs. These tab records are not referenced
directly from forms::TabSheet and will therefore be garbage-collected. We however need those records to not to be GCed as the user
may ask for them simply by calling getTab(Integer).
Please note that the component definition records (e.g. forms::Button) are already GC-protected and they do not need to be added to this set.
Also, any child components currently attached to the UI are automatically protected and are not required to be registered in the set.preventGC in class ComponentWithValue<T>set - a set of records which are to be GC-prevented, never null. The component should add any records here.
Default implementation does nothing.protected void writeInternalState(Map<String,Object> state)
FormComponentMany UI attributes such as size, caption, etc. are not held in the records but are stored exclusively in the Vaadin components. In the records the getter/setter methods of such attributes directly delegate to the underlying component. For the purposes of the Save Document/Todo use case the state of such attributes has to be preserved.
Subclasses should override this method. The overriding method should call
super.writeInternalState(state) to store the state form the super
class as well. The attributes should be written to the provided state
parameter. The type of the values written to the state can only by
Java representation of LSPS types. That is java.util.Date,
java.lang.String, Decimal, RecordHolder,
ListHolder, ... The name of the attributes stored in the map
should be unique and should not collide with the names used by any
of the superclass. It is the responsibility of the overridden method to ensure
that.
Subclasses overriding this method should also override
FormComponent.restoreInternalState(Map) and restore the state written
by this method.
writeInternalState in class ComponentWithValue<T>state - a map to which this method should write the component's UI state.FormComponent.restoreInternalState(Map),
FormComponent.saveState()protected void restoreInternalState(Map<String,Object> state)
FormComponentFormComponent.writeInternalState(Map).
Subclasses should override and call super.restoreInternalState(state);restoreInternalState in class ComponentWithValue<T>state - a map of attributes and their valuesFormComponent.writeInternalState(Map)Copyright © 2007-2018 Whitestein Technologies. All Rights Reserved.