svn-gvsig-desktop / branches / v2_0_0_prep / extensions / org.gvsig.exportto.app / org.gvsig.exportto.app.extension / src / main / java / org / gvsig / exportto / app / extension / GvSIGExporttoWindowManager.java @ 37781
History | View | Annotate | Download (2.51 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.exportto.app.extension; |
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.exportto.swing.ExporttoWindowManager; |
34 |
import org.gvsig.exportto.swing.JExporttoServicePanel; |
35 |
|
36 |
/**
|
37 |
* {@link ExporttoWindowManager} implementation to show Exportto
|
38 |
* windows as gvSIG windows
|
39 |
*
|
40 |
* @author gvSIG Team
|
41 |
* @version $Id$
|
42 |
*/
|
43 |
public class GvSIGExporttoWindowManager implements ExporttoWindowManager, |
44 |
ComponentListener {
|
45 |
|
46 |
private Map<JPanel, IWindow> panelToWindow = new HashMap<JPanel, IWindow>(); |
47 |
|
48 |
public void showWindow(JExporttoServicePanel panel, String title, int mode) { |
49 |
ExporttoWindow window = new ExporttoWindow(panel, title, mode);
|
50 |
panel |
51 |
.setExporttoServicePanelListener(new ExporttoWindowListener(window));
|
52 |
|
53 |
panel.addComponentListener(this);
|
54 |
|
55 |
panelToWindow.put(panel, window); |
56 |
|
57 |
PluginServices.getMDIManager().addCentredWindow(window); |
58 |
} |
59 |
|
60 |
public void componentHidden(ComponentEvent componentEvent) { |
61 |
JPanel panel = (JPanel) componentEvent.getSource(); |
62 |
IWindow window = panelToWindow.get(panel); |
63 |
PluginServices.getMDIManager().closeWindow(window); |
64 |
panelToWindow.remove(panel); |
65 |
} |
66 |
|
67 |
public void componentMoved(ComponentEvent e) { |
68 |
// Nothing to do
|
69 |
} |
70 |
|
71 |
public void componentResized(ComponentEvent e) { |
72 |
// Nothing to do
|
73 |
} |
74 |
|
75 |
public void componentShown(ComponentEvent e) { |
76 |
// Nothing to do
|
77 |
} |
78 |
} |