root / trunk / extensions / extWFS2 / src / com / iver / cit / gvsig / gui / panels / WFSSelectFeaturePanel.java @ 4911
History | View | Annotate | Download (6.33 KB)
1 | 4886 | jorpiell | package com.iver.cit.gvsig.gui.panels; |
---|---|---|---|
2 | |||
3 | import javax.swing.JCheckBox; |
||
4 | 4911 | jorpiell | import javax.swing.JLabel; |
5 | 4886 | jorpiell | import javax.swing.JPanel; |
6 | import javax.swing.JScrollPane; |
||
7 | import javax.swing.JTextField; |
||
8 | |||
9 | import com.iver.andami.PluginServices; |
||
10 | 4911 | jorpiell | import com.iver.cit.gvsig.fmap.layers.WFSLayerNode; |
11 | 4886 | jorpiell | 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$
|
||
56 | * $Log$
|
||
57 | 4911 | jorpiell | * 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 | 4886 | jorpiell | *
|
60 | *
|
||
61 | */
|
||
62 | /**
|
||
63 | * @author Jorge Piera Llodr? (piera_jor@gva.es)
|
||
64 | */
|
||
65 | 4911 | jorpiell | 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 | 4886 | jorpiell | private JCheckBox chkExtendedNames = null; |
72 | private WFSWizardData data = null; |
||
73 | 4911 | jorpiell | private WFSParamsPanel parent = null; |
74 | 4886 | jorpiell | |
75 | /**
|
||
76 | * This method initializes
|
||
77 | *
|
||
78 | */
|
||
79 | 4911 | jorpiell | public WFSSelectFeaturePanel(WFSParamsPanel parent) {
|
80 | 4886 | jorpiell | super();
|
81 | 4911 | jorpiell | this.parent = parent;
|
82 | 4886 | jorpiell | initialize(); |
83 | } |
||
84 | |||
85 | /**
|
||
86 | * This method initializes this
|
||
87 | *
|
||
88 | */
|
||
89 | private void initialize() { |
||
90 | 4911 | jorpiell | jLabel = new JLabel(); |
91 | 4886 | jorpiell | this.setLayout(null); |
92 | 4911 | jorpiell | 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 | 4886 | jorpiell | |
102 | } |
||
103 | |||
104 | /**
|
||
105 | 4911 | jorpiell | * This method initializes coveragesListPanel
|
106 | 4886 | jorpiell | *
|
107 | * @return javax.swing.JPanel
|
||
108 | */
|
||
109 | 4911 | jorpiell | 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 | 4886 | jorpiell | } |
120 | 4911 | jorpiell | return coveragesListPanel;
|
121 | 4886 | jorpiell | } |
122 | |||
123 | /**
|
||
124 | 4911 | jorpiell | * 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 | 4886 | jorpiell | } |
150 | }); |
||
151 | } |
||
152 | 4911 | jorpiell | return lstFeatures;
|
153 | 4886 | jorpiell | } |
154 | 4911 | jorpiell | |
155 | 4886 | jorpiell | /**
|
156 | 4911 | jorpiell | * This method initializes jTextField
|
157 | 4886 | jorpiell | *
|
158 | 4911 | jorpiell | * @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 | 4886 | jorpiell | } |
165 | 4911 | jorpiell | return txtName;
|
166 | 4886 | jorpiell | } |
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 | 4911 | jorpiell | boolean b = chkExtendedNames.isSelected();
|
179 | getLstFeatures().showLayerNames = b; |
||
180 | getLstFeatures().repaint(); |
||
181 | 4886 | jorpiell | } |
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 | 4911 | jorpiell | chkExtendedNames.setBounds(10, 368, 150, 20); |
189 | 4886 | jorpiell | // chkExtendedNames.setSelected(fPrefs.getBoolean("show_layer_names", false));
|
190 | |||
191 | } |
||
192 | return chkExtendedNames;
|
||
193 | } |
||
194 | |||
195 | /**
|
||
196 | 4911 | jorpiell | *
|
197 | * @return The selected Feature
|
||
198 | 4886 | jorpiell | */
|
199 | 4911 | jorpiell | public Object getSelectedFeature(){ |
200 | return getLstFeatures().getSelectedValue();
|
||
201 | 4886 | jorpiell | } |
202 | |||
203 | /**
|
||
204 | 4911 | jorpiell | * Sets the object that holds the wizard data.
|
205 | *
|
||
206 | * Establece el objeto que contiene los datos del wizard.
|
||
207 | *
|
||
208 | * @param data
|
||
209 | 4886 | jorpiell | */
|
210 | 4911 | jorpiell | public void setWizardData(WFSWizardData data) { |
211 | this.data = data;
|
||
212 | refreshInfo(); |
||
213 | 4886 | jorpiell | } |
214 | |||
215 | /**
|
||
216 | 4911 | jorpiell | * Refresh the features list
|
217 | 4886 | jorpiell | *
|
218 | */
|
||
219 | 4911 | jorpiell | public void refreshInfo(){ |
220 | getLstFeatures().addFeatures(data.getFeatures()); |
||
221 | 4886 | jorpiell | } |
222 | |||
223 | /**
|
||
224 | 4911 | jorpiell | * Refreshes the wizard components data each time a feature
|
225 | * is selected. The describeFeatureType operation must be
|
||
226 | * sent
|
||
227 | 4886 | jorpiell | */
|
228 | 4911 | jorpiell | public void refreshData(){ |
229 | WFSLayerNode lyr = (WFSLayerNode)getLstFeatures().getSelectedValue(); |
||
230 | getTxtName().setText(lyr.getTitle()); |
||
231 | parent.refreshData(lyr); |
||
232 | 4886 | jorpiell | } |
233 | |||
234 | |||
235 | |||
236 | |||
237 | 4911 | jorpiell | } // @jve:decl-index=0:visual-constraint="10,16" |