public abstract class AbstractField extends java.lang.Object implements IField
IField composed of:
Label[--- label ---] [-------- edition control -------- ] [---button --- ] [-------------------- help text -------------------]where the help text if folded/unfolded by the help button. The class is in charge of creating the different widgets and of their layout. The creation of the edition control is delegated to concrete sub-classes.
| Modifier and Type | Field and Description |
|---|---|
protected java.beans.PropertyChangeSupport |
changeSupport |
PROP_VALUE| Constructor and Description |
|---|
AbstractField(FormToolkit toolkit,
Composite parent) |
AbstractField(FormToolkit toolkit,
Composite parent,
IFormFieldData model) |
| 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.
|
abstract Control |
createControl(FormToolkit tk,
Composite p)
Create the edition control.
|
protected void |
fireValueChanged(java.lang.Object oldValue,
java.lang.Object newValue) |
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.
|
protected Label |
getHelpText() |
Label |
getLabel() |
IFormFieldData |
getModel()
Gets the IfieldData model of this field.
|
java.lang.String |
getValidationError()
Default implementation that always return null.
|
boolean |
isVertical() |
void |
layout(Label lbl,
Control ctrl,
ImageHyperlink button)
Layouts the label, edition control and help button in their container (
IField.getComposite()) |
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) |
void |
setVertical(boolean value) |
public AbstractField(FormToolkit toolkit,
Composite parent,
IFormFieldData model)
public AbstractField(FormToolkit toolkit,
Composite parent)
public boolean isVertical()
public void setVertical(boolean value)
public final void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
IFieldaddPropertyChangeListener in interface IFieldlistener - a listenerIField.PROP_VALUEpublic void apply()
IFieldMay throw a runtime exception if the field value is not valid.
public abstract Control createControl(FormToolkit tk,
Composite p)
tk - the FormToolkitp - the parent compositepublic final Composite getComposite()
Composite.getComposite in interface IFieldpublic Control getControl()
getControl in interface IFieldpublic final Label getLabel()
public final IFormFieldData getModel()
public java.lang.String getValidationError()
Should be redefined if the implementation widget may contain invalid values.
getValidationError in interface IFieldIField.apply() may be called safely, an error message in other cases.public void layout(Label lbl,
Control ctrl,
ImageHyperlink button)
IFieldIField.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).
public final void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
IFieldremovePropertyChangeListener in interface IFieldlistener - the listener to remove.public void setEditable(boolean onoff)
setEditable in interface IFieldpublic final void setHelpText(java.lang.String s)
IFieldsetHelpText in interface IFieldpublic void setModel(IFormFieldData data)
protected void fireValueChanged(java.lang.Object oldValue,
java.lang.Object newValue)
protected Label getHelpText()