Statistics
| Revision:

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

History | View | Annotate | Download (4.17 KB)

1 3566 jorpiell
2 3213 jorpiell
/* 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 3613 jorpiell
import es.gva.cit.catalogClient.metadataXML.XMLNode;
44
import es.gva.cit.catalogClient.traductor.ITranslator;
45
import es.gva.cit.catalogClient.traductor.Translator;
46 3213 jorpiell
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 3566 jorpiell
 *
57
 *
58
 *
59 3213 jorpiell
 * @author Jorge Piera Llodra (piera_jor@gva.es)
60
 */
61
public class ShowTreeDialogPanel extends JPanel implements ActionListener {
62 3566 jorpiell
//It is needed to close the frame
63
/**
64
 *
65
 *
66
 */
67 3213 jorpiell
    private JDialog parent;
68 3566 jorpiell
//Panels
69
/**
70
 *
71
 *
72
 */
73 3213 jorpiell
    private JPanel ppalPanel = null;
74 3566 jorpiell
/**
75
 *
76
 *
77
 */
78 3213 jorpiell
    private ShowTreePanel controlsPanel = null;
79 3566 jorpiell
/**
80
 *
81
 *
82
 */
83 3213 jorpiell
    private JPanel buttonsPanel = null;
84 3566 jorpiell
//Buttons
85
/**
86
 *
87
 *
88
 */
89 3213 jorpiell
    protected JButton close = null;
90 3566 jorpiell
/**
91
 *
92
 *
93
 */
94 3213 jorpiell
    private ITranslator translator = null;
95
96 3566 jorpiell
/**
97
 *
98
 *
99
 *
100
 * @param node
101
 * @param translator
102
 */
103
    public  ShowTreeDialogPanel(XMLNode node, ITranslator translator) {
104 3213 jorpiell
        this.translator = translator;
105
        ppalPanel = new JPanel();
106
        ppalPanel.setLayout(new BoxLayout(ppalPanel, BoxLayout.Y_AXIS));
107 3566 jorpiell
        ppalPanel.add(getControlsPanel(node), null);
108 3213 jorpiell
        ppalPanel.add(getButtonPanel(), null);
109
        add(ppalPanel);
110
        setDefaultButtonListeners();
111 3566 jorpiell
    }
112 3213 jorpiell
113 3566 jorpiell
/**
114
 *
115
 *
116
 *
117
 * @return
118
 * @param node
119
 */
120
    public JPanel getControlsPanel(XMLNode node) {
121 3213 jorpiell
        if (controlsPanel == null) {
122
            controlsPanel = new ShowTreePanel(node,translator);
123
        }
124
        return controlsPanel;
125 3566 jorpiell
    }
126 3213 jorpiell
127 3566 jorpiell
/**
128
 *
129
 *
130
 *
131
 * @return
132
 */
133
    public JPanel getButtonPanel() {
134 3213 jorpiell
        if (buttonsPanel == null) {
135 4392 jorpiell
            FlowLayout flowLayout = new FlowLayout();
136
            flowLayout.setAlignment(FlowLayout.RIGHT);
137
                buttonsPanel = new JPanel(flowLayout);
138 3213 jorpiell
            buttonsPanel.add(getCloseButton());
139
        }
140
        return buttonsPanel;
141 3566 jorpiell
    }
142 3213 jorpiell
143 3566 jorpiell
/**
144
 *
145
 *
146
 *
147
 * @return
148
 */
149
    public JButton getCloseButton() {
150 3213 jorpiell
        if (close == null) {
151
            close = new JButton(Translator.getText(translator,"close"));
152 4392 jorpiell
            close.setPreferredSize(new Dimension(80, 23));
153 3213 jorpiell
            close.setActionCommand("close");
154
        }
155
        return close;
156 3566 jorpiell
    }
157 3213 jorpiell
158 3566 jorpiell
/**
159
 *
160
 *
161
 */
162
    public void setDefaultButtonListeners() {
163 3213 jorpiell
        getCloseButton().addActionListener(this);
164 3566 jorpiell
    }
165
166
/**
167
 *
168
 *
169
 */
170
    public void closeButtonActionPerformed() {
171 3213 jorpiell
        parent.setVisible(false);
172 3566 jorpiell
    }
173
/* (non-Javadoc)
174 3213 jorpiell
     * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
175
     */
176 3566 jorpiell
177
/**
178
 *
179
 *
180
 *
181
 * @param e
182
 */
183
    public void actionPerformed(ActionEvent e) {
184 3213 jorpiell
        //Buscar
185
        if (e.getActionCommand() == "close") {
186
            closeButtonActionPerformed();
187
        }
188 3566 jorpiell
    }
189 3213 jorpiell
190 3566 jorpiell
/**
191
 *
192
 *
193
 *
194
 * @param parent The parent to set.
195
 */
196
    public void setParent(JDialog parent) {
197 3213 jorpiell
        this.parent = parent;
198 3566 jorpiell
    }
199
 }