svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.library / org.gvsig.exportto / org.gvsig.exportto.swing / org.gvsig.exportto.swing.impl / src / main / java / org / gvsig / exportto / swing / impl / DefaultExporttoWindowManager.java @ 41610
History | View | Annotate | Download (2.57 KB)
1 |
/**
|
---|---|
2 |
* gvSIG. Desktop Geographic Information System.
|
3 |
*
|
4 |
* Copyright (C) 2007-2013 gvSIG Association.
|
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 3
|
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 |
* For any additional information, do not hesitate to contact us
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com.
|
23 |
*/
|
24 |
package org.gvsig.exportto.swing.impl; |
25 |
|
26 |
import java.awt.BorderLayout; |
27 |
import java.awt.Dimension; |
28 |
import java.awt.Toolkit; |
29 |
import java.awt.event.ComponentEvent; |
30 |
import java.awt.event.ComponentListener; |
31 |
|
32 |
import javax.swing.JFrame; |
33 |
import javax.swing.JPanel; |
34 |
|
35 |
import org.gvsig.exportto.swing.ExporttoWindowManager; |
36 |
import org.gvsig.exportto.swing.JExporttoServicePanel; |
37 |
|
38 |
/**
|
39 |
* Default implementation for the {@link ExporttoWindowManager}.
|
40 |
*
|
41 |
* @author gvSIG Team
|
42 |
* @version $Id$
|
43 |
*/
|
44 |
public class DefaultExporttoWindowManager implements ExporttoWindowManager, |
45 |
ComponentListener {
|
46 |
|
47 |
public void showWindow(JExporttoServicePanel panel, String title, int mode) { |
48 |
JFrame frame = new JFrame(); |
49 |
// frame.setAlwaysOnTop(true);
|
50 |
|
51 |
final Dimension s = Toolkit.getDefaultToolkit().getScreenSize(); |
52 |
frame.setLocation(s.width / 4, s.height / 4); |
53 |
|
54 |
frame.setLayout(new BorderLayout()); |
55 |
frame.setTitle(title); |
56 |
frame.add(panel, BorderLayout.CENTER);
|
57 |
|
58 |
frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
|
59 |
|
60 |
panel.addComponentListener(this);
|
61 |
|
62 |
frame.pack(); |
63 |
frame.setVisible(true);
|
64 |
} |
65 |
|
66 |
public void componentHidden(ComponentEvent componentEvent) { |
67 |
JFrame frame =
|
68 |
(JFrame) ((JPanel) componentEvent.getSource()).getRootPane() |
69 |
.getParent(); |
70 |
frame.setVisible(false);
|
71 |
frame.dispose(); |
72 |
} |
73 |
|
74 |
public void componentMoved(ComponentEvent arg0) { |
75 |
// Do nothing
|
76 |
} |
77 |
|
78 |
public void componentResized(ComponentEvent arg0) { |
79 |
// Do nothing
|
80 |
} |
81 |
|
82 |
public void componentShown(ComponentEvent arg0) { |
83 |
// Do nothing
|
84 |
} |
85 |
} |