svn-gvsig-desktop / trunk / extensions / extWFS2 / src / com / iver / cit / gvsig / gui / panels / WFSSelectFeaturePanel.java @ 4911
History | View | Annotate | Download (6.33 KB)
1 |
package com.iver.cit.gvsig.gui.panels; |
---|---|
2 |
|
3 |
import javax.swing.JCheckBox; |
4 |
import javax.swing.JLabel; |
5 |
import javax.swing.JPanel; |
6 |
import javax.swing.JScrollPane; |
7 |
import javax.swing.JTextField; |
8 |
|
9 |
import com.iver.andami.PluginServices; |
10 |
import com.iver.cit.gvsig.fmap.layers.WFSLayerNode; |
11 |
import com.iver.cit.gvsig.gui.wizards.WFSWizardData; |
12 |
|
13 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
14 |
*
|
15 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
|
16 |
*
|
17 |
* This program is free software; you can redistribute it and/or
|
18 |
* modify it under the terms of the GNU General Public License
|
19 |
* as published by the Free Software Foundation; either version 2
|
20 |
* of the License, or (at your option) any later version.
|
21 |
*
|
22 |
* This program is distributed in the hope that it will be useful,
|
23 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
24 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
25 |
* GNU General Public License for more details.
|
26 |
*
|
27 |
* You should have received a copy of the GNU General Public License
|
28 |
* along with this program; if not, write to the Free Software
|
29 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
|
30 |
*
|
31 |
* For more information, contact:
|
32 |
*
|
33 |
* Generalitat Valenciana
|
34 |
* Conselleria d'Infraestructures i Transport
|
35 |
* Av. Blasco Ib??ez, 50
|
36 |
* 46010 VALENCIA
|
37 |
* SPAIN
|
38 |
*
|
39 |
* +34 963862235
|
40 |
* gvsig@gva.es
|
41 |
* www.gvsig.gva.es
|
42 |
*
|
43 |
* or
|
44 |
*
|
45 |
* IVER T.I. S.A
|
46 |
* Salamanca 50
|
47 |
* 46005 Valencia
|
48 |
* Spain
|
49 |
*
|
50 |
* +34 963163400
|
51 |
* dac@iver.es
|
52 |
*/
|
53 |
/* CVS MESSAGES:
|
54 |
*
|
55 |
* $Id: WFSSelectFeaturePanel.java 4911 2006-04-20 16:38:24Z jorpiell $
|
56 |
* $Log$
|
57 |
* Revision 1.2 2006-04-20 16:38:24 jorpiell
|
58 |
* Ahora mismo ya se puede hacer un getCapabilities y un getDescribeType de la capa seleccionada para ver los atributos a dibujar. Queda implementar el panel de opciones y hacer el getFeature().
|
59 |
*
|
60 |
*
|
61 |
*/
|
62 |
/**
|
63 |
* @author Jorge Piera Llodr? (piera_jor@gva.es)
|
64 |
*/
|
65 |
public class WFSSelectFeaturePanel extends JPanel { |
66 |
private JPanel coveragesListPanel = null; |
67 |
private JScrollPane jScrollPane = null; |
68 |
private LayerList lstFeatures = null; |
69 |
private JTextField txtName = null; |
70 |
private JLabel jLabel = null; |
71 |
private JCheckBox chkExtendedNames = null; |
72 |
private WFSWizardData data = null; |
73 |
private WFSParamsPanel parent = null; |
74 |
|
75 |
/**
|
76 |
* This method initializes
|
77 |
*
|
78 |
*/
|
79 |
public WFSSelectFeaturePanel(WFSParamsPanel parent) {
|
80 |
super();
|
81 |
this.parent = parent;
|
82 |
initialize(); |
83 |
} |
84 |
|
85 |
/**
|
86 |
* This method initializes this
|
87 |
*
|
88 |
*/
|
89 |
private void initialize() { |
90 |
jLabel = new JLabel(); |
91 |
this.setLayout(null); |
92 |
this.setBounds(10, 5, 481, 427); |
93 |
jLabel.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT); |
94 |
jLabel.setBounds(7, 5, 130, 22); |
95 |
jLabel.setText(PluginServices.getText(this, "nombre_feature")); |
96 |
|
97 |
this.add(getCoveragesListPanel(), null); |
98 |
this.add(getTxtName(), null); |
99 |
this.add(jLabel, null); |
100 |
this.add(getChkExtendedNames(), null); |
101 |
|
102 |
} |
103 |
|
104 |
/**
|
105 |
* This method initializes coveragesListPanel
|
106 |
*
|
107 |
* @return javax.swing.JPanel
|
108 |
*/
|
109 |
private JPanel getCoveragesListPanel() { |
110 |
if (coveragesListPanel == null) { |
111 |
coveragesListPanel = new JPanel(); |
112 |
coveragesListPanel.setLayout(null);
|
113 |
coveragesListPanel.setBounds(7, 33, 460, 328); |
114 |
coveragesListPanel.add(getJScrollPane(), null);
|
115 |
coveragesListPanel.setBorder(javax.swing.BorderFactory.createTitledBorder( |
116 |
null, PluginServices.getText(this, "select_features"), |
117 |
javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, |
118 |
javax.swing.border.TitledBorder.DEFAULT_POSITION, null, null)); |
119 |
} |
120 |
return coveragesListPanel;
|
121 |
} |
122 |
|
123 |
/**
|
124 |
* This method initializes jScrollPane
|
125 |
*
|
126 |
* @return javax.swing.JScrollPane
|
127 |
*/
|
128 |
private JScrollPane getJScrollPane() { |
129 |
if (jScrollPane == null) { |
130 |
jScrollPane = new JScrollPane(); |
131 |
jScrollPane.setBounds(6, 17, 446, 306); |
132 |
jScrollPane.setViewportView(getLstFeatures()); |
133 |
} |
134 |
return jScrollPane;
|
135 |
} |
136 |
|
137 |
/**
|
138 |
* This method initializes jList1
|
139 |
*
|
140 |
* @return javax.swing.JList
|
141 |
*/
|
142 |
public LayerList getLstFeatures() {
|
143 |
if (lstFeatures == null) { |
144 |
lstFeatures = new LayerList();
|
145 |
lstFeatures.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION); |
146 |
lstFeatures.addListSelectionListener(new javax.swing.event.ListSelectionListener() {
|
147 |
public void valueChanged(javax.swing.event.ListSelectionEvent e) { |
148 |
refreshData(); |
149 |
} |
150 |
}); |
151 |
} |
152 |
return lstFeatures;
|
153 |
} |
154 |
|
155 |
/**
|
156 |
* This method initializes jTextField
|
157 |
*
|
158 |
* @return javax.swing.JTextField
|
159 |
*/
|
160 |
public JTextField getTxtName() { |
161 |
if (txtName == null) { |
162 |
txtName = new JTextField(); |
163 |
txtName.setBounds(141, 6, 326, 21); |
164 |
} |
165 |
return txtName;
|
166 |
} |
167 |
/**
|
168 |
* This method initializes chkExtendedNames
|
169 |
*
|
170 |
* @return javax.swing.JCheckBox
|
171 |
*/
|
172 |
private JCheckBox getChkExtendedNames() { |
173 |
if (chkExtendedNames == null) { |
174 |
chkExtendedNames = new JCheckBox(); |
175 |
chkExtendedNames.setText(PluginServices.getText(this, "show_layer_names")); |
176 |
chkExtendedNames.addItemListener(new java.awt.event.ItemListener() {
|
177 |
public void itemStateChanged(java.awt.event.ItemEvent e) { |
178 |
boolean b = chkExtendedNames.isSelected();
|
179 |
getLstFeatures().showLayerNames = b; |
180 |
getLstFeatures().repaint(); |
181 |
} |
182 |
}); |
183 |
chkExtendedNames.addActionListener(new java.awt.event.ActionListener() {
|
184 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
185 |
// fPrefs.putBoolean("show_layer_names", chkExtendedNames.isSelected());
|
186 |
} |
187 |
}); |
188 |
chkExtendedNames.setBounds(10, 368, 150, 20); |
189 |
// chkExtendedNames.setSelected(fPrefs.getBoolean("show_layer_names", false));
|
190 |
|
191 |
} |
192 |
return chkExtendedNames;
|
193 |
} |
194 |
|
195 |
/**
|
196 |
*
|
197 |
* @return The selected Feature
|
198 |
*/
|
199 |
public Object getSelectedFeature(){ |
200 |
return getLstFeatures().getSelectedValue();
|
201 |
} |
202 |
|
203 |
/**
|
204 |
* Sets the object that holds the wizard data.
|
205 |
*
|
206 |
* Establece el objeto que contiene los datos del wizard.
|
207 |
*
|
208 |
* @param data
|
209 |
*/
|
210 |
public void setWizardData(WFSWizardData data) { |
211 |
this.data = data;
|
212 |
refreshInfo(); |
213 |
} |
214 |
|
215 |
/**
|
216 |
* Refresh the features list
|
217 |
*
|
218 |
*/
|
219 |
public void refreshInfo(){ |
220 |
getLstFeatures().addFeatures(data.getFeatures()); |
221 |
} |
222 |
|
223 |
/**
|
224 |
* Refreshes the wizard components data each time a feature
|
225 |
* is selected. The describeFeatureType operation must be
|
226 |
* sent
|
227 |
*/
|
228 |
public void refreshData(){ |
229 |
WFSLayerNode lyr = (WFSLayerNode)getLstFeatures().getSelectedValue(); |
230 |
getTxtName().setText(lyr.getTitle()); |
231 |
parent.refreshData(lyr); |
232 |
} |
233 |
|
234 |
|
235 |
|
236 |
|
237 |
} // @jve:decl-index=0:visual-constraint="10,16"
|