public interface IFormPart
The form part has two 'out of sync' states in respect to the model(s) that feed the form: dirty and stale. When a part is dirty, it means that the user interacted with it and now its widgets contain state that is newer than the model. In order to sync up with the model, 'commit' needs to be called. In contrast, the model can change 'under' the form (as a result of some actions outside the form), resulting in data in the model being 'newer' than the content presented in the form. A 'stale' form part is brought in sync with the model by calling 'refresh'. The part is responsible for notifying the form when one of these states change in the part. The form reserves the right to handle this notification in the most appropriate way for the situation (for example, if the form is in a page of the multi-page editor, it may do nothing for stale parts if the page is currently not showing).
When the form is disposed, each registered part is disposed as well. Parts are responsible for releasing any system resources they created and for removing themselves as listeners from all event providers.
IManagedForm
Modifier and Type | Method and Description |
---|---|
void |
commit(boolean onSave)
If part is displaying information loaded from a model, this method
instructs it to commit the new (modified) data back into the model.
|
void |
dispose()
Disposes the part allowing it to release allocated resources.
|
void |
initialize(IManagedForm form)
Initializes the part.
|
boolean |
isDirty()
Returns true if the part has been modified with respect to the data
loaded from the model.
|
boolean |
isStale()
Tests whether the form part is stale and needs refreshing.
|
void |
refresh()
Refreshes the part completely from the information freshly obtained from
the model.
|
void |
setFocus()
Instructs form part to transfer focus to the widget that should has focus
in that part.
|
boolean |
setFormInput(java.lang.Object input)
Notifies the part that an object has been set as overall form's input.
|
void initialize(IManagedForm form)
form
- the managed form that manages the partvoid dispose()
boolean isDirty()
void commit(boolean onSave)
onSave
- indicates if commit is called during 'save' operation or for
some other reason (for example, if form is contained in a
wizard or a multi-page editor and the user is about to leave
the page).boolean setFormInput(java.lang.Object input)
true
if the part has selected and revealed the
input object, false
otherwise.void setFocus()
boolean isStale()
It is important to differentiate 'stale' and 'dirty' states. Part is 'dirty' if user interacted with its editable widgets and changed the values. In contrast, part is 'stale' when the data it presents in the widgets has been changed in the model without direct user interaction.
true
if the part needs refreshing,
false
otherwise.void refresh()
Copyright © 2007–2020. All rights reserved.