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