Statistics
| Revision:

svn-gvsig-desktop / tags / Root_v06 / applications / appCatalogYNomenclatorClient / src / es / gva / cit / catalogClient / ui / showTree / ShowTreeDialogPanel.java @ 4811

History | View | Annotate | Download (4.17 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 javax.swing.BoxLayout;
51
import javax.swing.JButton;
52
import javax.swing.JDialog;
53
import javax.swing.JPanel;
54

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

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

    
113
/**
114
 * 
115
 * 
116
 * 
117
 * @return 
118
 * @param node 
119
 */
120
    public JPanel getControlsPanel(XMLNode node) {        
121
        if (controlsPanel == null) {
122
            controlsPanel = new ShowTreePanel(node,translator);
123
        }
124
        return controlsPanel;
125
    } 
126

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

    
143
/**
144
 * 
145
 * 
146
 * 
147
 * @return 
148
 */
149
    public JButton getCloseButton() {        
150
        if (close == null) {
151
            close = new JButton(Translator.getText(translator,"close"));
152
            close.setPreferredSize(new Dimension(80, 23));
153
            close.setActionCommand("close");
154
        }
155
        return close;
156
    } 
157

    
158
/**
159
 * 
160
 * 
161
 */
162
    public void setDefaultButtonListeners() {        
163
        getCloseButton().addActionListener(this);
164
    } 
165

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

    
177
/**
178
 * 
179
 * 
180
 * 
181
 * @param e 
182
 */
183
    public void actionPerformed(ActionEvent e) {        
184
        //Buscar
185
        if (e.getActionCommand() == "close") {
186
            closeButtonActionPerformed();
187
        }
188
    } 
189

    
190
/**
191
 * 
192
 * 
193
 * 
194
 * @param parent The parent to set.
195
 */
196
    public void setParent(JDialog parent) {        
197
        this.parent = parent;
198
    } 
199
 }