C
- type of the implementing JComponent
public interface FormularComponent<C extends JComponent>
JComponent
to be used as a FormularComponent
. A
FormularComponent
provides methods that allows the Formular
to
set and read values from the component automatically.Modifier and Type | Interface and Description |
---|---|
static interface |
FormularComponent.ValueChangeListener
Listener interface which is informed when the value changes.
|
Modifier and Type | Field and Description |
---|---|
static String |
DATA_FIELD_SEPARATOR
Separator which is used if a data field contains more entries, e.g.
|
Modifier and Type | Method and Description |
---|---|
void |
addValidator(Validator validator)
Adds a validator to this component
|
void |
addValueChangeListener(FormularComponent.ValueChangeListener l)
Registers a
FormularComponent.ValueChangeListener . |
Object |
getClientProperty(Object key)
Returns the value of the property with the specified key.
|
String |
getDataField()
Returns the name of the bound data field of this formular component.
|
Operator |
getFilterOperator()
Returns the operator used in
Formular.createCondition(String) |
String |
getFormularName()
Returns the name of the component in the formular context.
|
Object |
getFormularValue()
Returns the value of the component.
|
Validator[] |
getValidators()
Returns all validators of this component.
|
boolean |
hasStateChanged()
Checks if the component's state since the last call of
saveState() has changed. |
boolean |
isEnabled()
Determines whether this component is enabled or not.
|
boolean |
isMultiSelect()
Returns whether the component supports multi selection or not.
|
boolean |
isReadOnly()
Determines whether this component is only used to display values.
|
boolean |
isVisible()
Determines whether this component is visible or not.
|
void |
putClientProperty(Object key,
Object value)
Adds an arbitrary key/value "client property" to this component.
|
void |
removeValidator(Validator validator)
Removes a validator from this component
|
void |
restoreState()
Restores the internally saved state of the component.
|
void |
saveState()
Saves the state of the component internally.
|
void |
setDataField(String dataField)
Sets the name of the bound data field of this formular component.
|
void |
setFilterOperator(Operator filterOperator)
Sets the filter operator used in
Formular.createCondition(String) |
void |
setFormularValue(VirtualTable vt,
int columnIndex,
Object value)
Deprecated.
replaced by {@link #setFormularValue(VirtualTable, Map)
|
void |
setFormularValue(VirtualTable vt,
Map<String,Object> record)
Sets the value of the component, taking the value(s) of the record
according to
getDataField() . |
void |
setReadOnly(boolean readOnly)
Sets if this form component is only used to display values.
|
void |
validateState()
Calls
Validator.validate(Object) of all registered
Validator s. |
void |
validateState(Validation validation)
Calls
Validator.validate(Object) of all registered
Validator s. |
boolean |
verify()
Returns whether the component's value adheres all set constraints.
|
static final String DATA_FIELD_SEPARATOR
String getFormularName()
void setDataField(String dataField)
dataField
- the new bound data fieldString getDataField()
@Deprecated void setFormularValue(VirtualTable vt, int columnIndex, Object value)
value
. The value is formatted using the column format of the
provided VirtualTable
and columnIndex
.vt
- VirtualTable
to use the format fromcolumnIndex
- of the column to use the format fromvalue
- value to setvoid setFormularValue(VirtualTable vt, Map<String,Object> record)
getDataField()
.vt
- the underlying virtual tablerecord
- the data <column,value>Object getFormularValue()
void saveState()
A saved state can be restored using restoreState()
.
void restoreState()
The state of the component can be saved using saveState()
.
boolean hasStateChanged()
saveState()
has changed.true
if the component's state has changed,
false
otherwisevoid addValueChangeListener(FormularComponent.ValueChangeListener l)
FormularComponent.ValueChangeListener
.l
- the listener to registerboolean isMultiSelect()
A component that supports multi selection can have more than one selected item / value.
true
if the component supports multi
selection, false
otherwise.boolean verify()
This is a alternative method for validateState()
, but this
method returns a boolean depending on the validation's result and doesn't
throw an ValidationException
.
true
if the value of the component adheres all set
constraints; otherwise false
.void addValidator(Validator validator)
validator
- the validator to addvalidateState()
void removeValidator(Validator validator)
validator
- the validator to removevalidateState()
Validator[] getValidators()
If no validator is present an empty array is returned.
void validateState() throws ValidationException
Validator.validate(Object)
of all registered
Validator
s.ValidationException
verify()
void validateState(Validation validation) throws ValidationException
Validator.validate(Object)
of all registered
Validator
s.
Every ValidationException
is recorded in the
validation
object, and if
Validation.continueValidation(ValidationException)
returns
false
this exception is re-thrown by this method.
validation
- the validation process objectValidationException
verify()
Operator getFilterOperator()
Formular.createCondition(String)
void setFilterOperator(Operator filterOperator)
Formular.createCondition(String)
filterOperator
- the new filter operatorboolean isReadOnly()
true
if this component is only used to display
values.void setReadOnly(boolean readOnly)
readOnly
- true
to only display valuesboolean isVisible()
true
if the component is visible, false
otherwiseboolean isEnabled()
true
if the component is enabled, false
otherwisevoid putClientProperty(Object key, Object value)
The get/putClientProperty
methods provide access to a small
per-instance hashtable. Callers can use get/putClientProperty to annotate
components that were created by another module. For example, a layout
manager might store per child constraints this way. For example:
componentA.putClientProperty("to the left of",componentB);If value is
null
this method will remove the property.
Changes to client properties are reported with
PropertyChange
events. The name of the property (for the
sake of PropertyChange events) is key.toString()
.
The clientProperty
dictionary is not intended to support
large scale extensions to form nor should be it considered an alternative
to subclassing when designing a new component.
key
- the new client property keyvalue
- the new client property value; if null
this
method will remove the propertygetClientProperty(java.lang.Object)
Object getClientProperty(Object key)
putClientProperty
will return a non-
null
value.key
- the being queriednull
putClientProperty(java.lang.Object, java.lang.Object)
Copyright © 2003–2020 XDEV Software. All rights reserved.