Statistics
| Revision:

root / trunk / frameworks / _fwAndami / src / com / iver / andami / ui / mdiManager / MDIManager.java @ 32878

History | View | Annotate | Download (9.58 KB)

1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
 *
3
 * Copyright (C) 2004-2007 IVER T.I. and Generalitat Valenciana.
4
 *
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
package com.iver.andami.ui.mdiManager;
42

    
43
import java.beans.PropertyVetoException;
44

    
45
import javax.swing.ImageIcon;
46
import javax.swing.JMenuBar;
47

    
48
import com.iver.andami.ui.mdiFrame.MDIFrame;
49

    
50

    
51
/**
52
 * <p>
53
 * This interface acts as window manager. It is the place to create
54
 * new windows, close existing ones or modify their properties
55
 * (size, position, etc).
56
 * </p>
57
 * <p>
58
 * Any class extending from JPanel and implementing the {@link IWindow}
59
 * interface may become an Andami window. Andami will create a real
60
 * window (normally a JInternalFrame) and put the JPanel inside the
61
 * real window. In order to differentiate the contents (panels
62
 * extending JPanel and implementing IWindow) from the real window
63
 * (normally JInternalFrames or JDialogs), we will use
64
 * <i>window</i> to refer to the contents and <i>frame</i>
65
 * to refer to the real window.
66
 * </p>
67
 * <p>
68
 * This class is implemented by the Andami Skin (currently libCorePlugin),
69
 * which will decide the final implementation of frames. A different frame
70
 * implementation could be used by switching the Skin.
71
 * </p>
72
 * 
73
 * @see IWindow
74
 * @see WindowInfo
75
 * @see SingletonWindow
76
 * @see com.iver.core.mdiManager.NewSkin
77
 *
78
 * @author Fernando Gonz?lez Cort?s
79
 */
