public interface FormComponent extends FormChangeableComponent
Tentackle beans derived from Swing components that the user interacts
with in order to edit some data are FormComponents.
FormComponents are aware of the binding between the data and the GUI
and provide a standardized way to update the view and the data, vice versa.
This simplifies the development and design of the GUI significantly.
| Modifier and Type | Method and Description |
|---|---|
void |
addValueListener(ValueListener listener)
Adds a value listener that implements the binding between this component
and the data.
|
void |
clearValueShownModified()
Clears the value shown status.
May be used by components that update the value shown programmatically. |
void |
fireValueChanged()
Fires all value listeners registered on this component
invoking their
valueChanged-handler.This method is invoked whenever the data has been changed and that change should be reflected in the view. |
void |
fireValueEntered()
Fires all listeners registered on this component
invoking their
valueEntered-handler.This method is invoked whenever the user edited the view and that change should be reflected in the data. |
int |
getBaseline(int width,
int height)
Returns the baseline of this component.
|
FormComponentBinding |
getBinding()
Gets the binding.
|
String |
getBindingPath()
Gets the binding path.
|
String |
getComponentPath()
Gets the component path.
|
FocusTraversalGroup |
getFocusTraversalGroup()
Gets the focus traversal group for this component.
|
Object |
getFormValue()
Retrieves the value from this component.
The method is used to update the data model if the view has changed because the user edited it. |
String |
getHelpURL()
Gets the online-help URL.
|
Window |
getParentWindow()
Gets the parent window of this component.
|
PropertyGroup |
getPropertyGroup()
Gets the property group for this component.
|
Object |
getValueShown()
Gets the value shown to the user.
This is the visual representation, not necessarily the model's value. |
boolean |
hasFocus()
Returns whether this component has the keyboard focus.
|
void |
invalidateParentInfo()
Invalidates all container-relevant (cached) information
for the hierarchy of this component's parents.
For optimization purposes. |
boolean |
isAutoUpdate()
Returns whether the auto-update feature is enabled.
|
boolean |
isBindable()
Determines whether this component is bindable.
|
boolean |
isCellEditorUsage()
Returns whether this component is used as a cell editor.
|
boolean |
isFireRunning()
Checks whether a fire-method is running.
|
boolean |
isFormTraversable()
Returns whether this component is form traversable or not.
|
boolean |
isMandatory()
Gets the mandatory option.
|
boolean |
isSmartValueEntered()
Returns whether the model should only be updated
if the component's value really changed.
The default is true. |
boolean |
isTriggerValueChangedEnabled()
Determines whether triggering value changes is enabled.
|
boolean |
isValueChanged()
Checks whether the contents have been changed since the last savepoint.
|
boolean |
isValueShownModified()
Checks whether the currently shown value differs
from the initially shown.
Used to implement smartValueEntered. |
void |
prepareFocusLost()
Prepares for FOCUS_LOST.
Gives this component the opportunity to invoke fireValueEntered() earlier than FOCUS_LOST is really received. |
void |
removeValueListener(ValueListener listener)
Remove a value listener.
|
void |
requestFocusLater()
Requests the keyboard focus for this component by appending
an event to the end of the event queue.
Applications should not use requestFocus() or requestFocusInWindow() unless the order in which the events are processed is unimportant. |
void |
saveValue()
Sets a savepoint for the data of this component.
Allows to decide whether the user has changed the data associated with this component or not. |
void |
setAutoUpdate(boolean autoUpdate)
Sets the auto-update feature.
By default, all components update the data model if the view changes (due to certain events, for example focus lost). |
void |
setBindable(boolean bindable)
Sets whether this component is bindable.
|
void |
setBinding(FormComponentBinding binding)
Sets the binding.
|
void |
setBindingPath(String bindingPath)
Sets the path to bind this component to.
|
void |
setCellEditorUsage(boolean cellEditorUsage)
Sets a hint that this component is used as a cell editor.
Some components behave differently in tables than in forms, for example. |
void |
setComponentPath(String componentPath)
Sets the component path.
|
void |
setFireRunning(boolean fireRunning)
Sets a component's flag that a fire-method is currently running.
Used by the framework to minimize valueChanged/valueEntered processing. |
void |
setFocusTraversalGroup(FocusTraversalGroup group)
Sets the focus traversal group for this component.
|
void |
setFormTraversable(boolean formTraversable)
Sets whether this component is form traversable or not, i.e.
|
void |
setFormValue(Object object)
Sets a value in this component.
The method is used to update the view if the data has changed. |
void |
setFormWrapWindow(FormWindow window)
Sets the window that will fire a
FormWrapEvent when this
components loses the keyboard focus. |
void |
setHelpURL(String helpURL)
Sets the online-help URL.
If a help url is set for this component, a browser will be launched to show that url. |
void |
setMandatory(boolean mandatory)
Sets the mandatory option.
Mandatory fields are differently visualized. |
void |
setPropertyGroup(PropertyGroup group)
Sets the property group for this component.
|
void |
setSmartValueEntered(boolean smartValueEntered)
Sets whether the model should only be updated
if the component's value really changed.
The default is true. |
void |
setTriggerValueChangedEnabled(boolean enabled)
Enables triggering value changes.
Disabling this feature may be necessary for model-agnostic components. |
void |
showErrorPopup(String message)
Shows the error popup for a given message.
The popup component used is an ErrorToolTip. |
void |
showHelp()
Displays online help for this component.
Usually triggered by KeyEvent.VK_F1 or VK_HELP or a button. |
void |
transferFocus()
Transfers keyboard focus forward to the logically next component.
|
void |
transferFocusBackward()
Transfers keyboard focus forward to the logically previous component.
|
void |
triggerValueChanged()
Promotes the fact that value changed to all
FormContainers this
component is a child of. |
boolean |
wasFocusGainedFromTransfer()
Returns whether the keyboard focus was gained due to
transferFocus()
in the opposite component. |
boolean |
wasFocusGainedFromTransferBackward()
Returns whether the keyboard focus was gained due to
transferFocusBackward()
in the opposite component. |
boolean |
wasTransferFocus()
Returns whether this component lost the keyboard focus due to
transferFocus(). |
boolean |
wasTransferFocusBackward()
Returns whether this component lost the keyboard focus due to
transferFocusBackward(). |
boolean |
wasTransferFocusByEnter()
Returns whether this component lost the keyboard focus due to
KeyEvent.VK_ENTER. |
updateAllChangeableisChangeable, isHonourChangeable, setChangeable, setHonourChangeablevoid setFormValue(Object object)
object - is the object to setObject getFormValue()
Object getValueShown()
boolean isValueShownModified()
void clearValueShownModified()
void setSmartValueEntered(boolean smartValueEntered)
smartValueEntered - true if optimize, false if always update the modelboolean isSmartValueEntered()
void saveValue()
isValueChanged()boolean isValueChanged()
saveValue()void triggerValueChanged()
FormContainers this
component is a child of.void setTriggerValueChangedEnabled(boolean enabled)
enabled - true if invoke triggerValueChanged() on each change (default), false if not.boolean isTriggerValueChangedEnabled()
triggerValueChanged() on each change (default), false if not.void setAutoUpdate(boolean autoUpdate)
autoUpdate - true if auto update the data (default), false if notboolean isAutoUpdate()
void addValueListener(ValueListener listener)
listener - the value listener to addvoid removeValueListener(ValueListener listener)
listener - the value listener to removevoid fireValueChanged()
valueChanged-handler.void fireValueEntered()
valueEntered-handler.void setMandatory(boolean mandatory)
mandatory - true if mandatoryboolean isMandatory()
void setFireRunning(boolean fireRunning)
fireRunning - true if some fire-method is runningboolean isFireRunning()
boolean wasTransferFocus()
transferFocus().boolean wasTransferFocusBackward()
transferFocusBackward().boolean wasTransferFocusByEnter()
KeyEvent.VK_ENTER.boolean wasFocusGainedFromTransfer()
transferFocus()
in the opposite component.FormFocusTraversalPolicyboolean wasFocusGainedFromTransferBackward()
transferFocusBackward()
in the opposite component.FormFocusTraversalPolicyvoid requestFocusLater()
void setFormWrapWindow(FormWindow window)
FormWrapEvent when this
components loses the keyboard focus. When fired the reference
to the window is cleared.window - the window (usually the parent window of this component).Window getParentWindow()
void invalidateParentInfo()
void setHelpURL(String helpURL)
helpURL - the help urlFormUtilities.openHelpURL(Component)String getHelpURL()
void showHelp()
void showErrorPopup(String message)
ErrorToolTip.message - the message to be displayed, null to removevoid setCellEditorUsage(boolean cellEditorUsage)
cellEditorUsage - true if component is a cell editor, false if not.boolean isCellEditorUsage()
void prepareFocusLost()
void setFormTraversable(boolean formTraversable)
formTraversable - true if traversable, false if notboolean isFormTraversable()
void setFocusTraversalGroup(FocusTraversalGroup group)
group - the focus traversal groupFocusTraversalGroup getFocusTraversalGroup()
void setPropertyGroup(PropertyGroup group)
group - the property groupPropertyGroup getPropertyGroup()
void setBindingPath(String bindingPath)
Usually the binding path will be determined from the components declared name. However, it can be set programatically as well.
bindingPath - the binding path, for ex. "invoiceNumber", null if autobindingBinderString getBindingPath()
void setComponentPath(String componentPath)
The path is <declaring-class-name>.<field-name>. Example "de.krake.invoicer.InvoicePanel.customerNumberField".
Notice: the component path is set during binding.
componentPath - the component pathString getComponentPath()
void setBinding(FormComponentBinding binding)
binding - the binding, null if none.FormComponentBinding getBinding()
void setBindable(boolean bindable)
FormComponents are bindable by default.
bindable - true if bindable, else not eligible for the binding processboolean isBindable()
boolean hasFocus()
void transferFocus()
FormFocusTraversalPolicyvoid transferFocusBackward()
FormFocusTraversalPolicyint getBaseline(int width,
int height)
width - the width to get the baseline forheight - the height to get the baseline forTentackle - a domain driven enterprise framework