gvsig-3d / 2.1 / trunk / org.gvsig.gvsig3d / org.gvsig.gvsig3d.app / org.gvsig.gvsig3d.app.commons / src / main / java / org / gvsig / gvsig3d / app / extension / GvSIGGvsig3DWindowManager.java @ 385
History | View | Annotate | Download (2.66 KB)
1 |
/* gvSIG 3D extension for gvSIG
|
---|---|
2 |
*
|
3 |
* Copyright (C) 2012 Prodevelop.
|
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 |
* Prodevelop, S.L.
|
22 |
* Pza. Don Juan de Villarrasa, 14 - 5
|
23 |
* 46001 Valencia
|
24 |
* Spain
|
25 |
*
|
26 |
* +34 963 510 612
|
27 |
* +34 963 510 968
|
28 |
* prode@prodevelop.es
|
29 |
* http://www.prodevelop.es
|
30 |
*/
|
31 |
/*
|
32 |
* AUTHORS:
|
33 |
* 2012 AI2 - Instituto Universitario de Automatica e Informatica Industrial.
|
34 |
* Universitat Politecnica de Valencia (UPV)
|
35 |
* http://www.ai2.upv.es
|
36 |
*/
|
37 |
|
38 |
|
39 |
package org.gvsig.gvsig3d.app.extension; |
40 |
|
41 |
import java.awt.event.ComponentEvent; |
42 |
import java.awt.event.ComponentListener; |
43 |
import java.util.HashMap; |
44 |
import java.util.Map; |
45 |
|
46 |
import javax.swing.JPanel; |
47 |
|
48 |
import org.gvsig.andami.PluginServices; |
49 |
import org.gvsig.andami.ui.mdiManager.IWindow; |
50 |
import org.gvsig.gvsig3d.swing.Gvsig3DWindowManager; |
51 |
|
52 |
/**
|
53 |
* {@link Gvsig3DWindowManager} implementation to show Gvsig3D
|
54 |
* windows as gvSIG windows
|
55 |
*
|
56 |
* @author Jesus Zarzoso- jzarzoso@ai2.upv.es
|
57 |
* @version $Id$
|
58 |
*/
|
59 |
public class GvSIGGvsig3DWindowManager implements |
60 |
Gvsig3DWindowManager, ComponentListener {
|
61 |
|
62 |
private Map<JPanel, IWindow> panelToWindow = new HashMap<JPanel, IWindow>(); |
63 |
|
64 |
public void showWindow(JPanel panel, String title, int mode) { |
65 |
Gvsig3DWindow window = |
66 |
new Gvsig3DWindow(panel, title, mode);
|
67 |
|
68 |
panel.addComponentListener(this);
|
69 |
|
70 |
panelToWindow.put(panel, window); |
71 |
|
72 |
PluginServices.getMDIManager().addCentredWindow(window); |
73 |
} |
74 |
|
75 |
public void componentHidden(ComponentEvent componentEvent) { |
76 |
JPanel panel = (JPanel) componentEvent.getSource(); |
77 |
IWindow window = panelToWindow.get(panel); |
78 |
PluginServices.getMDIManager().closeWindow(window); |
79 |
panelToWindow.remove(panel); |
80 |
} |
81 |
|
82 |
public void componentMoved(ComponentEvent e) { |
83 |
// Nothing to do
|
84 |
} |
85 |
|
86 |
public void componentResized(ComponentEvent e) { |
87 |
// Nothing to do
|
88 |
} |
89 |
|
90 |
public void componentShown(ComponentEvent e) { |
91 |
// Nothing to do
|
92 |
} |
93 |
} |