Statistics
| Revision:

svn-gvsig-desktop / trunk / applications / appCatalogYNomenclatorClient / src / es / gva / cit / catalogClient / ui / showTree / ShowTreeDialogPanel.java @ 3566

History | View | Annotate | Download (4.15 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.catalogClient.ui.showTree;
43
import es.gva.cit.catalogClient.metadataXML.XMLNode;
44
import es.gva.cit.catalogClient.traductor.ITranslator;
45
import es.gva.cit.catalogClient.traductor.Translator;
46
import java.awt.Dimension;
47
import java.awt.FlowLayout;
48
import java.awt.event.ActionEvent;
49
import java.awt.event.ActionListener;
50
import java.util.Collection;
51
import javax.swing.BoxLayout;
52
import javax.swing.JButton;
53
import javax.swing.JDialog;
54
import javax.swing.JPanel;
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
//Otros
92

    
93
/**
94
 * 
95
 * 
96
 */
97
    private boolean nuevo = true;
98
/**
99
 * 
100
 * 
101
 */
102
    private ITranslator translator = null;
103

    
104
/**
105
 * 
106
 * 
107
 * 
108
 * @param node 
109
 * @param translator 
110
 */
111
    public  ShowTreeDialogPanel(XMLNode node, ITranslator translator) {        
112
        this.translator = translator;
113
        ppalPanel = new JPanel();
114
        ppalPanel.setLayout(new BoxLayout(ppalPanel, BoxLayout.Y_AXIS));
115
        ppalPanel.add(getControlsPanel(node), null);
116
        ppalPanel.add(getButtonPanel(), null);
117
        add(ppalPanel);
118
        setDefaultButtonListeners();
119
    } 
120

    
121
/**
122
 * 
123
 * 
124
 * 
125
 * @return 
126
 * @param node 
127
 */
128
    public JPanel getControlsPanel(XMLNode node) {        
129
        if (controlsPanel == null) {
130
            controlsPanel = new ShowTreePanel(node,translator);
131
        }
132
        return controlsPanel;
133
    } 
134

    
135
/**
136
 * 
137
 * 
138
 * 
139
 * @return 
140
 */
141
    public JPanel getButtonPanel() {        
142
        if (buttonsPanel == null) {
143
            buttonsPanel = new JPanel(new FlowLayout());
144
            buttonsPanel.add(getCloseButton());
145
        }
146
        return buttonsPanel;
147
    } 
148

    
149
/**
150
 * 
151
 * 
152
 * 
153
 * @return 
154
 */
155
    public JButton getCloseButton() {        
156
        if (close == null) {
157
            close = new JButton(Translator.getText(translator,"close"));
158
            close.setSize(new Dimension(30, 20));
159
            close.setActionCommand("close");
160
        }
161
        return close;
162
    } 
163

    
164
/**
165
 * 
166
 * 
167
 */
168
    public void setDefaultButtonListeners() {        
169
        getCloseButton().addActionListener(this);
170
    } 
171

    
172
/**
173
 * 
174
 * 
175
 */
176
    public void closeButtonActionPerformed() {        
177
        parent.setVisible(false);
178
    } 
179
/* (non-Javadoc)
180
     * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
181
     */
182

    
183
/**
184
 * 
185
 * 
186
 * 
187
 * @param e 
188
 */
189
    public void actionPerformed(ActionEvent e) {        
190
        //Buscar
191
        if (e.getActionCommand() == "close") {
192
            closeButtonActionPerformed();
193
        }
194
    } 
195

    
196
/**
197
 * 
198
 * 
199
 * 
200
 * @param parent The parent to set.
201
 */
202
    public void setParent(JDialog parent) {        
203
        this.parent = parent;
204
    } 
205
 }