gvsig-educa / org.gvsig.educa.thematicmap.app / trunk / org.gvsig.educa.thematicmap.app / org.gvsig.educa.thematicmap.app.viewer / src / main / java / org / gvsig / educa / thematicmap / app / viewer / GvSIGThematicMapWindowManager.java @ 2
History | View | Annotate | Download (2.41 KB)
1 |
/* gvSIG. Geographic Information System of the Valencian Government
|
---|---|
2 |
*
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department
|
4 |
* of the Valencian Government (CIT)
|
5 |
*
|
6 |
* This program is free software; you can redistribute it and/or
|
7 |
* modify it under the terms of the GNU General Public License
|
8 |
* as published by the Free Software Foundation; either version 2
|
9 |
* of the License, or (at your option) any later version.
|
10 |
*
|
11 |
* This program is distributed in the hope that it will be useful,
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14 |
* GNU General Public License for more details.
|
15 |
*
|
16 |
* You should have received a copy of the GNU General Public License
|
17 |
* along with this program; if not, write to the Free Software
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
19 |
* MA 02110-1301, USA.
|
20 |
*
|
21 |
*/
|
22 |
package org.gvsig.educa.thematicmap.app.viewer; |
23 |
|
24 |
import java.awt.event.ComponentEvent; |
25 |
import java.awt.event.ComponentListener; |
26 |
import java.util.HashMap; |
27 |
import java.util.Map; |
28 |
|
29 |
import javax.swing.JPanel; |
30 |
|
31 |
import org.gvsig.andami.PluginServices; |
32 |
import org.gvsig.andami.ui.mdiManager.IWindow; |
33 |
import org.gvsig.educa.thematicmap.swing.ThematicMapWindowManager; |
34 |
|
35 |
/**
|
36 |
* {@link ThematicMapWindowManager} implementation to show ThematicMap
|
37 |
* windows as gvSIG windows
|
38 |
*
|
39 |
* @author gvSIG Team
|
40 |
* @version $Id$
|
41 |
*/
|
42 |
public class GvSIGThematicMapWindowManager implements |
43 |
ThematicMapWindowManager, ComponentListener {
|
44 |
|
45 |
private Map<JPanel, IWindow> panelToWindow = new HashMap<JPanel, IWindow>(); |
46 |
|
47 |
public void showWindow(JPanel panel, String title, int mode) { |
48 |
ThematicMapWindow window = |
49 |
new ThematicMapWindow(panel, title, mode);
|
50 |
|
51 |
panel.addComponentListener(this);
|
52 |
|
53 |
panelToWindow.put(panel, window); |
54 |
|
55 |
PluginServices.getMDIManager().addCentredWindow(window); |
56 |
} |
57 |
|
58 |
public void componentHidden(ComponentEvent componentEvent) { |
59 |
JPanel panel = (JPanel) componentEvent.getSource(); |
60 |
IWindow window = panelToWindow.get(panel); |
61 |
PluginServices.getMDIManager().closeWindow(window); |
62 |
panelToWindow.remove(panel); |
63 |
} |
64 |
|
65 |
public void componentMoved(ComponentEvent e) { |
66 |
// Nothing to do
|
67 |
} |
68 |
|
69 |
public void componentResized(ComponentEvent e) { |
70 |
// Nothing to do
|
71 |
} |
72 |
|
73 |
public void componentShown(ComponentEvent e) { |
74 |
// Nothing to do
|
75 |
} |
76 |
} |