Statistics
| Revision:

root / branches / v2_0_0_prep / libraries / org.gvsig.exportto / org.gvsig.exportto.swing / org.gvsig.exportto.swing.impl / src / main / java / org / gvsig / exportto / swing / impl / DefaultExporttoWindowManager.java @ 38608

History | View | Annotate | Download (2.52 KB)

1 34981 jpiera
/* 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.swing.impl;
23
24
import java.awt.BorderLayout;
25
import java.awt.Dimension;
26
import java.awt.Toolkit;
27
import java.awt.event.ComponentEvent;
28
import java.awt.event.ComponentListener;
29
30
import javax.swing.JFrame;
31
import javax.swing.JPanel;
32
33
import org.gvsig.exportto.swing.ExporttoWindowManager;
34
import org.gvsig.exportto.swing.JExporttoServicePanel;
35
36
/**
37
 * Default implementation for the {@link ExporttoWindowManager}.
38
 *
39
 * @author gvSIG Team
40
 * @version $Id$
41
 */
42 37780 cordinyana
public class DefaultExporttoWindowManager implements ExporttoWindowManager,
43
    ComponentListener {
44 34981 jpiera
45
    public void showWindow(JExporttoServicePanel panel, String title, int mode) {
46
        JFrame frame = new JFrame();
47
        // frame.setAlwaysOnTop(true);
48
49
        final Dimension s = Toolkit.getDefaultToolkit().getScreenSize();
50
        frame.setLocation(s.width / 4, s.height / 4);
51
52
        frame.setLayout(new BorderLayout());
53
        frame.setTitle(title);
54
        frame.add(panel, BorderLayout.CENTER);
55
56
        frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
57
58
        panel.addComponentListener(this);
59
60
        frame.pack();
61
        frame.setVisible(true);
62
    }
63
64
    public void componentHidden(ComponentEvent componentEvent) {
65
        JFrame frame =
66
            (JFrame) ((JPanel) componentEvent.getSource()).getRootPane()
67
                .getParent();
68
        frame.setVisible(false);
69
        frame.dispose();
70
    }
71
72
    public void componentMoved(ComponentEvent arg0) {
73
        // Do nothing
74
    }
75
76
    public void componentResized(ComponentEvent arg0) {
77
        // Do nothing
78
    }
79
80
    public void componentShown(ComponentEvent arg0) {
81
        // Do nothing
82
    }
83
}