Statistics
| Revision:

root / branches / v2_0_0_prep / libraries / org.gvsig.symbology / org.gvsig.symbology.swing / org.gvsig.symbology.swing.impl / src / main / java / org / gvsig / symbology / swing / impl / DefaultSymbologyWindowManager.java @ 34294

History | View | Annotate | Download (2.49 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.symbology.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.symbology.swing.SymbologyWindowManager;
34

    
35
/**
36
 * Default implementation for the {@link SymbologyWindowManager}.
37
 * 
38
 * @author gvSIG Team
39
 * @version $Id$
40
 */
41
public class DefaultSymbologyWindowManager implements
42
    SymbologyWindowManager, ComponentListener {
43

    
44
    public void showWindow(JPanel panel, String title, int mode) {
45
        JFrame frame = new JFrame();
46
        // frame.setAlwaysOnTop(true);
47

    
48
        final Dimension s = Toolkit.getDefaultToolkit().getScreenSize();
49
        frame.setLocation(s.width / 4, s.height / 4);
50

    
51
        frame.setLayout(new BorderLayout());
52
        frame.setTitle(title);
53
        frame.add(panel, BorderLayout.CENTER);
54

    
55
        frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
56

    
57
        frame.setSize(400, 400);
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
}