svn-gvsig-desktop / trunk / applications / appCatalogYNomenclatorClient / src / es / gva / cit / catalogClient / ui / ChooseResourceDialogPanel.java @ 3081
History | View | Annotate | Download (4.24 KB)
1 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
---|---|
2 |
*
|
3 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
|
4 |
*
|
5 |
* This program is free software; you can redistribute it and/or
|
6 |
* modify it under the terms of the GNU General Public License
|
7 |
* as published by the Free Software Foundation; either version 2
|
8 |
* of the License, or (at your option) any later version.
|
9 |
*
|
10 |
* This program is distributed in the hope that it will be useful,
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
* GNU General Public License for more details.
|
14 |
*
|
15 |
* You should have received a copy of the GNU General Public License
|
16 |
* along with this program; if not, write to the Free Software
|
17 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
|
18 |
*
|
19 |
* For more information, contact:
|
20 |
*
|
21 |
* Generalitat Valenciana
|
22 |
* Conselleria d'Infraestructures i Transport
|
23 |
* Av. Blasco Ib??ez, 50
|
24 |
* 46010 VALENCIA
|
25 |
* SPAIN
|
26 |
*
|
27 |
* +34 963862235
|
28 |
* gvsig@gva.es
|
29 |
* www.gvsig.gva.es
|
30 |
*
|
31 |
* or
|
32 |
*
|
33 |
* IVER T.I. S.A
|
34 |
* Salamanca 50
|
35 |
* 46005 Valencia
|
36 |
* Spain
|
37 |
*
|
38 |
* +34 963163400
|
39 |
* dac@iver.es
|
40 |
*/
|
41 |
package es.gva.cit.catalogClient.ui; |
42 |
|
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.JCheckBox; |
51 |
import javax.swing.JFrame; |
52 |
import javax.swing.JPanel; |
53 |
|
54 |
import es.gva.cit.catalogClient.parsers.Resource; |
55 |
import es.gva.cit.catalogClient.utils.ResourcesTable.ButtonEditor; |
56 |
import es.gva.cit.catalogClient.utils.ResourcesTable.ButtonRenderer; |
57 |
|
58 |
/**
|
59 |
*
|
60 |
*
|
61 |
* @author Jorge Piera Llodra (piera_jor@gva.es)
|
62 |
*/
|
63 |
public class ChooseResourceDialogPanel extends JPanel implements ActionListener { |
64 |
//It is needed to close the frame
|
65 |
private JFrame parent; |
66 |
|
67 |
//Panels
|
68 |
JPanel ppalPanel = null; |
69 |
ChooseResourcePanel resourcePanel = null;
|
70 |
JPanel buttonsPanel = null; |
71 |
|
72 |
//Buttons
|
73 |
JButton cerrar = null; |
74 |
|
75 |
//Others
|
76 |
private Resource[] resources; |
77 |
|
78 |
|
79 |
/**
|
80 |
* This method initializes
|
81 |
*
|
82 |
*/
|
83 |
public ChooseResourceDialogPanel(Resource[] resources) { |
84 |
this.resources = resources;
|
85 |
|
86 |
|
87 |
ppalPanel = new JPanel(); |
88 |
ppalPanel.setLayout(new BoxLayout(ppalPanel, BoxLayout.Y_AXIS)); |
89 |
|
90 |
ppalPanel.add(getControlsPanel(), null);
|
91 |
ppalPanel.add(getButtonPanel(), null);
|
92 |
|
93 |
|
94 |
add(ppalPanel); |
95 |
|
96 |
setDefaultButtonListeners(); |
97 |
} |
98 |
|
99 |
|
100 |
public ChooseResourcePanel getControlsPanel() {
|
101 |
if (resourcePanel == null) { |
102 |
resourcePanel = new ChooseResourcePanel(resources);
|
103 |
resourcePanel.setPreferredSize(new java.awt.Dimension(575, 110)); |
104 |
resourcePanel.setLocation(0, 0); |
105 |
} |
106 |
|
107 |
return resourcePanel;
|
108 |
} |
109 |
|
110 |
public JPanel getButtonPanel() { |
111 |
if (buttonsPanel == null) { |
112 |
buttonsPanel = new JPanel(new FlowLayout()); |
113 |
buttonsPanel.add(getCloseButton()); |
114 |
} |
115 |
return buttonsPanel;
|
116 |
} |
117 |
|
118 |
public JButton getCloseButton() { |
119 |
if (cerrar == null) { |
120 |
cerrar = new JButton("Cerrar"); |
121 |
cerrar.setSize(new Dimension(30, 20)); |
122 |
cerrar.setActionCommand("Cerrar");
|
123 |
} |
124 |
return cerrar;
|
125 |
} |
126 |
|
127 |
public void setDefaultButtonListeners() { |
128 |
getCloseButton().addActionListener(this);
|
129 |
getControlsPanel().getTable().getColumn("Ver").setCellRenderer(new ButtonRenderer()); |
130 |
getControlsPanel().getTable().getColumn("Ver").setCellEditor(new ButtonEditor(new JCheckBox(),resources,this)); |
131 |
|
132 |
} |
133 |
|
134 |
public void actionPerformed(ActionEvent e) { |
135 |
//Cerrar
|
136 |
if (e.getActionCommand() == "Cerrar") { |
137 |
closeButtonActionPerformed(); |
138 |
} |
139 |
System.out.println(e.getActionCommand());
|
140 |
|
141 |
} |
142 |
|
143 |
public void resourceButtonActionPerformed(Resource resource){ |
144 |
System.out.println(resource.getLinkage() + " no se puede cargar sin usar gvSIG"); |
145 |
} |
146 |
|
147 |
public void closeButtonActionPerformed() { |
148 |
parent.setVisible(false);
|
149 |
} |
150 |
|
151 |
/**
|
152 |
* @param parent The parent to set.
|
153 |
*/
|
154 |
public void setParent(JFrame parent) { |
155 |
this.parent = parent;
|
156 |
} |
157 |
} |