80
public interface MDIManager {
81
    /**
82
     * Initializes the MDIFrame. It must be called before starting
83
     * to use it. It receives the application's main frame
84
     * (MDIFrame) as parameter.  
85
     *
86
     * @param f Application's main frame.
87
     */
88
    public void init(MDIFrame f);
89

    
90
    /**
91
     * <p>
92
     * Creates a new frame with the provided contents, and shows this
93
     * new window. The new frame's properties are set according to
94
     * the WindowInfo object from IWindow's <code>getWindowInfo()</code>
95
     * method.
96
     * The new frame is disposed when closed. 
97
     * </p>
98
     * <p>
99
     * If the provided IWindow also implements SingletonWindow, and
100
     * another SingletonWindow already exists and uses the same
101
     * model, this later window will be sent to the foreground
102
     * and no new window will be created.
103
     * </p>
104
     *
105
     * @param p Panel with the contents of the new window.
106
     *
107
     * @return Returns the added IWindow, or in case it is a
108
     * SingletonWindow and there is another SingletonWindow with
109
     * the same model that it is already shown, returns this 
110
     * later SingletonWindow.
111
     */
112
    public IWindow addWindow(IWindow p) throws SingletonDialogAlreadyShownException;
113

    
114
    /**
115
     * <p>
116
     * Creates a new frame with the provided contents, and shows this
117
     * new window. The new frame will be centered, regardless the
118
     * position specified in the WindowInfo object from IWindow's
119
     * <code>getWindowInfo()</code> method.
120
     * The new frame is disposed when closed. 
121
     * </p>
122
     * <p>
123
     * If the provided IWindow also implements SingletonWindow, and
124
     * another SingletonWindow already exists and uses the same
125
     * model, this later window will be sent to the foreground
126
     * and no new window will be created.
127
     * </p>
128
     *
129
     * @param p Panel with the contents of the new window.
130
     *
131
     * @return Returns the added IWindow, or in case it is a
132
     * SingletonWindow and there is another SingletonWindow with
133
     * the same model that it is already shown, returns this 
134
     * later SingletonWindow.
135
     * 
136
     * @author Pablo Piqueras Bartolom?
137
     */
138
    public IWindow addCentredWindow(IWindow p) throws SingletonDialogAlreadyShownException;
139

    
140
    /**
141
     * <p>
142
     * Returns the currently active window, excluding the modal windows and the
143
     * PALETTE windows. If the currently active window is modal or PALETTE type,
144
     * the previous non-modal and non-PALETTE active window is returned.
145
     * </p>
146
     * <p>
147
     * Modal windows and PALETTE windows are considered to be auxiliary windows,
148
     * that is the reason why they are not returned.
149
     * </p> 
150
     *
151
     * @return A reference to the active window, or null if there is no
152
     * active window
153
     */
154
    public IWindow getActiveWindow();
155
    
156
    /**
157
     * Useful to add a menuBar to a window
158
     * @param w
159
     * @param menuBar
160
     */
161
    public void addJMenuBarToWindow(IWindow w, JMenuBar menuBar);
162

    
163
    /**
164
     * <p>
165
     * Returns the currently focused window, excluding the modal windows.
166
     * If the currently focused window is modal,
167
     * the previous non-modal focused window is returned.
168
     * </p>
169
     *
170
     * @return A reference to the focused window, or null if there is no
171
     * focused window
172
     */
173
    public IWindow getFocusWindow();
174
    
175
    /**
176
     * Gets all the open windows. Minimized and maximized windows are
177
     * included. The application's main frame is excluded; it can be
178
     * accessed using <code>PluginServices.getMainFrame()</code>.
179
     *
180
     * @return An IWindow array containing all the open windows.
181
     */
182
    public IWindow[] getAllWindows();
183
    
184
    /**
185
     * Gets all the open windows (as {@link #getAllWindows()}),
186
     * but in this method the windows are returned in the same
187
     * deepness order that they have in the application.
188
     *
189
     * @return   An ordered array containing all the panels in the application.
190
     * The first element of the array is the topmost (foreground) window in the
191
     * application. The last element is the bottom (background) window.
192
     */
193
    public IWindow[] getOrderedWindows();
194

    
195
    /**
196
     * Close the SingletonWindow whose class and model are provided as
197
     * parameters.
198
     * 
199
     * @param viewClass Class of the window which is to be closed
200
     * @param model Model of the window which is to be closed
201
     *
202
     * @return true if there is an open window whose class and model
203
     *         match the provided parameteres, false otherwise.
204
     */
205
    public boolean closeSingletonWindow(Class viewClass, Object model);
206

    
207
    /**
208
     * Close the SingletonWindow whose model is provided as parameter.
209
     *
210
     * @param model Model of the window which is to be closed
211
     *
212
     * @return true if there is an open window whose model matchs
213
     *         the provided one, false otherwise.
214
     */
215
    public boolean closeSingletonWindow(Object model);
216

    
217
    /**
218
     * Close the provided window.
219
     *
220
     * @param p window to be closed
221
     */
222
    public void closeWindow(IWindow p);
223

    
224
    /**
225
     * Close all the currently open windows
226
     */
227
    public void closeAllWindows();
228

    
229
    /**
230
     * Gets the WindowInfo object associated with the provided window.
231
     *
232
     * @param v window whose information is to be retrieved
233
     *
234
     * @return WindowInfo The WindowInfo object containing the information
235
     * about the provided window 
236
     * 
237
     * @see WindowInfo
238
     */
239
    public WindowInfo getWindowInfo(IWindow v);
240

    
241
    /**
242
     * Shows the wait cursor and blocks all the events from main window until
243
     * {@link #restoreCursor()} is called.
244
     */
245
    public void setWaitCursor();
246

    
247
    /**
248
     * Sets the normal cursor and unblocks events from main window.
249
     * 
250
     * @see #setWaitCursor()
251
     */
252
    public void restoreCursor();
253

    
254
    /**
255
     * Maximizes or restores the provided window
256
     * 
257
     * @param v The window to be maximized or restored 
258
     * @param bMaximum If true, the window will be maximized,
259
     *  if false, it will be restored
260
     * @throws PropertyVetoException
261
     */
262
    public void setMaximum(IWindow v, boolean bMaximum) throws PropertyVetoException;
263
    
264
    /**
265
     * Updates the window properties (size, location, etc) according to the
266
     * provided WindowInfo object.
267
     * 
268
     * @param v The window whose properties are to be changed
269
     * @param vi The WindowInfo object containing the new properties to be set
270
     */
271
    public void changeWindowInfo(IWindow v, WindowInfo vi);
272
    
273
    /**
274
     * Forces a window to be repainted. Normally, this is not necessary,
275
     * as windows are refreshed when necessary.
276
     * 
277
     * @param win The window to be refreshed.
278
     */
279
    public void refresh(IWindow win);
280

    
281
    /**
282
     * Sets the provided image as background image in the main window. The image
283
     * will be centered, set in mosaic or expanded to fill the full window,
284
     * depending on the <code>typeDesktop</code> argument.
285
     * 
286
     * @param image The image to be set as background image
287
     * @param typeDesktop Decides whether the image should be centered, set
288
     * in mosaic or expanded. Accepted values are: Theme.CENTERED,
289
     * Theme.MOSAIC and Theme.EXPAND.
290
     */
291
        public void setBackgroundImage(ImageIcon image, String typeDesktop);
292
}