Statistics
| Revision:

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

History | View | Annotate | Download (9.39 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

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

    
49

    
50
/**
51
 * <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
 *
77
 * @author Fernando Gonz?lez Cort?s
78
 */
79
public interface MDIManager {
80
    /**
81
     * 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
     *
85
     * @param f Application's main frame.
86
     */
87
    public void init(MDIFrame f);
88

    
89
    /**
90
     * <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
     *
104
     * @param p Panel with the contents of the new window.
105
     *
106
     * @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
     */
111
    public IWindow addWindow(IWindow p) throws SingletonDialogAlreadyShownException;
112

    
113
    /**
114
     * <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
     *
128
     * @param p Panel with the contents of the new window.
129
     *
130
     * @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
     */
137
    public IWindow addCentredWindow(IWindow p) throws SingletonDialogAlreadyShownException;
138

    
139
    /**
140
     * <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
     *
150
     * @return A reference to the active window, or null if there is no
151
     * active window
152
     */
153
    public IWindow getActiveWindow();
154

    
155
    /**
156
     * <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
     *
162
     * @return A reference to the focused window, or null if there is no
163
     * focused window
164
     */
165
    public IWindow getFocusWindow();
166
    
167
    /**
168
     * 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
     *
172
     * @return An IWindow array containing all the open windows.
173
     */
174
    public IWindow[] getAllWindows();
175
    
176
    /**
177
     * 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
     *
181
     * @return   An ordered array containing all the panels in the application.
182
     * The first element of the array is the topmost (foreground) window in the
183
     * application. The last element is the bottom (background) window.
184
     */
185
    public IWindow[] getOrderedWindows();
186

    
187
    /**
188
     * 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
     *
194
     * @return true if there is an open window whose class and model
195
     *         match the provided parameteres, false otherwise.
196
     */
197
    public boolean closeSingletonWindow(Class viewClass, Object model);
198

    
199
    /**
200
     * Close the SingletonWindow whose model is provided as parameter.
201
     *
202
     * @param model Model of the window which is to be closed
203
     *
204
     * @return true if there is an open window whose model matchs
205
     *         the provided one, false otherwise.
206
     */
207
    public boolean closeSingletonWindow(Object model);
208

    
209
    /**
210
     * Close the provided window.
211
     *
212
     * @param p window to be closed
213
     */
214
    public void closeWindow(IWindow p);
215

    
216
    /**
217
     * Close all the currently open windows
218
     */
219
    public void closeAllWindows();
220

    
221
    /**
222
     * Gets the WindowInfo object associated with the provided window.
223
     *
224
     * @param v window whose information is to be retrieved
225
     *
226
     * @return WindowInfo The WindowInfo object containing the information
227
     * about the provided window 
228
     * 
229
     * @see WindowInfo
230
     */
231
    public WindowInfo getWindowInfo(IWindow v);
232

    
233
    /**
234
     * Shows the wait cursor and blocks all the events from main window until
235
     * {@link #restoreCursor()} is called.
236
     */
237
    public void setWaitCursor();
238

    
239
    /**
240
     * Sets the normal cursor and unblocks events from main window.
241
     * 
242
     * @see #setWaitCursor()
243
     */
244
    public void restoreCursor();
245

    
246
    /**
247
     * 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
     * @throws PropertyVetoException
253
     */
254
    public void setMaximum(IWindow v, boolean bMaximum) throws PropertyVetoException;
255
    
256
    /**
257
     * 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
     */
263
    public void changeWindowInfo(IWindow v, WindowInfo vi);
264
    
265
    /**
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
    public void refresh(IWindow win);
272

    
273
    /**
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
        public void setBackgroundImage(ImageIcon image, String typeDesktop);
284
}