Statistics
| Revision:

root / trunk / applications / appCatalogAndGazetteerClient / src / es / gva / cit / catalog / ui / showtree / ShowTreeDialogPanel.java @ 15558

History | View | Annotate | Download (3.94 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 es.gva.cit.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.i18n.Messages;
54

    
55
import es.gva.cit.catalog.metadataxml.XMLNode;
56

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

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

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

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

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

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

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

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

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