Statistics
| Revision:

svn-gvsig-desktop / tags / v1_1_Build_1003 / frameworks / _fwAndami / src / com / iver / andami / ui / mdiManager / MDIManager.java @ 12271

History | View | Annotate | Download (9.39 KB)

1 1104 fjp
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
 *
3 11943 cesar
 * Copyright (C) 2004-2007 IVER T.I. and Generalitat Valenciana.
4 1104 fjp
 *
5
 * This program is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU General Public License
7
 * as published by the Free Software Foundation; either version 2
8
 * of the License, or (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program; if not, write to the Free Software
17
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
18
 *
19
 * For more information, contact:
20
 *
21
 *  Generalitat Valenciana
22
 *   Conselleria d'Infraestructures i Transport
23
 *   Av. Blasco Ib??ez, 50
24
 *   46010 VALENCIA
25
 *   SPAIN
26
 *
27
 *      +34 963862235
28
 *   gvsig@gva.es
29
 *      www.gvsig.gva.es
30
 *
31
 *    or
32
 *
33
 *   IVER T.I. S.A
34
 *   Salamanca 50
35
 *   46005 Valencia
36
 *   Spain
37
 *
38
 *   +34 963163400
39
 *   dac@iver.es
40
 */
41 598 fernando
package com.iver.andami.ui.mdiManager;
42
43 3249 fjp
import java.beans.PropertyVetoException;
44
45 9301 caballero
import javax.swing.ImageIcon;
46
47 598 fernando
import com.iver.andami.ui.mdiFrame.MDIFrame;
48
49
50
/**
51 11943 cesar
 * <p>
52
 * This interface acts as window manager. It is the place to create
53
 * new windows, close existing ones or modify their properties
54
 * (size, position, etc).
55
 * </p>
56
 * <p>
57
 * Any class extending from JPanel and implementing the {@link IWindow}
58
 * interface may become an Andami window. Andami will create a real
59
 * window (normally a JInternalFrame) and put the JPanel inside the
60
 * real window. In order to differentiate the contents (panels
61
 * extending JPanel and implementing IWindow) from the real window
62
 * (normally JInternalFrames or JDialogs), we will use
63
 * <i>window</i> to refer to the contents and <i>frame</i>
64
 * to refer to the real window.
65
 * </p>
66
 * <p>
67
 * This class is implemented by the Andami Skin (currently libCorePlugin),
68
 * which will decide the final implementation of frames. A different frame
69
 * implementation could be used by switching the Skin.
70
 * </p>
71
 *
72
 * @see IWindow
73
 * @see WindowInfo
74
 * @see SingletonWindow
75
 * @see com.iver.core.mdiManager.NewSkin
76 598 fernando
 *
77
 * @author Fernando Gonz?lez Cort?s
78
 */
79
public interface MDIManager {
80 2553 caballero
    /**
81 11943 cesar
     * Initializes the MDIFrame. It must be called before starting
82
     * to use it. It receives the application's main frame
83
     * (MDIFrame) as parameter.
84 2553 caballero
     *
85 11943 cesar
     * @param f Application's main frame.
86 2553 caballero
     */
87
    public void init(MDIFrame f);
88 598 fernando
89 2553 caballero
    /**
90 11943 cesar
     * <p>
91
     * Creates a new frame with the provided contents, and shows this
92
     * new window. The new frame's properties are set according to
93
     * the WindowInfo object from IWindow's <code>getWindowInfo()</code>
94
     * method.
95
     * The new frame is disposed when closed.
96
     * </p>
97
     * <p>
98
     * If the provided IWindow also implements SingletonWindow, and
99
     * another SingletonWindow already exists and uses the same
100
     * model, this later window will be sent to the foreground
101
     * and no new window will be created.
102
     * </p>
103 2553 caballero
     *
104 11943 cesar
     * @param p Panel with the contents of the new window.
105 2553 caballero
     *
106 11943 cesar
     * @return Returns the added IWindow, or in case it is a
107
     * SingletonWindow and there is another SingletonWindow with
108
     * the same model that it is already shown, returns this
109
     * later SingletonWindow.
110 2553 caballero
     */
111 6880 cesar
    public IWindow addWindow(IWindow p) throws SingletonDialogAlreadyShownException;
112 598 fernando
113 2553 caballero
    /**
114 11943 cesar
     * <p>
115
     * Creates a new frame with the provided contents, and shows this
116
     * new window. The new frame will be centered, regardless the
117
     * position specified in the WindowInfo object from IWindow's
118
     * <code>getWindowInfo()</code> method.
119
     * The new frame is disposed when closed.
120
     * </p>
121
     * <p>
122
     * If the provided IWindow also implements SingletonWindow, and
123
     * another SingletonWindow already exists and uses the same
124
     * model, this later window will be sent to the foreground
125
     * and no new window will be created.
126
     * </p>
127 9301 caballero
     *
128 11943 cesar
     * @param p Panel with the contents of the new window.
129 6863 ppiqueras
     *
130 11943 cesar
     * @return Returns the added IWindow, or in case it is a
131
     * SingletonWindow and there is another SingletonWindow with
132
     * the same model that it is already shown, returns this
133
     * later SingletonWindow.
134
     *
135
     * @author Pablo Piqueras Bartolom?
136 6863 ppiqueras
     */
137 6880 cesar
    public IWindow addCentredWindow(IWindow p) throws SingletonDialogAlreadyShownException;
138 9301 caballero
139 6863 ppiqueras
    /**
140 11943 cesar
     * <p>
141
     * Returns the currently active window, excluding the modal windows and the
142
     * PALETTE windows. If the currently active window is modal or PALETTE type,
143
     * the previous non-modal and non-PALETTE active window is returned.
144
     * </p>
145
     * <p>
146
     * Modal windows and PALETTE windows are considered to be auxiliary windows,
147
     * that is the reason why they are not returned.
148
     * </p>
149 2553 caballero
     *
150 11943 cesar
     * @return A reference to the active window, or null if there is no
151
     * active window
152 2553 caballero
     */
153 6880 cesar
    public IWindow getActiveWindow();
154 11943 cesar
155 2553 caballero
    /**
156 11943 cesar
     * <p>
157
     * Returns the currently focused window, excluding the modal windows.
158
     * If the currently focused window is modal,
159
     * the previous non-modal focused window is returned.
160
     * </p>
161 4726 caballero
     *
162 11943 cesar
     * @return A reference to the focused window, or null if there is no
163
     * focused window
164 4726 caballero
     */
165 6880 cesar
    public IWindow getFocusWindow();
166 11943 cesar
167 4726 caballero
    /**
168 11943 cesar
     * Gets all the open windows. Minimized and maximized windows are
169
     * included. The application's main frame is excluded; it can be
170
     * accessed using <code>PluginServices.getMainFrame()</code>.
171 2553 caballero
     *
172 11943 cesar
     * @return An IWindow array containing all the open windows.
173 2553 caballero
     */
174 6880 cesar
    public IWindow[] getAllWindows();
175 11977 cesar
176 7430 cesar
    /**
177 11977 cesar
     * Gets all the open windows (as {@link #getAllWindows()}),
178
     * but in this method the windows are returned in the same
179
     * deepness order that they have in the application.
180 9301 caballero
     *
181 11977 cesar
     * @return   An ordered array containing all the panels in the application.
182 7430 cesar
     * The first element of the array is the topmost (foreground) window in the
183 11943 cesar
     * application. The last element is the bottom (background) window.
184 7430 cesar
     */
185
    public IWindow[] getOrderedWindows();
186 598 fernando
187 2553 caballero
    /**
188 11977 cesar
     * Close the SingletonWindow whose class and model are provided as
189
     * parameters.
190
     *
191
     * @param viewClass Class of the window which is to be closed
192
     * @param model Model of the window which is to be closed
193 2553 caballero
     *
194 11977 cesar
     * @return true if there is an open window whose class and model
195
     *         match the provided parameteres, false otherwise.
196 2553 caballero
     */
197 6880 cesar
    public boolean closeSingletonWindow(Class viewClass, Object model);
198 598 fernando
199 2553 caballero
    /**
200 11977 cesar
     * Close the SingletonWindow whose model is provided as parameter.
201 2553 caballero
     *
202 11977 cesar
     * @param model Model of the window which is to be closed
203 2553 caballero
     *
204 11977 cesar
     * @return true if there is an open window whose model matchs
205
     *         the provided one, false otherwise.
206 2553 caballero
     */
207 6880 cesar
    public boolean closeSingletonWindow(Object model);
208 598 fernando
209 2553 caballero
    /**
210 11977 cesar
     * Close the provided window.
211 2553 caballero
     *
212 11977 cesar
     * @param p window to be closed
213 2553 caballero
     */
214 6880 cesar
    public void closeWindow(IWindow p);
215 598 fernando
216 2553 caballero
    /**
217 11977 cesar
     * Close all the currently open windows
218 2553 caballero
     */
219 6880 cesar
    public void closeAllWindows();
220 1323 fernando
221 2553 caballero
    /**
222 11977 cesar
     * Gets the WindowInfo object associated with the provided window.
223 2553 caballero
     *
224 11977 cesar
     * @param v window whose information is to be retrieved
225 2553 caballero
     *
226 11977 cesar
     * @return WindowInfo The WindowInfo object containing the information
227
     * about the provided window
228
     *
229
     * @see WindowInfo
230 2553 caballero
     */
231 6880 cesar
    public WindowInfo getWindowInfo(IWindow v);
232 1323 fernando
233 2553 caballero
    /**
234 11977 cesar
     * Shows the wait cursor and blocks all the events from main window until
235
     * {@link #restoreCursor()} is called.
236 2553 caballero
     */
237
    public void setWaitCursor();
238
239
    /**
240 11977 cesar
     * Sets the normal cursor and unblocks events from main window.
241
     *
242
     * @see #setWaitCursor()
243 2553 caballero
     */
244
    public void restoreCursor();
245 4726 caballero
246 3249 fjp
    /**
247 11977 cesar
     * Maximizes or restores the provided window
248
     *
249
     * @param v The window to be maximized or restored
250
     * @param bMaximum If true, the window will be maximized,
251
     *  if false, it will be restored
252 3249 fjp
     * @throws PropertyVetoException
253
     */
254 6877 cesar
    public void setMaximum(IWindow v, boolean bMaximum) throws PropertyVetoException;
255 11977 cesar
256 4726 caballero
    /**
257 11977 cesar
     * Updates the window properties (size, location, etc) according to the
258
     * provided WindowInfo object.
259
     *
260
     * @param v The window whose properties are to be changed
261
     * @param vi The WindowInfo object containing the new properties to be set
262 4726 caballero
     */
263 6880 cesar
    public void changeWindowInfo(IWindow v, WindowInfo vi);
264 8899 cesar
265 11977 cesar
    /**
266
     * Forces a window to be repainted. Normally, this is not necessary,
267
     * as windows are refreshed when necessary.
268
     *
269
     * @param win The window to be refreshed.
270
     */
271 8899 cesar
    public void refresh(IWindow win);
272 9301 caballero
273 11977 cesar
    /**
274
     * Sets the provided image as background image in the main window. The image
275
     * will be centered, set in mosaic or expanded to fill the full window,
276
     * depending on the <code>typeDesktop</code> argument.
277
     *
278
     * @param image The image to be set as background image
279
     * @param typeDesktop Decides whether the image should be centered, set
280
     * in mosaic or expanded. Accepted values are: Theme.CENTERED,
281
     * Theme.MOSAIC and Theme.EXPAND.
282
     */
283 9301 caballero
        public void setBackgroundImage(ImageIcon image, String typeDesktop);
284 598 fernando
}