root / trunk / libraries / libCorePlugin / src / com / iver / core / mdiManager / NewSkin.java @ 4914
History | View | Annotate | Download (20.2 KB)
1 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
---|---|
2 |
*
|
3 |
* Copyright (C) 2004 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.core.mdiManager; |
42 |
|
43 |
import java.awt.BorderLayout; |
44 |
import java.awt.Cursor; |
45 |
import java.awt.Dimension; |
46 |
import java.awt.event.ActionEvent; |
47 |
import java.awt.event.ActionListener; |
48 |
import java.awt.event.WindowAdapter; |
49 |
import java.awt.event.WindowEvent; |
50 |
import java.beans.PropertyVetoException; |
51 |
import java.util.ArrayList; |
52 |
import java.util.Iterator; |
53 |
|
54 |
import javax.swing.DefaultDesktopManager; |
55 |
import javax.swing.DesktopManager; |
56 |
import javax.swing.JDesktopPane; |
57 |
import javax.swing.JDialog; |
58 |
import javax.swing.JInternalFrame; |
59 |
import javax.swing.event.InternalFrameEvent; |
60 |
import javax.swing.event.InternalFrameListener; |
61 |
|
62 |
import org.apache.log4j.Logger; |
63 |
|
64 |
import com.iver.andami.plugins.Extension; |
65 |
import com.iver.andami.ui.mdiFrame.GlassPane; |
66 |
import com.iver.andami.ui.mdiFrame.MDIFrame; |
67 |
import com.iver.andami.ui.mdiManager.MDIManager; |
68 |
import com.iver.andami.ui.mdiManager.MDIUtilities; |
69 |
import com.iver.andami.ui.mdiManager.SingletonDialogAlreadyShownException; |
70 |
import com.iver.andami.ui.mdiManager.SingletonView; |
71 |
import com.iver.andami.ui.mdiManager.View; |
72 |
import com.iver.andami.ui.mdiManager.ViewInfo; |
73 |
import com.iver.andami.ui.mdiManager.ViewListener; |
74 |
|
75 |
/**
|
76 |
*
|
77 |
*/
|
78 |
public class NewSkin implements MDIManager, Extension { |
79 |
/**
|
80 |
* Variable privada <code>desktopManager</code> para usarlo cuando sale
|
81 |
* una ventana que no queremos que nos restaure las que tenemos maximizadas.
|
82 |
* Justo antes de usar el setMaximize(false), le pegamos el cambiazo.
|
83 |
*/
|
84 |
private static DesktopManager desktopManager = new DefaultDesktopManager(); |
85 |
|
86 |
/** log */
|
87 |
private static Logger logger = Logger.getLogger(NewSkin.class.getName()); |
88 |
|
89 |
/** Panel de la MDIFrame */
|
90 |
private JDesktopPane panel = new JDesktopPane(); |
91 |
|
92 |
/** MDIFrame */
|
93 |
private MDIFrame mainFrame;
|
94 |
|
95 |
private GlassPane glassPane = new GlassPane(); |
96 |
|
97 |
private DialogStackSupport dss;
|
98 |
|
99 |
private FrameViewSupport fvs;
|
100 |
|
101 |
private ViewInfoSupport vis;
|
102 |
|
103 |
private ViewStackSupport vss;
|
104 |
|
105 |
private SingletonViewSupport svs;
|
106 |
|
107 |
private Cursor lastCursor = null; |
108 |
|
109 |
/**
|
110 |
* @see com.iver.andami.ui.mdiManager.MDIManager#init(com.iver.andami.ui.mdiFrame.MDIFrame)
|
111 |
*/
|
112 |
public void init(MDIFrame f) { |
113 |
// Inicializa el Frame y la consola
|
114 |
mainFrame = f; |
115 |
mainFrame.setGlassPane(glassPane); |
116 |
panel.setDragMode(JDesktopPane.OUTLINE_DRAG_MODE);
|
117 |
|
118 |
mainFrame.getContentPane().add(panel, BorderLayout.CENTER);
|
119 |
panel.setDesktopManager(desktopManager); |
120 |
|
121 |
fvs = new FrameViewSupport(mainFrame);
|
122 |
dss = new DialogStackSupport(mainFrame);
|
123 |
svs = new SingletonViewSupport(vis, fvs);
|
124 |
vis = new ViewInfoSupport(mainFrame, fvs, svs);
|
125 |
fvs.setVis(vis); |
126 |
vss = new ViewStackSupport(vis);
|
127 |
} |
128 |
|
129 |
/**
|
130 |
* @see com.iver.andami.ui.mdiManager.MDIManager#addView(com.iver.andami.ui.mdiManager.View)
|
131 |
*/
|
132 |
public View addView(View p) throws SingletonDialogAlreadyShownException { |
133 |
// se obtiene la informaci?n de la vista
|
134 |
ViewInfo vi = vis.getViewInfo(p); |
135 |
|
136 |
// Se comprueban las incompatibilidades que pudieran haber en la vista
|
137 |
MDIUtilities.checkViewInfo(vi); |
138 |
if ((p instanceof SingletonView) && (vi.isModal())) { |
139 |
throw new RuntimeException("A modal view cannot be a SingletonView"); |
140 |
} |
141 |
|
142 |
/*
|
143 |
* Se obtiene la referencia a la vista anterior por si es una singleton
|
144 |
* y est? siendo mostrada. Se obtiene su informaci?n si ya fue mostrada
|
145 |
*/
|
146 |
boolean singletonPreviouslyAdded = false; |
147 |
|
148 |
if (p instanceof SingletonView) { |
149 |
SingletonView sv = (SingletonView) p; |
150 |
if (svs.registerView(sv.getClass(), sv.getViewModel(), vis
|
151 |
.getViewInfo(sv))) { |
152 |
singletonPreviouslyAdded = true;
|
153 |
} |
154 |
} |
155 |
|
156 |
if (singletonPreviouslyAdded) {
|
157 |
// Si la vista no est? actualmente abierta
|
158 |
if (!svs.contains((SingletonView) p)) {
|
159 |
JInternalFrame frame = fvs.getJInternalFrame(p);
|
160 |
svs.openSingletonView((SingletonView) p, frame); |
161 |
addJInternalFrame(frame, vi); |
162 |
vss.add(p, new ActionListener() { |
163 |
public void actionPerformed(ActionEvent e) { |
164 |
View v = vis.getViewById(Integer.parseInt(e |
165 |
.getActionCommand())); |
166 |
JInternalFrame f = fvs.getJInternalFrame(v);
|
167 |
activateJInternalFrame(f); |
168 |
} |
169 |
}); |
170 |
return p;
|
171 |
} else {
|
172 |
// La vista est? actualmente abierta
|
173 |
JInternalFrame frame = (JInternalFrame) svs |
174 |
.getFrame((SingletonView) p); |
175 |
activateJInternalFrame(frame); |
176 |
vss.setActive(p); |
177 |
return fvs.getView((JInternalFrame) frame); |
178 |
} |
179 |
} else {
|
180 |
if (vi.isModal()) {
|
181 |
addJDialog(p); |
182 |
} else {
|
183 |
// Se sit?a la vista en la pila de vistas
|
184 |
vss.add(p, new ActionListener() { |
185 |
public void actionPerformed(ActionEvent e) { |
186 |
View v = vis.getViewById(Integer.parseInt(e |
187 |
.getActionCommand())); |
188 |
JInternalFrame f = fvs.getJInternalFrame(v);
|
189 |
activateJInternalFrame(f); |
190 |
} |
191 |
}); |
192 |
addJInternalFrame(p); |
193 |
} |
194 |
|
195 |
return p;
|
196 |
} |
197 |
} |
198 |
|
199 |
/**
|
200 |
* DOCUMENT ME!
|
201 |
*
|
202 |
* @param wnd
|
203 |
* DOCUMENT ME!
|
204 |
* @param vi
|
205 |
* DOCUMENT ME!
|
206 |
*/
|
207 |
private void addJInternalFrame(JInternalFrame wnd, ViewInfo vi) { |
208 |
wnd.setDefaultCloseOperation(JInternalFrame.DISPOSE_ON_CLOSE);
|
209 |
wnd.addInternalFrameListener(new FrameListener());
|
210 |
|
211 |
if (vi.isModeless() || vi.isPalette()) {
|
212 |
panel.add(wnd, JDesktopPane.PALETTE_LAYER);
|
213 |
if (vi.isPalette())
|
214 |
wnd.setFocusable(false);
|
215 |
} else {
|
216 |
panel.add(wnd); |
217 |
} |
218 |
|
219 |
activateJInternalFrame(wnd); |
220 |
} |
221 |
|
222 |
/**
|
223 |
* DOCUMENT ME!
|
224 |
*
|
225 |
* @param p
|
226 |
*/
|
227 |
private void addJInternalFrame(View p) { |
228 |
ViewInfo vi = vis.getViewInfo(p); |
229 |
|
230 |
JInternalFrame wnd = fvs.getJInternalFrame(p);
|
231 |
|
232 |
if (p instanceof SingletonView) { |
233 |
SingletonView sv = (SingletonView) p; |
234 |
svs.openSingletonView(sv, wnd); |
235 |
} |
236 |
|
237 |
addJInternalFrame(wnd, vi); |
238 |
} |
239 |
|
240 |
/**
|
241 |
* DOCUMENT ME!
|
242 |
*
|
243 |
* @param wnd
|
244 |
*/
|
245 |
private void activateJInternalFrame(JInternalFrame wnd) { |
246 |
try {
|
247 |
wnd.moveToFront(); |
248 |
logger.debug("Activando " + wnd.getTitle());
|
249 |
wnd.setSelected(true);
|
250 |
wnd.setIcon(false);
|
251 |
} catch (PropertyVetoException e) { |
252 |
logger.error(e); |
253 |
} |
254 |
} |
255 |
|
256 |
/**
|
257 |
* Situa un di?logo modal en el centro de la pantalla
|
258 |
*
|
259 |
* @param d
|
260 |
* Di?logo que se quiere situar
|
261 |
*/
|
262 |
private void centerDialog(JDialog d) { |
263 |
int offSetX = d.getWidth() / 2; |
264 |
int offSetY = d.getHeight() / 2; |
265 |
|
266 |
d.setLocation((mainFrame.getWidth() / 2) - offSetX, (mainFrame
|
267 |
.getHeight() / 2)
|
268 |
- offSetY); |
269 |
} |
270 |
|
271 |
/**
|
272 |
* DOCUMENT ME!
|
273 |
*
|
274 |
* @param p
|
275 |
*/
|
276 |
private void addJDialog(View p) { |
277 |
JDialog dlg = fvs.getJDialog(p);
|
278 |
|
279 |
centerDialog(dlg); |
280 |
|
281 |
dlg.addWindowListener(new DialogWindowListener());
|
282 |
dss.pushDialog(dlg); |
283 |
|
284 |
dlg.setVisible(vis.getViewInfo(p).isVisible()); |
285 |
} |
286 |
|
287 |
/**
|
288 |
* @see com.iver.andami.ui.mdiManager.MDIManager#getActiveView()
|
289 |
*/
|
290 |
public View getActiveView() { |
291 |
JInternalFrame jif = panel.getSelectedFrame();
|
292 |
|
293 |
if (jif != null) { |
294 |
View theView = fvs.getView(jif);
|
295 |
if (theView == null) |
296 |
return null; |
297 |
if (theView.getViewInfo().isPalette())
|
298 |
return vss.getActiveView();
|
299 |
else
|
300 |
return fvs.getView(jif);
|
301 |
} |
302 |
// return vss.getActiveView();
|
303 |
|
304 |
return null; |
305 |
} |
306 |
public View getFocusView(){ |
307 |
JInternalFrame jif = panel.getSelectedFrame();
|
308 |
|
309 |
if (jif != null) { |
310 |
View theView = fvs.getView(jif);
|
311 |
if (theView == null) |
312 |
return null; |
313 |
return fvs.getView(jif);
|
314 |
} |
315 |
return null; |
316 |
} |
317 |
/**
|
318 |
* @see com.iver.andami.ui.mdiManager.MDIManager#closeView(com.iver.andami.ui.mdiManager.View)
|
319 |
*/
|
320 |
public void closeView(View p) { |
321 |
// Si es un di?logo modal
|
322 |
if (p.getViewInfo().isModal()) {
|
323 |
closeJDialog(); |
324 |
} else { // Si no es modal se cierra el JInternalFrame |
325 |
closeJInternalFrame(fvs.getJInternalFrame(p)); |
326 |
} |
327 |
} |
328 |
|
329 |
/**
|
330 |
* @see com.iver.andami.ui.mdiManager.MDIManager#closeAllViews()
|
331 |
*/
|
332 |
public void closeAllViews() { |
333 |
ArrayList eliminar = new ArrayList(); |
334 |
Iterator i = fvs.getViewIterator();
|
335 |
|
336 |
while (i.hasNext()) {
|
337 |
eliminar.add((View) i.next());
|
338 |
} |
339 |
|
340 |
for (Iterator iter = eliminar.iterator(); iter.hasNext();) { |
341 |
View vista = (View) iter.next(); |
342 |
closeView(vista); |
343 |
} |
344 |
} |
345 |
|
346 |
/**
|
347 |
* @see com.iver.andami.ui.mdiManager.MDIManager#getViewInfo(com.iver.andami.ui.mdiManager.View)
|
348 |
*/
|
349 |
public ViewInfo getViewInfo(View v) { |
350 |
return vis.getViewInfo(v);
|
351 |
} |
352 |
|
353 |
/**
|
354 |
* DOCUMENT ME!
|
355 |
*
|
356 |
* @param dialog
|
357 |
* @throws RuntimeException
|
358 |
* DOCUMENT ME!
|
359 |
*/
|
360 |
private void closeJDialog() { |
361 |
JDialog dlg = dss.popDialog();
|
362 |
|
363 |
dlg.setVisible(false);
|
364 |
|
365 |
View s = (View) fvs.getView(dlg); |
366 |
|
367 |
callViewClosed(s); |
368 |
|
369 |
fvs.closeView(s); |
370 |
|
371 |
// Si es singleton se desasocia el modelo con la vista
|
372 |
if (s instanceof SingletonView) { |
373 |
svs.closeView((SingletonView) s); |
374 |
} |
375 |
} |
376 |
|
377 |
/**
|
378 |
* DOCUMENT ME!
|
379 |
*
|
380 |
* @param view
|
381 |
* DOCUMENT ME!
|
382 |
*/
|
383 |
private void callViewClosed(View view) { |
384 |
if (view instanceof ViewListener) { |
385 |
((ViewListener) view).viewClosed(); |
386 |
} |
387 |
} |
388 |
|
389 |
/**
|
390 |
* DOCUMENT ME!
|
391 |
*
|
392 |
* @param view
|
393 |
* DOCUMENT ME!
|
394 |
*/
|
395 |
private void callViewActivated(View view) { |
396 |
logger.debug("View " + view.getViewInfo().getTitle()
|
397 |
+ " activated (callViewActivated)");
|
398 |
if (view instanceof ViewListener) { |
399 |
((ViewListener) view).viewActivated(); |
400 |
} |
401 |
} |
402 |
|
403 |
/**
|
404 |
* DOCUMENT ME!
|
405 |
*
|
406 |
* @param frame
|
407 |
*/
|
408 |
private void closeJInternalFrame(JInternalFrame frame) { |
409 |
try {
|
410 |
View s = (View) fvs.getView(frame); |
411 |
|
412 |
frame.setClosed(true);
|
413 |
callViewClosed(s); |
414 |
} catch (PropertyVetoException e) { |
415 |
logger |
416 |
.error( |
417 |
"Not compatible with property veto's. Use ViewInfo instead.",
|
418 |
e); |
419 |
} |
420 |
} |
421 |
|
422 |
/**
|
423 |
* @see com.iver.andami.plugins.Extension#inicializar()
|
424 |
*/
|
425 |
public void inicializar() { |
426 |
} |
427 |
|
428 |
/**
|
429 |
* @see com.iver.andami.plugins.Extension#execute(java.lang.String)
|
430 |
*/
|
431 |
public void execute(String actionCommand) { |
432 |
if (actionCommand.equals("cascada")) { |
433 |
} else if (actionCommand.equals("mosaico")) { |
434 |
} |
435 |
} |
436 |
|
437 |
/**
|
438 |
* @see com.iver.andami.plugins.Extension#isEnabled()
|
439 |
*/
|
440 |
public boolean isEnabled() { |
441 |
// TODO Auto-generated method stub
|
442 |
return false; |
443 |
} |
444 |
|
445 |
/**
|
446 |
* @see com.iver.andami.plugins.Extension#isVisible()
|
447 |
*/
|
448 |
public boolean isVisible() { |
449 |
// TODO Auto-generated method stub
|
450 |
return true; |
451 |
} |
452 |
|
453 |
/**
|
454 |
* @see com.iver.andami.ui.mdiManager.MDIManager#setWaitCursor()
|
455 |
*/
|
456 |
public void setWaitCursor() { |
457 |
if (mainFrame != null) { |
458 |
glassPane.setVisible(true);
|
459 |
lastCursor = mainFrame.getCursor(); |
460 |
dss.setWaitCursor(); |
461 |
glassPane.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); |
462 |
} |
463 |
} |
464 |
|
465 |
/**
|
466 |
* @see com.iver.andami.ui.mdiManager.MDIManager#restoreCursor()
|
467 |
*/
|
468 |
public void restoreCursor() { |
469 |
if (mainFrame != null) { |
470 |
glassPane.setVisible(false);
|
471 |
dss.restoreCursor(); |
472 |
glassPane.setCursor(lastCursor); |
473 |
} |
474 |
} |
475 |
|
476 |
/**
|
477 |
* Listener para los eventos de cerrado de los di?logos. Tiene su raz?n de
|
478 |
* ser en que los di?logos han de devolverse al pool cuando se cierran
|
479 |
*
|
480 |
* @author Fernando Gonz?lez Cort?s
|
481 |
*/
|
482 |
public class DialogWindowListener extends WindowAdapter { |
483 |
/**
|
484 |
* Captura el evento de cerrado de los di?logos con el fin de realizar
|
485 |
* tareas de mantenimiento
|
486 |
*
|
487 |
* @param e
|
488 |
* evento
|
489 |
*/
|
490 |
public void windowClosing(WindowEvent e) { |
491 |
closeJDialog(); |
492 |
} |
493 |
} |
494 |
|
495 |
/**
|
496 |
* DOCUMENT ME!
|
497 |
*/
|
498 |
public class FrameListener implements InternalFrameListener { |
499 |
/**
|
500 |
* @see javax.swing.event.InternalFrameListener#internalFrameActivated(javax.swing.event.InternalFrameEvent)
|
501 |
*/
|
502 |
public void internalFrameActivated(InternalFrameEvent e) { |
503 |
// logger.debug("internalFrameActivated " +
|
504 |
// e.getInternalFrame().getTitle());
|
505 |
|
506 |
// activatedInternalFramesStack.push(e.getInternalFrame());
|
507 |
|
508 |
View panel = fvs.getView((JInternalFrame) e.getSource()); |
509 |
|
510 |
ViewInfo vi = vis.getViewInfo(panel); |
511 |
if (vi.isPalette())
|
512 |
return;
|
513 |
|
514 |
vss.setActive(panel); |
515 |
|
516 |
JInternalFrame frame = fvs.getJInternalFrame(panel);
|
517 |
|
518 |
if (!frame.isMaximizable() && frame.isMaximum()) {
|
519 |
try {
|
520 |
frame.setMaximum(false);
|
521 |
} catch (PropertyVetoException e1) { |
522 |
} |
523 |
} |
524 |
mainFrame.enableControls(); |
525 |
if (vi.getSelectedTool() != null) |
526 |
mainFrame.setSelectedTool(vi.getSelectedTool()); |
527 |
callViewActivated(panel); |
528 |
|
529 |
} |
530 |
|
531 |
/**
|
532 |
* @see javax.swing.event.InternalFrameListener#internalFrameClosed(javax.swing.event.InternalFrameEvent)
|
533 |
*/
|
534 |
public void internalFrameClosed(InternalFrameEvent e) { |
535 |
} |
536 |
|
537 |
/**
|
538 |
* @see javax.swing.event.InternalFrameListener#internalFrameClosing(javax.swing.event.InternalFrameEvent)
|
539 |
*/
|
540 |
public void internalFrameClosing(InternalFrameEvent e) { |
541 |
// Se elimina la memoria del JInternalFrame si no es ALWAYS_LIVE
|
542 |
// logger.debug("internalFrameClosing " +
|
543 |
// e.getInternalFrame().getTitle());
|
544 |
|
545 |
JInternalFrame c = (JInternalFrame) e.getSource(); |
546 |
ViewInfo vi = vis.getViewInfo((View) fvs.getView(c));
|
547 |
|
548 |
View view = fvs.getView(c);
|
549 |
callViewClosed(view); |
550 |
boolean alwaysLive;
|
551 |
if (view instanceof SingletonView) { |
552 |
svs.closeView((SingletonView) view); |
553 |
} |
554 |
|
555 |
fvs.closeView(view); |
556 |
|
557 |
panel.remove(c); |
558 |
|
559 |
vss.remove(view); |
560 |
|
561 |
if (!vi.isPalette())
|
562 |
mainFrame.enableControls(); |
563 |
panel.repaint(); |
564 |
|
565 |
// Para activar el JInternalFrame desde la que hemos
|
566 |
// abierto la ventana que estamos cerrando
|
567 |
View lastView = vss.getActiveView();
|
568 |
// La activamos
|
569 |
if (lastView != null) { |
570 |
System.err.println("Devuelvo el foco a " |
571 |
+ lastView.getViewInfo().getTitle()); |
572 |
JInternalFrame frame = fvs.getJInternalFrame(lastView);
|
573 |
try {
|
574 |
frame.setSelected(true);
|
575 |
} catch (PropertyVetoException e1) { |
576 |
// TODO Auto-generated catch block
|
577 |
// e1.printStackTrace();
|
578 |
} |
579 |
// addView(lastView);
|
580 |
} |
581 |
|
582 |
} |
583 |
|
584 |
/**
|
585 |
* @see javax.swing.event.InternalFrameListener#internalFrameDeactivated(javax.swing.event.InternalFrameEvent)
|
586 |
*/
|
587 |
public void internalFrameDeactivated(InternalFrameEvent e) { |
588 |
// logger.debug("internalDeActivated " +
|
589 |
// e.getInternalFrame().getTitle());
|
590 |
JInternalFrame c = (JInternalFrame) e.getSource(); |
591 |
View andamiView = fvs.getView(c);
|
592 |
if (andamiView != null) { |
593 |
ViewInfo vi = vis.getViewInfo(andamiView); |
594 |
if (vi.isPalette())
|
595 |
return;
|
596 |
vi.setSelectedTool(mainFrame.getSelectedTool()); |
597 |
} |
598 |
|
599 |
} |
600 |
|
601 |
/**
|
602 |
* @see javax.swing.event.InternalFrameListener#internalFrameDeiconified(javax.swing.event.InternalFrameEvent)
|
603 |
*/
|
604 |
public void internalFrameDeiconified(InternalFrameEvent e) { |
605 |
mainFrame.enableControls(); |
606 |
} |
607 |
|
608 |
/**
|
609 |
* @see javax.swing.event.InternalFrameListener#internalFrameIconified(javax.swing.event.InternalFrameEvent)
|
610 |
*/
|
611 |
public void internalFrameIconified(InternalFrameEvent e) { |
612 |
mainFrame.enableControls(); |
613 |
} |
614 |
|
615 |
/**
|
616 |
* @see javax.swing.event.InternalFrameListener#internalFrameOpened(javax.swing.event.InternalFrameEvent)
|
617 |
*/
|
618 |
public void internalFrameOpened(InternalFrameEvent e) { |
619 |
// logger.debug("internalFrameOpened. Source= " +
|
620 |
// e.getSource().toString());
|
621 |
} |
622 |
} |
623 |
|
624 |
/**
|
625 |
* @see com.iver.andami.ui.mdiManager.MDIManager#closeSingletonView(java.lang.Class,
|
626 |
* java.lang.Object)
|
627 |
*/
|
628 |
public boolean closeSingletonView(Class viewClass, Object model) { |
629 |
JInternalFrame frame = svs.getFrame(viewClass, model);
|
630 |
if (frame == null) |
631 |
return false; |
632 |
closeJInternalFrame(frame); |
633 |
return true; |
634 |
} |
635 |
|
636 |
/**
|
637 |
* @see com.iver.andami.ui.mdiManager.MDIManager#closeSingletonView(java.lang.Object)
|
638 |
*/
|
639 |
public boolean closeSingletonView(Object model) { |
640 |
JInternalFrame[] frames = svs.getFrames(model); |
641 |
if (frames.length == 0) |
642 |
return false; |
643 |
for (int i = 0; i < frames.length; i++) { |
644 |
closeJInternalFrame(frames[i]); |
645 |
} |
646 |
return true; |
647 |
} |
648 |
|
649 |
public View[] getAllViews() { |
650 |
ArrayList views = new ArrayList(); |
651 |
Iterator i = fvs.getViewIterator();
|
652 |
|
653 |
while (i.hasNext()) {
|
654 |
views.add((View) i.next());
|
655 |
} |
656 |
return (View[]) views.toArray(new View[0]); |
657 |
} |
658 |
|
659 |
public void setMaximum(View v, boolean bMaximum) throws PropertyVetoException |
660 |
{ |
661 |
JInternalFrame f = fvs.getJInternalFrame(v);
|
662 |
f.setMaximum(bMaximum); |
663 |
} |
664 |
|
665 |
public void changeViewInfo(View v, ViewInfo vi){ |
666 |
JInternalFrame f = fvs.getJInternalFrame(v);
|
667 |
f.setDefaultCloseOperation(JInternalFrame.DISPOSE_ON_CLOSE);
|
668 |
JDesktopPane pnl = f.getDesktopPane();
|
669 |
pnl.remove(f); |
670 |
f.setSize(new Dimension(vi.getWidth(),vi.getHeight())); |
671 |
if (vi.isPalette()) {
|
672 |
pnl.add(f, JDesktopPane.PALETTE_LAYER);
|
673 |
f.setFocusable(false);
|
674 |
} else {
|
675 |
pnl.add(f, JDesktopPane.DEFAULT_LAYER);
|
676 |
f.setFocusable(true);
|
677 |
} |
678 |
activateJInternalFrame(f); |
679 |
} |
680 |
} |