Revision 11979

View differences:

trunk/libraries/libCorePlugin/src/com/iver/core/mdiManager/NewSkin.java
914 914

  
915 915
    public void changeWindowInfo(IWindow w, WindowInfo wi){
916 916
    	JInternalFrame f = fws.getJInternalFrame(w);
917
		f.setDefaultCloseOperation(JInternalFrame.DISPOSE_ON_CLOSE);
918
		JDesktopPane pnl = f.getDesktopPane();
919
		pnl.remove(f);
920
		int width;
921
		int height;
922
		if (wi.getWidth()!=-1)
923
			width = wi.getWidth();
924
		else
925
			width = f.getWidth();
926
		if (wi.getHeight()!=-1)
927
			height = wi.getHeight();
928
		else
929
			height = f.getHeight();
930
		f.setSize(new Dimension(width, height));
931
		f.setLocation(wi.getX(), wi.getY());
932
		if (wi.isPalette()) {
933
			pnl.add(f, JDesktopPane.PALETTE_LAYER);
934
			f.setFocusable(false);
935
		} else {
936
			pnl.add(f, JDesktopPane.DEFAULT_LAYER);
937
			f.setFocusable(true);
938
			if (wi.isClosed()) {
939
				closeWindow(w);
940
			}
941
		}
917
    	f.setDefaultCloseOperation(JInternalFrame.DISPOSE_ON_CLOSE);
918
    	JDesktopPane pnl = f.getDesktopPane();
919
    	pnl.remove(f);
920
    	int width;
921
    	int height;
922
    	if (wi.getWidth()!=-1)
923
    		width = wi.getWidth();
924
    	else
925
    		width = f.getWidth();
926
    	if (wi.getHeight()!=-1)
927
    		height = wi.getHeight();
928
    	else
929
    		height = f.getHeight();
930
    	f.setSize(new Dimension(width, height));
931
    	f.setLocation(wi.getX(), wi.getY());
932
    	if (wi.isPalette()) {
933
    		pnl.add(f, JDesktopPane.PALETTE_LAYER);
934
    		f.setFocusable(false);
935
    	} else {
936
    		pnl.add(f, JDesktopPane.DEFAULT_LAYER);
937
    		f.setFocusable(true);
938
    		if (wi.isClosed()) {
939
    			closeWindow(w);
940
    		}
941
    	}
942 942

  
943
		if (wi.isMaximized()) {
944
			try {
945
				f.setMaximum(true);
946
			} catch (PropertyVetoException e) {
947
				// TODO Auto-generated catch block
948
				//e.printStackTrace();
949
			}
950
			f.setNormalBounds(wi.getNormalBounds());
951
		}
952
		activateJInternalFrame(f);
953
   }
943
    	if (wi.isMaximized()) {
944
    		try {
945
    			f.setMaximum(true);
946
    		} catch (PropertyVetoException e) {
947
    			// TODO Auto-generated catch block
948
    			//e.printStackTrace();
949
    		}
950
    		f.setNormalBounds(wi.getNormalBounds());
951
    	}
952
    	activateJInternalFrame(f);
953
    }
954 954

  
955
    public void refresh(IWindow win) {
956
    	Component frame = fws.getFrame(win);
957
    	if (frame!=null)
958
    		frame.setVisible(true);
959
    }
960
    
