public interface IField
A field is composed of:
IFormFieldData.getName()
model
to load and saves the value.
addPropertyChangeListener(PropertyChangeListener)
with PROP_VALUE
has key and the new value as event value. The old value may not be filled.
It is now up to the panel to decide whether the change should be applied immediately by calling apply()
or defer it until form validation. The caller should also check whether #canApply()
returns true
before doing so.
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
PROP_VALUE
'value changed' property change event key.
|
Modifier and Type | Method and Description |
---|---|
void |
addPropertyChangeListener(java.beans.PropertyChangeListener listener)
Add a change listener to this field
|
void |
apply()
Store the field value in the model.
|
Composite |
getComposite()
Gets the top most container control of the field which must be a
Composite . |
Control |
getControl()
Gets the control in charge of displaying/editing the field value.
|
IFormFieldData |
getModel()
Gets the IfieldData model of this field.
|
java.lang.String |
getValidationError()
Get the validation error message if the value is invalid.
|
void |
layout(Label label,
Control control,
ImageHyperlink helpButton)
Layouts the label, edition control and help button in their container (
getComposite() ) |
void |
refresh()
Refresh the value displayed by the field.
|
void |
removePropertyChangeListener(java.beans.PropertyChangeListener listener)
Remove a change listener
|
void |
setEditable(boolean onoff) |
void |
setHelpText(java.lang.String s)
Set the text to be displayed in the help field of the control.
|
void |
setModel(IFormFieldData data) |
static final java.lang.String PROP_VALUE
void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
listener
- a listenerPROP_VALUE
void apply()
May throw a runtime exception if the field value is not valid.
Composite getComposite()
Composite
.Control getControl()
IFormFieldData getModel()
java.lang.String getValidationError()
Returns null when the value is valid. Tells whether the value may be applied or it is invalid.
apply()
may be called safely, an error message in other cases.void layout(Label label, Control control, ImageHyperlink helpButton)
getComposite()
)
This method can be redefined by subclasses who need to change the standard layout for label, control and help button.
When it is called default LayoutData have already been applied to the widgets so that this method can typically either modify
or replace the existing LayoutData of the widgets.
The container layout is a FormLayout, therefore widget LayoutData must be FormData.
Note the the helpText will always be layouted so that it appears under the control (same width and X position).
void refresh()
The field will typically query its IFormFieldData
model and refresh its contents.
void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
listener
- the listener to remove.void setEditable(boolean onoff)
void setHelpText(java.lang.String s)
void setModel(IFormFieldData data)