KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > ui > forms > IManagedForm


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  *******************************************************************************/

11 package org.eclipse.ui.forms;
12
13 import org.eclipse.jface.viewers.ISelection;
14 import org.eclipse.ui.forms.widgets.FormToolkit;
15 import org.eclipse.ui.forms.widgets.ScrolledForm;
16
17 /**
18  * Managed form wraps a form widget and adds life cycle methods for form parts.
19  * A form part is a portion of the form that participates in form life cycle
20  * events.
21  * <p>
22  * There is no 1/1 mapping between widgets and form parts. A widget like Section
23  * can be a part by itself, but a number of widgets can gather around one form
24  * part.
25  * <p>
26  * This interface should not be extended or implemented. New form instances
27  * should be created using ManagedForm.
28  *
29  * @see ManagedForm
30  * @since 3.0
31  */

32 public interface IManagedForm {
33     /**
34      * Initializes the form by looping through the managed parts and
35      * initializing them. Has no effect if already called once.
36      *
37      * @since 3.1
38      */

39     public void initialize();
40
41     /**
42      * Returns the toolkit used by this form.
43      *
44      * @return the toolkit
45      */

46     public FormToolkit getToolkit();
47
48     /**
49      * Returns the form widget managed by this form.
50      *
51      * @return the form widget
52      */

53     public ScrolledForm getForm();
54
55     /**
56      * Reflows the form as a result of the layout change.
57      *
58      * @param changed
59      * if <code>true</code>, discard cached layout information
60      */

61     public void reflow(boolean changed);
62
63     /**
64      * A part can use this method to notify other parts that implement
65      * IPartSelectionListener about selection changes.
66      *
67      * @param part
68      * the part that broadcasts the selection
69      * @param selection
70      * the selection in the part
71      */

72     public void fireSelectionChanged(IFormPart part, ISelection selection);
73
74     /**
75      * Returns all the parts currently managed by this form.
76      *
77      * @return the managed parts
78      */

79     IFormPart[] getParts();
80
81     /**
82      * Adds the new part to the form.
83      *
84      * @param part
85      * the part to add
86      */

87     void addPart(IFormPart part);
88
89     /**
90      * Removes the part from the form.
91      *
92      * @param part
93      * the part to remove
94      */

95     void removePart(IFormPart part);
96
97     /**
98      * Sets the input of this page to the provided object.
99      *
100      * @param input
101      * the new page input
102      * @return <code>true</code> if the form contains this object,
103      * <code>false</code> otherwise.
104      */

105     boolean setInput(Object JavaDoc input);
106
107     /**
108      * Returns the current page input.
109      *
110      * @return page input object or <code>null</code> if not applicable.
111      */

112     Object JavaDoc getInput();
113
114     /**
115      * Tests if form is dirty. A managed form is dirty if at least one managed
116      * part is dirty.
117      *
118      * @return <code>true</code> if at least one managed part is dirty,
119      * <code>false</code> otherwise.
120      */

121     boolean isDirty();
122
123     /**
124      * Notifies the form that the dirty state of one of its parts has changed.
125      * The global dirty state of the form can be obtained by calling 'isDirty'.
126      *
127      * @see #isDirty
128      */

129     void dirtyStateChanged();
130
131     /**
132      * Commits the dirty form. All pending changes in the widgets are flushed
133      * into the model.
134      *
135      * @param onSave
136      */

137     void commit(boolean onSave);
138
139     /**
140      * Tests if form is stale. A managed form is stale if at least one managed
141      * part is stale. This can happen when the underlying model changes,
142      * resulting in the presentation of the part being out of sync with the
143      * model and needing refreshing.
144      *
145      * @return <code>true</code> if the form is stale, <code>false</code>
146      * otherwise.
147      */

148     boolean isStale();
149
150     /**
151      * Notifies the form that the stale state of one of its parts has changed.
152      * The global stale state of the form can be obtained by calling 'isStale'.
153      */

154     void staleStateChanged();
155
156     /**
157      * Refreshes the form by refreshing every part that is stale.
158      */

159     void refresh();
160
161     /**
162      * Sets the container that owns this form. Depending on the context, the
163      * container may be wizard, editor page, editor etc.
164      *
165      * @param container
166      * the container of this form
167      */

168     void setContainer(Object JavaDoc container);
169
170     /**
171      * Returns the container of this form.
172      *
173      * @return the form container
174      */

175     Object JavaDoc getContainer();
176
177     /**
178      * Returns the message manager that will keep track of messages in this
179      * form.
180      *
181      * @return the message manager instance
182      * @since 3.3
183      */

184     IMessageManager getMessageManager();
185 }
186
Popular Tags