Statistics
| Revision:

svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.library / org.gvsig.symbology / org.gvsig.symbology.swing / org.gvsig.symbology.swing.impl / src / main / java / org / gvsig / symbology / swing / impl / DefaultSymbologyWindowManager.java @ 40560

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

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

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

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

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

    
57
        frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
58

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