Statistics
| Revision:

gvsig-catalog / org.gvsig.catalog / branches / org.gvsig.catalog-CSW2.0.2 / org.gvsig.catalog / org.gvsig.catalog.lib / src / main / java / org / gvsig / catalog / ui / showtree / ShowTreeDialogPanel.java @ 55

History | View | Annotate | Download (3.93 KB)

1

    
2
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
3
*
4
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
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., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
19
*
20
* For more information, contact:
21
*
22
*  Generalitat Valenciana
23
*   Conselleria d'Infraestructures i Transport
24
*   Av. Blasco Ib??ez, 50
25
*   46010 VALENCIA
26
*   SPAIN
27
*
28
*      +34 963862235
29
*   gvsig@gva.es
30
*      www.gvsig.gva.es
31
*
32
*    or
33
*
34
*   IVER T.I. S.A
35
*   Salamanca 50
36
*   46005 Valencia
37
*   Spain
38
*
39
*   +34 963163400
40
*   dac@iver.es
41
*/
42
package org.gvsig.catalog.ui.showtree;
43
import java.awt.Dimension;
44
import java.awt.FlowLayout;
45
import java.awt.event.ActionEvent;
46
import java.awt.event.ActionListener;
47

    
48
import javax.swing.BoxLayout;
49
import javax.swing.JButton;
50
import javax.swing.JDialog;
51
import javax.swing.JPanel;
52

    
53
import org.gvsig.catalog.metadataxml.XMLNode;
54
import org.gvsig.i18n.Messages;
55

    
56
/**
57
 * 
58
 * 
59
 * 
60
 * @author Jorge Piera Llodra (piera_jor@gva.es)
61
 */
62
public class ShowTreeDialogPanel extends JPanel implements ActionListener {
63
//It is needed to close the frame
64
/**
65
 * 
66
 * 
67
 */
68
    private JDialog parent;
69
//Panels
70
/**
71
 * 
72
 * 
73
 */
74
    private JPanel ppalPanel = null;
75
/**
76
 * 
77
 * 
78
 */
79
    private ShowTreePanel controlsPanel = null;
80
/**
81
 * 
82
 * 
83
 */
84
    private JPanel buttonsPanel = null;
85
//Buttons
86
/**
87
 * 
88
 * 
89
 */
90
    protected JButton close = null;
91

    
92
/**
93
 * 
94
 * 
95
 * 
96
 * @param node 
97
 * @param translator 
98
 */
99
    public  ShowTreeDialogPanel(XMLNode node) {
100
        ppalPanel = new JPanel();
101
        ppalPanel.setLayout(new BoxLayout(ppalPanel, BoxLayout.Y_AXIS));
102
        ppalPanel.add(getControlsPanel(node), null);
103
        ppalPanel.add(getButtonPanel(), null);
104
        add(ppalPanel);
105
        setDefaultButtonListeners();
106
    } 
107

    
108
/**
109
 * 
110
 * 
111
 * 
112
 * @return 
113
 * @param node 
114
 */
115
    public JPanel getControlsPanel(XMLNode node) {        
116
        if (controlsPanel == null) {
117
            controlsPanel = new ShowTreePanel(node);
118
        }
119
        return controlsPanel;
120
    } 
121

    
122
/**
123
 * 
124
 * 
125
 * 
126
 * @return 
127
 */
128
    public JPanel getButtonPanel() {        
129
        if (buttonsPanel == null) {
130
            FlowLayout flowLayout = new FlowLayout();
131
            flowLayout.setAlignment(FlowLayout.RIGHT);
132
                buttonsPanel = new JPanel(flowLayout);
133
            buttonsPanel.add(getCloseButton());
134
        }
135
        return buttonsPanel;
136
    } 
137

    
138
/**
139
 * 
140
 * 
141
 * 
142
 * @return 
143
 */
144
    public JButton getCloseButton() {        
145
        if (close == null) {
146
            close = new JButton(Messages.getText("close"));
147
            close.setPreferredSize(new Dimension(80, 23));
148
            close.setActionCommand("close");
149
        }
150
        return close;
151
    } 
152

    
153
/**
154
 * 
155
 * 
156
 */
157
    public void setDefaultButtonListeners() {        
158
        getCloseButton().addActionListener(this);
159
    } 
160

    
161
/**
162
 * 
163
 * 
164
 */
165
    public void closeButtonActionPerformed() {        
166
        parent.setVisible(false);
167
    } 
168
/* (non-Javadoc)
169
     * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
170
     */
171

    
172
/**
173
 * 
174
 * 
175
 * 
176
 * @param e 
177
 */
178
    public void actionPerformed(ActionEvent e) {        
179
        //Buscar
180
        if (e.getActionCommand() == "close") {
181
            closeButtonActionPerformed();
182
        }
183
    } 
184

    
185
/**
186
 * 
187
 * 
188
 * 
189
 * @param parent The parent to set.
190
 */
191
    public void setParent(JDialog parent) {        
192
        this.parent = parent;
193
    } 
194
 }