]>
git.argeo.org Git - gpl/argeo-jcr.git/blob - org.argeo.cms.jcr.ui/src/org/argeo/cms/ui/eclipse/forms/AbstractFormPart.java
4ce468826735c459ee765c5ac0b32c60a609d533
1 package org
.argeo
.cms
.ui
.eclipse
.forms
;
3 * AbstractFormPart implements IFormPart interface and can be used as a
4 * convenient base class for concrete form parts. If a method contains
5 * code that must be called, look for instructions to call 'super'
8 * @see org.eclipse.ui.forms.widgets.Section
11 public abstract class AbstractFormPart
implements IFormPart
{
12 private IManagedForm managedForm
;
13 private boolean dirty
= false;
14 private boolean stale
= true;
16 * @see org.eclipse.ui.forms.IFormPart#initialize(org.eclipse.ui.forms.IManagedForm)
18 public void initialize(IManagedForm form
) {
19 this.managedForm
= form
;
22 * Returns the form that manages this part.
24 * @return the managed form
26 public IManagedForm
getManagedForm() {
30 * Disposes the part. Subclasses should override to release any system
33 public void dispose() {
36 * Commits the part. Subclasses should call 'super' when overriding.
39 * <code>true</code> if the request to commit has arrived as a
40 * result of the 'save' action.
42 public void commit(boolean onSave
) {
46 * Sets the overall form input. Subclases may elect to override the method
47 * and adjust according to the form input.
50 * the form input object
51 * @return <code>false</code>
53 public boolean setFormInput(Object input
) {
57 * Instructs the part to grab keyboard focus.
59 public void setFocus() {
62 * Refreshes the section after becoming stale (falling behind data in the
63 * model). Subclasses must call 'super' when overriding this method.
65 public void refresh() {
67 // since we have refreshed, any changes we had in the
68 // part are gone and we are not dirty
72 * Marks the part dirty. Subclasses should call this method as a result of
73 * user interaction with the widgets in the section.
75 public void markDirty() {
77 managedForm
.dirtyStateChanged();
80 * Tests whether the part is dirty i.e. its widgets have state that is
81 * newer than the data in the model.
83 * @return <code>true</code> if the part is dirty, <code>false</code>
86 public boolean isDirty() {
90 * Tests whether the part is stale i.e. its widgets have state that is
91 * older than the data in the model.
93 * @return <code>true</code> if the part is stale, <code>false</code>
96 public boolean isStale() {
100 * Marks the part stale. Subclasses should call this method as a result of
101 * model notification that indicates that the content of the section is no
102 * longer in sync with the model.
104 public void markStale() {
106 managedForm
.staleStateChanged();