955 961
	public void setBackgroundImage(ImageIcon image, String typeDesktop) {
956 962
		this.image=image;
957 963
		this.typeDesktop=typeDesktop;
trunk/frameworks/_fwAndami/src/com/iver/andami/ui/mdiManager/MDIManager.java
1 1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2 2
 *
3
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
3
 * Copyright (C) 2004-2007 IVER T.I. and Generalitat Valenciana.
4 4
 *
5 5
 * This program is free software; you can redistribute it and/or
6 6
 * modify it under the terms of the GNU General Public License
......
48 48

  
49 49

  
50 50
/**
51
 * Las vistas que se a?aden al framework derivan de JPanel. ?Como pasamos de un
52
 * JPanel al control que vemos (habitualmente un JInternalFrame) Mediante la
53
 * clase skin que implementa esta interfaz. El framework  invoca los m?todos
54
 * de la clase pasando como par?metros jPanel y la clase toma el JPanel, lo
55
 * trata (en la version por defecto lo mete en un JInternalFrame) y lo a?ade
56
 * al Frame principal. Para poner un ejemplo se podr?a implementar ua clase
57
 * que situara los jpanel en la forma que lo hace eclipse, o instalar un men?
58
 * por cada vista de forma que al seleccionar el men?  desapareciera la vista
59
 * actual y se mostrara la que  se ha seleccionado, ...     Actualmente la
60
 * clase que implementa esta interfaz es Skin y se usa a pi??n fijo, pero en
61
 * un futuro se dejar? abierta la posibilidad de sustituir esta clase por una
62
 * que  implemente el usuario.
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
63 76
 *
64 77
 * @author Fernando Gonz?lez Cort?s
65 78
 */
66 79
public interface MDIManager {
67 80
    /**
68
     * Inicializaci?n de la clase, se le pasa la consola para mostrar mensajes
69
     * y el frame principal para actuar sobre ?l
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.  
70 84
     *
71
     * @param f DOCUMENT ME!
85
     * @param f Application's main frame.
72 86
     */
73 87
    public void init(MDIFrame f);
74 88

  
75 89
    /**
76
     * A?ade una nueva vista a la interfaz y lo visualiza. Dicho vista se
77
     * elimina completamente al cerrarse.
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>
78 103
     *
79
     * @param p Panel con los controles de la vista
104
     * @param p Panel with the contents of the new window.
80 105
     *
81
     * @return Devuelve la vista a?adida o si es un singleton y ya estaba
82
     *         a?adida devuelve la vista ya a?adida
83
     *
84
     * @throws SingletonDialogAlreadyShownException Si lo que se est? a?adiendo
85
     *         es una vista modal singleton y ya est? a?adida
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.
86 110
     */
87 111
    public IWindow addWindow(IWindow p) throws SingletonDialogAlreadyShownException;
88 112

  
89 113
    /**
90
     * @author Pablo Piqueras Bartolom?
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>
91 127
     *
92
     * A?ade una nueva vista centrada a la interfaz y la visualiza. Dicha vista se
93
     * elimina completamente al cerrarse.
128
     * @param p Panel with the contents of the new window.
94 129
     *
95
     * @param p Panel con los controles de la vista
96
     *
97
     * @return Devuelve la vista a?adida o si es un singleton y ya estaba
98
     *         a?adida devuelve la vista ya a?adida
99
     *
100
     * @throws SingletonDialogAlreadyShownException Si lo que se est? a?adiendo
101
     *         es una vista modal singleton y ya est? a?adida
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?
102 136
     */
103 137
    public IWindow addCentredWindow(IWindow p) throws SingletonDialogAlreadyShownException;
104 138

  
105

  
106 139
    /**
107
     * Obtiene una referencia al panel de la ultima vista no modal que se
108
     * activ? en la aplicaci?n.
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> 
109 149
     *
110
     * @return referencia al panel activo o null si no hay ninguna vista activa
150
     * @return A reference to the active window, or null if there is no
151
     * active window
111 152
     */
112 153
    public IWindow getActiveWindow();
154

  
113 155
    /**
114
     * Obtiene una referencia al panel de la ?ltima vista, ya sea modal o no,que se
115
     * activ? en la aplicaci?n.
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>
116 161
     *
117
     * @return referencia al panel activo o null si no hay ninguna vista activa
162
     * @return A reference to the focused window, or null if there is no
163
     * focused window
118 164
     */
119 165
    public IWindow getFocusWindow();
166
    
120 167
    /**
121
     * Obtiene una referencia a los paneles de todas las ventanas no modales que
122
     * hay en la aplicaci?n.
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>.
123 171
     *
124
     * @return Un vector con todos los paneles que contiene la aplicaci?n.
172
     * @return An IWindow array containing all the open windows.
125 173
     */
126 174
    public IWindow[] getAllWindows();
175
    
127 176
    /**
128
     * Gets a reference to the panels of all the non modal windows present in
129
     * the application. The panels are provided in the same order that
130
     * they have in the application.
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.
131 180
     *
132
     * @return An ordered array containing all the panels in the application.
181
     * @return   An ordered array containing all the panels in the application.
133 182
     * The first element of the array is the topmost (foreground) window in the
134
     * application. The last element is the botton (background) window.
183
     * application. The last element is the bottom (background) window.
135 184
     */
136 185
    public IWindow[] getOrderedWindows();
137 186

  
138 187
    /**
139
     * Cierra la ventana SingletonView cuya clase se pasa como par?metro y cuyo
140
     * modelo se pasa como par?metro.
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
141 193
     *
142
     * @param viewClass Clase de la vista que se quiere cerrar
143
     * @param model Modelo de la vista que se quiere cerrar
144
     *
145
     * @return true si hay abierta una vista con la clase viewClass y con el
146
     *         modelo que se pasa como par?metro. False si no hay ninguna
147
     *         ventana de ese tipo.
194
     * @return true if there is an open window whose class and model
195
     *         match the provided parameteres, false otherwise.
148 196
     */
149 197
    public boolean closeSingletonWindow(Class viewClass, Object model);
150 198

  
151 199
    /**
152
     * Cierra todas las ventanas Singleton que tengan como modelo el que se
153
     * pasa como par?metro
200
     * Close the SingletonWindow whose model is provided as parameter.
154 201
     *
155
     * @param model Modelo de las ventanas que se quieren cerrar
202
     * @param model Model of the window which is to be closed
156 203
     *
157
     * @return true si se cierra alguna ventana y false si no hay abierta
158
     *         ninguna ventana singleton con ese modelo
204
     * @return true if there is an open window whose model matchs
205
     *         the provided one, false otherwise.
159 206
     */
160 207
    public boolean closeSingletonWindow(Object model);
161 208

  
162 209
    /**
163
     * Cierra la vista correspondiente con el JPanel
210
     * Close the provided window.
164 211
     *
165
     * @param p vista que se quiere cerrar
212
     * @param p window to be closed
166 213
     */
167 214
    public void closeWindow(IWindow p);
168 215

  
169 216
    /**
170
     * Cierra todas las vistas que actualmente est?n abiertas
217
     * Close all the currently open windows
171 218
     */
172 219
    public void closeAllWindows();
173 220

  
174 221
    /**
175
     * Obtiene la referencia al objeto que contiene la informaci?n de la vista
176
     * que se pasa como par?metro
222
     * Gets the WindowInfo object associated with the provided window.
177 223
     *
178
     * @param v vista cuya informaci?n se requiere
224
     * @param v window whose information is to be retrieved
179 225
     *
180
     * @return ViewInfo
226
     * @return WindowInfo The WindowInfo object containing the information
227
     * about the provided window 
228
     * 
229
     * @see WindowInfo
181 230
     */
182 231
    public WindowInfo getWindowInfo(IWindow v);
183 232

  
184 233
    /**
185
     * Pone como icono de rat?n el HourGlass y bloquea todos los eventos de la
186
     * interfaz que se producen hasta que se recibe una llamada a
187
     * restoreCursor
234
     * Shows the wait cursor and blocks all the events from main window until
235
     * {@link #restoreCursor()} is called.
188 236
     */
189 237
    public void setWaitCursor();
190 238

  
191 239
    /**
192
     * Restaura al icono de rat?n que hab?a antes de realizar la operaci?n
240
     * Sets the normal cursor and unblocks events from main window.
241
     * 
242
     * @see #setWaitCursor()
193 243
     */
194 244
    public void restoreCursor();
195 245

  
196 246
    /**
197
     * Maximiza o no la ventana que contiene la vista v
198
     * @param v
199
     * @param bMaximum
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
200 252
     * @throws PropertyVetoException
201 253
     */
202 254
    public void setMaximum(IWindow v, boolean bMaximum) throws PropertyVetoException;
255
    
203 256
    /**
204
     * Cambia el ViewInfo de la vista por el que pasamos como par?metro, utilizado de
205
     * momento para cambiar la vista a palette
206
     * @param v
207
     * @param vi
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
208 262
     */
209 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);
210 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
     */
211 283
	public void setBackgroundImage(ImageIcon image, String typeDesktop);
212 284
}

Also available in: Unified diff