]> git.argeo.org Git - lgpl/argeo-commons.git/blob - org.argeo.cms.ui/src/org/argeo/cms/ui/eclipse/forms/IManagedForm.java
Make CMS Login more robust
[lgpl/argeo-commons.git] / org.argeo.cms.ui / src / org / argeo / cms / ui / eclipse / forms / IManagedForm.java
1 package org.argeo.cms.ui.eclipse.forms;
2
3 import org.eclipse.jface.viewers.ISelection;
4 //import org.eclipse.ui.forms.widgets.FormToolkit;
5 //import org.eclipse.ui.forms.widgets.ScrolledForm;
6
7 /**
8 * Managed form wraps a form widget and adds life cycle methods for form parts.
9 * A form part is a portion of the form that participates in form life cycle
10 * events.
11 * <p>
12 * There is no 1/1 mapping between widgets and form parts. A widget like Section
13 * can be a part by itself, but a number of widgets can gather around one form
14 * part.
15 * <p>
16 * This interface should not be extended or implemented. New form instances
17 * should be created using ManagedForm.
18 *
19 * @see ManagedForm
20 * @since 1.0
21 * @noimplement This interface is not intended to be implemented by clients.
22 * @noextend This interface is not intended to be extended by clients.
23 */
24 public interface IManagedForm {
25 /**
26 * Initializes the form by looping through the managed parts and
27 * initializing them. Has no effect if already called once.
28 */
29 public void initialize();
30
31 /**
32 * Returns the toolkit used by this form.
33 *
34 * @return the toolkit
35 */
36 public FormToolkit getToolkit();
37
38 /**
39 * Returns the form widget managed by this form.
40 *
41 * @return the form widget
42 */
43 // public ScrolledForm getForm();
44
45 /**
46 * Reflows the form as a result of the layout change.
47 *
48 * @param changed
49 * if <code>true</code>, discard cached layout information
50 */
51 public void reflow(boolean changed);
52
53 /**
54 * A part can use this method to notify other parts that implement
55 * IPartSelectionListener about selection changes.
56 *
57 * @param part
58 * the part that broadcasts the selection
59 * @param selection
60 * the selection in the part
61 */
62 public void fireSelectionChanged(IFormPart part, ISelection selection);
63
64 /**
65 * Returns all the parts currently managed by this form.
66 *
67 * @return the managed parts
68 */
69 IFormPart[] getParts();
70
71 /**
72 * Adds the new part to the form.
73 *
74 * @param part
75 * the part to add
76 */
77 void addPart(IFormPart part);
78
79 /**
80 * Removes the part from the form.
81 *
82 * @param part
83 * the part to remove
84 */
85 void removePart(IFormPart part);
86
87 /**
88 * Sets the input of this page to the provided object.
89 *
90 * @param input
91 * the new page input
92 * @return <code>true</code> if the form contains this object,
93 * <code>false</code> otherwise.
94 */
95 boolean setInput(Object input);
96
97 /**
98 * Returns the current page input.
99 *
100 * @return page input object or <code>null</code> if not applicable.
101 */
102 Object getInput();
103
104 /**
105 * Tests if form is dirty. A managed form is dirty if at least one managed
106 * part is dirty.
107 *
108 * @return <code>true</code> if at least one managed part is dirty,
109 * <code>false</code> otherwise.
110 */
111 boolean isDirty();
112
113 /**
114 * Notifies the form that the dirty state of one of its parts has changed.
115 * The global dirty state of the form can be obtained by calling 'isDirty'.
116 *
117 * @see #isDirty
118 */
119 void dirtyStateChanged();
120
121 /**
122 * Commits the dirty form. All pending changes in the widgets are flushed
123 * into the model.
124 *
125 * @param onSave
126 */
127 void commit(boolean onSave);
128
129 /**
130 * Tests if form is stale. A managed form is stale if at least one managed
131 * part is stale. This can happen when the underlying model changes,
132 * resulting in the presentation of the part being out of sync with the
133 * model and needing refreshing.
134 *
135 * @return <code>true</code> if the form is stale, <code>false</code>
136 * otherwise.
137 */
138 boolean isStale();
139
140 /**
141 * Notifies the form that the stale state of one of its parts has changed.
142 * The global stale state of the form can be obtained by calling 'isStale'.
143 */
144 void staleStateChanged();
145
146 /**
147 * Refreshes the form by refreshing every part that is stale.
148 */
149 void refresh();
150
151 /**
152 * Sets the container that owns this form. Depending on the context, the
153 * container may be wizard, editor page, editor etc.
154 *
155 * @param container
156 * the container of this form
157 */
158 void setContainer(Object container);
159
160 /**
161 * Returns the container of this form.
162 *
163 * @return the form container
164 */
165 Object getContainer();
166
167 /**
168 * Returns the message manager that will keep track of messages in this
169 * form.
170 *
171 * @return the message manager instance
172 */
173 // IMessageManager getMessageManager();
174 }