Revision 36038
branches/v2_0_0_prep/extensions/extWFS2/src/org/gvsig/wfs/gui/panels/DataReturnedOfDataLoadingFromActiveView.java | ||
---|---|---|
1 |
package org.gvsig.wfs.gui.panels; |
|
2 |
|
|
3 |
import org.geotools.filter.DefaultExpression; |
|
4 |
|
|
5 |
|
|
6 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana |
|
7 |
* |
|
8 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana. |
|
9 |
* |
|
10 |
* This program is free software; you can redistribute it and/or |
|
11 |
* modify it under the terms of the GNU General Public License |
|
12 |
* as published by the Free Software Foundation; either version 2 |
|
13 |
* of the License, or (at your option) any later version. |
|
14 |
* |
|
15 |
* This program is distributed in the hope that it will be useful, |
|
16 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
17 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
18 |
* GNU General Public License for more details. |
|
19 |
* |
|
20 |
* You should have received a copy of the GNU General Public License |
|
21 |
* along with this program; if not, write to the Free Software |
|
22 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA. |
|
23 |
* |
|
24 |
* For more information, contact: |
|
25 |
* |
|
26 |
* Generalitat Valenciana |
|
27 |
* Conselleria d'Infraestructures i Transport |
|
28 |
* Av. Blasco Ib??ez, 50 |
|
29 |
* 46010 VALENCIA |
|
30 |
* SPAIN |
|
31 |
* |
|
32 |
* +34 963862235 |
|
33 |
* gvsig@gva.es |
|
34 |
* www.gvsig.gva.es |
|
35 |
* |
|
36 |
* or |
|
37 |
* |
|
38 |
* IVER T.I. S.A |
|
39 |
* Salamanca 50 |
|
40 |
* 46005 Valencia |
|
41 |
* Spain |
|
42 |
* |
|
43 |
* +34 963163400 |
|
44 |
* dac@iver.es |
|
45 |
*/ |
|
46 |
|
|
47 |
/** |
|
48 |
* Data that the static method of "DataLoadingFromActiveView" class returns |
|
49 |
* |
|
50 |
* @author Pablo Piqueras Bartolom? (p_queras@hotmail.com) |
|
51 |
*/ |
|
52 |
public class DataReturnedOfDataLoadingFromActiveView { |
|
53 |
private DefaultExpression dED = null; |
|
54 |
private String filterTitle = ""; |
|
55 |
|
|
56 |
/** |
|
57 |
* Constructor with 2 parameters |
|
58 |
* |
|
59 |
* @param data |
|
60 |
* @param title |
|
61 |
*/ |
|
62 |
public DataReturnedOfDataLoadingFromActiveView(DefaultExpression data, String title) { |
|
63 |
dED = data; |
|
64 |
filterTitle = title; |
|
65 |
} |
|
66 |
|
|
67 |
/** |
|
68 |
* Returns the title |
|
69 |
* |
|
70 |
* @return A String |
|
71 |
*/ |
|
72 |
public String getTitle() { |
|
73 |
return filterTitle; |
|
74 |
} |
|
75 |
|
|
76 |
/** |
|
77 |
* Returns the data |
|
78 |
* |
|
79 |
* @return A 'DefaultExpressionDataSource' reference |
|
80 |
*/ |
|
81 |
public DefaultExpression getData() { |
|
82 |
return dED; |
|
83 |
} |
|
84 |
} |
branches/v2_0_0_prep/extensions/extWFS2/src/org/gvsig/wfs/gui/panels/DataLoadingFromActiveView.java | ||
---|---|---|
1 |
package org.gvsig.wfs.gui.panels; |
|
2 |
|
|
3 |
import org.geotools.filter.DefaultExpression; |
|
4 |
|
|
5 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana |
|
6 |
* |
|
7 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana. |
|
8 |
* |
|
9 |
* This program is free software; you can redistribute it and/or |
|
10 |
* modify it under the terms of the GNU General Public License |
|
11 |
* as published by the Free Software Foundation; either version 2 |
|
12 |
* of the License, or (at your option) any later version. |
|
13 |
* |
|
14 |
* This program is distributed in the hope that it will be useful, |
|
15 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
16 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
17 |
* GNU General Public License for more details. |
|
18 |
* |
|
19 |
* You should have received a copy of the GNU General Public License |
|
20 |
* along with this program; if not, write to the Free Software |
|
21 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA. |
|
22 |
* |
|
23 |
* For more information, contact: |
|
24 |
* |
|
25 |
* Generalitat Valenciana |
|
26 |
* Conselleria d'Infraestructures i Transport |
|
27 |
* Av. Blasco Ib??ez, 50 |
|
28 |
* 46010 VALENCIA |
|
29 |
* SPAIN |
|
30 |
* |
|
31 |
* +34 963862235 |
|
32 |
* gvsig@gva.es |
|
33 |
* www.gvsig.gva.es |
|
34 |
* |
|
35 |
* or |
|
36 |
* |
|
37 |
* IVER T.I. S.A |
|
38 |
* Salamanca 50 |
|
39 |
* 46005 Valencia |
|
40 |
* Spain |
|
41 |
* |
|
42 |
* +34 963163400 |
|
43 |
* dac@iver.es |
|
44 |
*/ |
|
45 |
|
|
46 |
/** |
|
47 |
* This class has specific code for "WFSFilterPanel" extracted from "FiltroExension" that should be used by "WFSFilterPanel" but that has a conflict in the "DriverException" class |
|
48 |
* (because there are 2 classes with the same name "DriverException" but with different code: one in "libFMap" and another in "libGDBMS"). |
|
49 |
* |
|
50 |
* @author Pablo Piqueras Bartolom? (p_queras@hotmail.com) |
|
51 |
*/ |
|
52 |
public class DataLoadingFromActiveView { |
|
53 |
/** |
|
54 |
* Gets the default expression data source of the active window (view or table). |
|
55 |
* |
|
56 |
* @return data of the active view or <code>null</code> |
|
57 |
*/ |
|
58 |
public static DefaultExpression getDefaultExpressionDataSource() { |
|
59 |
DefaultExpression ds = null; |
|
60 |
// IWindow window = PluginServices.getMDIManager().getActiveWindow(); |
|
61 |
// |
|
62 |
// try { |
|
63 |
// if ((window == null) || (!(window instanceof BaseView))) { |
|
64 |
// return null; |
|
65 |
// } |
|
66 |
// else { |
|
67 |
// // Tries to access to the ActivedWindow and get the data from its selected layer |
|
68 |
// SelectableDataSource dataSource = null; |
|
69 |
// |
|
70 |
// if (window instanceof Table) { |
|
71 |
// Table vista = (Table) window; |
|
72 |
// |
|
73 |
// dataSource = (SelectableDataSource)vista.getModel().getModelo().getRecordset(); |
|
74 |
// } else if (window instanceof BaseView) { |
|
75 |
// IProjectView pv = ((BaseView) window).getModel(); |
|
76 |
// FLayer layer = pv.getMapContext().getLayers().getActives()[0]; |
|
77 |
// |
|
78 |
// if (layer == null) |
|
79 |
// return null; |
|
80 |
// |
|
81 |
// dataSource = pv.getProject().getDataSourceByLayer(layer); |
|
82 |
// } |
|
83 |
// |
|
84 |
// // Load values for return them |
|
85 |
// ds = new DefaultExpressionDataSource(); |
|
86 |
// ds.setTable(dataSource); |
|
87 |
// |
|
88 |
// } |
|
89 |
// } catch (ReadDriverException de) { |
|
90 |
// NotificationManager.addError(PluginServices.getText(null, "error_filtering"), de); |
|
91 |
// return null; |
|
92 |
// } |
|
93 |
|
|
94 |
return ds; |
|
95 |
} |
|
96 |
} |
branches/v2_0_0_prep/extensions/extWFS2/src/org/gvsig/wfs/gui/panels/LayerTable.java | ||
---|---|---|
1 |
package org.gvsig.wfs.gui.panels; |
|
2 |
|
|
3 |
import java.util.Vector; |
|
4 |
|
|
5 |
import javax.swing.JTable; |
|
6 |
import javax.swing.table.AbstractTableModel; |
|
7 |
|
|
8 |
import org.gvsig.andami.PluginServices; |
|
9 |
import org.gvsig.wfs.gui.panels.model.WFSSelectedFeature; |
|
10 |
import org.gvsig.wfs.gui.panels.model.WFSUtils; |
|
11 |
|
|
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: LayerTable.java 8847 2006-11-17 11:29:00Z ppiqueras $ |
|
56 |
* $Log$ |
|
57 |
* Revision 1.4.2.3 2006-11-17 11:28:45 ppiqueras |
|
58 |
* Corregidos bugs y aƱadida nueva funcionalidad. |
|
59 |
* |
|
60 |
* Revision 1.6 2006/10/02 09:09:45 jorpiell |
|
61 |
* Cambios del 10 copiados al head |
|
62 |
* |
|
63 |
* Revision 1.4.2.1 2006/09/19 12:28:11 jorpiell |
|
64 |
* Ya no se depende de geotools |
|
65 |
* |
|
66 |
* Revision 1.5 2006/09/18 12:07:31 jorpiell |
|
67 |
* Se ha sustituido geotools por el driver de remoteservices |
|
68 |
* |
|
69 |
* Revision 1.4 2006/07/24 07:30:33 jorpiell |
|
70 |
* Se han eliminado las partes duplicadas y se est? usando el parser de GML de FMAP. |
|
71 |
* |
|
72 |
* Revision 1.3 2006/06/21 12:35:45 jorpiell |
|
73 |
* Se ha a?adido la ventana de propiedades. Esto implica a?adir listeners por todos los paneles. Adem?s no se muestra la geomatr?a en la lista de atributos y se muestran ?nicamnete los que se van a descargar |
|
74 |
* |
|
75 |
* Revision 1.2 2006/05/25 16:01:43 jorpiell |
|
76 |
* Se ha a?adido la funcionalidad para eliminar el namespace de los tipos de atributos |
|
77 |
* |
|
78 |
* Revision 1.1 2006/05/25 10:29:50 jorpiell |
|
79 |
* A?adida la clase |
|
80 |
* |
|
81 |
* |
|
82 |
*/ |
|
83 |
/** |
|
84 |
* @author Jorge Piera Llodr? (piera_jor@gva.es) |
|
85 |
*/ |
|
86 |
public class LayerTable extends JTable{ |
|
87 |
public LayerTable() { |
|
88 |
super(); |
|
89 |
setModel(new LayerTableModel()); |
|
90 |
} |
|
91 |
|
|
92 |
/** |
|
93 |
* Gets the selected layer |
|
94 |
* @return |
|
95 |
*/ |
|
96 |
public WFSSelectedFeature getSelectedValue(){ |
|
97 |
int selectedRow = getSelectedRow(); |
|
98 |
LayerTableModel model = (LayerTableModel)getModel(); |
|
99 |
return model.getLayerAt(selectedRow); |
|
100 |
} |
|
101 |
|
|
102 |
public WFSSelectedFeature getValueAt(int position){ |
|
103 |
if (position<this.getRowCount()){ |
|
104 |
LayerTableModel model = (LayerTableModel)getModel(); |
|
105 |
return model.getLayerAt(position); |
|
106 |
} |
|
107 |
return null; |
|
108 |
} |
|
109 |
|
|
110 |
/** |
|
111 |
* Adds a vector of features |
|
112 |
* @param features |
|
113 |
*/ |
|
114 |
public void addFeatures(Object[] features){ |
|
115 |
LayerTableModel model = (LayerTableModel)getModel(); |
|
116 |
model.deleteAllRows(); |
|
117 |
for (int i=0 ; i<features.length ; i++){ |
|
118 |
model.addRow((WFSSelectedFeature)features[i]); |
|
119 |
} |
|
120 |
} |
|
121 |
|
|
122 |
/** |
|
123 |
* @param showLayerNames The showLayerNames to set. |
|
124 |
*/ |
|
125 |
public void setShowLayerNames(boolean showLayerNames) { |
|
126 |
LayerTableModel model = (LayerTableModel)getModel(); |
|
127 |
model.setShowLayerNames(showLayerNames); |
|
128 |
} |
|
129 |
|
|
130 |
/** |
|
131 |
* Table model |
|
132 |
* @author Jorge Piera Llodr? (piera_jor@gva.es) |
|
133 |
* |
|
134 |
*/ |
|
135 |
public class LayerTableModel extends AbstractTableModel{ |
|
136 |
private Vector layers = new Vector(); |
|
137 |
private boolean showLayerNames = false; |
|
138 |
|
|
139 |
/** |
|
140 |
Constructs an investment table model. |
|
141 |
*/ |
|
142 |
public LayerTableModel(){ |
|
143 |
super(); |
|
144 |
} |
|
145 |
|
|
146 |
/* |
|
147 |
* (non-Javadoc) |
|
148 |
* @see javax.swing.table.TableModel#getRowCount() |
|
149 |
*/ |
|
150 |
public int getRowCount(){ |
|
151 |
return layers.size(); |
|
152 |
} |
|
153 |
|
|
154 |
/* |
|
155 |
* (non-Javadoc) |
|
156 |
* @see javax.swing.table.TableModel#getColumnCount() |
|
157 |
*/ |
|
158 |
public int getColumnCount(){ |
|
159 |
return 2; |
|
160 |
} |
|
161 |
|
|
162 |
/* |
|
163 |
* (non-Javadoc) |
|
164 |
* @see javax.swing.table.TableModel#getValueAt(int, int) |
|
165 |
*/ |
|
166 |
public Object getValueAt(int rowNumber, int columnNumber){ |
|
167 |
if (rowNumber < layers.size()){ |
|
168 |
WFSSelectedFeature layer = (WFSSelectedFeature)layers.get(rowNumber); |
|
169 |
if (columnNumber == 0){ |
|
170 |
return getLayerName(layer); |
|
171 |
}else{ |
|
172 |
return PluginServices.getText(this,WFSUtils.getGeometry(layer)); |
|
173 |
} |
|
174 |
}else{ |
|
175 |
return ""; |
|
176 |
} |
|
177 |
} |
|
178 |
|
|
179 |
/** |
|
180 |
* Returns the layer name (depending of the "show layer names" |
|
181 |
* check cob is clicked) |
|
182 |
* @param layer |
|
183 |
* @return |
|
184 |
*/ |
|
185 |
private String getLayerName(WFSSelectedFeature layer){ |
|
186 |
if (showLayerNames){ |
|
187 |
return "[" + layer.getName() + "] " + layer.getTitle(); |
|
188 |
} else { |
|
189 |
return layer.getTitle(); |
|
190 |
} |
|
191 |
} |
|
192 |
|
|
193 |
/** |
|
194 |
* Return the layer at the specified position |
|
195 |
* @param rowNumber |
|
196 |
* Row position |
|
197 |
* @return |
|
198 |
*/ |
|
199 |
public WFSSelectedFeature getLayerAt(int rowNumber){ |
|
200 |
try{ |
|
201 |
return (WFSSelectedFeature)layers.get(rowNumber); |
|
202 |
}catch (ArrayIndexOutOfBoundsException e){ |
|
203 |
return null; |
|
204 |
} |
|
205 |
} |
|
206 |
|
|
207 |
/** |
|
208 |
* It adds a new |
|
209 |
* @param values |
|
210 |
* Array of column values |
|
211 |
*/ |
|
212 |
public void addRow(WFSSelectedFeature layer){ |
|
213 |
layers.add(layer); |
|
214 |
fireTableRowsInserted(getRowCount(),getRowCount()); |
|
215 |
fireTableRowsUpdated(0,getRowCount()); |
|
216 |
} |
|
217 |
|
|
218 |
/** |
|
219 |
* Delete all the table rows |
|
220 |
*/ |
|
221 |
public void deleteAllRows(){ |
|
222 |
layers.clear(); |
|
223 |
int rows = getRowCount(); |
|
224 |
if (rows >= 1){ |
|
225 |
fireTableRowsDeleted(0, rows - 1); |
|
226 |
} |
|
227 |
} |
|
228 |
|
|
229 |
/** |
|
230 |
* Delete all the table rows |
|
231 |
*/ |
|
232 |
public void deleteRow(int rowPosition){ |
|
233 |
layers.remove(rowPosition); |
|
234 |
fireTableRowsDeleted(rowPosition, rowPosition); |
|
235 |
fireTableRowsUpdated(0,getRowCount()); |
|
236 |
} |
|
237 |
|
|
238 |
|
|
239 |
|
|
240 |
/* |
|
241 |
* (non-Javadoc) |
|
242 |
* @see javax.swing.table.TableModel#getColumnName(int) |
|
243 |
*/ |
|
244 |
public String getColumnName(int columnIndex){ |
|
245 |
if (columnIndex == 0){ |
|
246 |
return PluginServices.getText(this,"layerName"); |
|
247 |
}else{ |
|
248 |
return PluginServices.getText(this,"layerType"); |
|
249 |
} |
|
250 |
} |
|
251 |
|
|
252 |
/** |
|
253 |
* @return Returns the showLayerNames. |
|
254 |
*/ |
|
255 |
public boolean isShowLayerNames() { |
|
256 |
return showLayerNames; |
|
257 |
} |
|
258 |
|
|
259 |
/** |
|
260 |
* @param showLayerNames The showLayerNames to set. |
|
261 |
*/ |
|
262 |
public void setShowLayerNames(boolean showLayerNames) { |
|
263 |
this.showLayerNames = showLayerNames; |
|
264 |
} |
|
265 |
} |
|
266 |
} |
branches/v2_0_0_prep/extensions/extWFS2/src/org/gvsig/wfs/gui/panels/WFSFormatPanel.java | ||
---|---|---|
1 |
package org.gvsig.wfs.gui.panels; |
|
2 |
|
|
3 |
import java.util.ArrayList; |
|
4 |
import java.util.Collection; |
|
5 |
import java.util.TreeSet; |
|
6 |
import java.util.Vector; |
|
7 |
|
|
8 |
import javax.swing.AbstractListModel; |
|
9 |
import javax.swing.JList; |
|
10 |
import javax.swing.JPanel; |
|
11 |
import javax.swing.JScrollPane; |
|
12 |
|
|
13 |
import org.gvsig.andami.PluginServices; |
|
14 |
import org.gvsig.wfs.gui.panels.model.WFSSelectedFeature; |
|
15 |
|
|
16 |
|
|
17 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana |
|
18 |
* |
|
19 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana. |
|
20 |
* |
|
21 |
* This program is free software; you can redistribute it and/or |
|
22 |
* modify it under the terms of the GNU General Public License |
|
23 |
* as published by the Free Software Foundation; either version 2 |
|
24 |
* of the License, or (at your option) any later version. |
|
25 |
* |
|
26 |
* This program is distributed in the hope that it will be useful, |
|
27 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
28 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
29 |
* GNU General Public License for more details. |
|
30 |
* |
|
31 |
* You should have received a copy of the GNU General Public License |
|
32 |
* along with this program; if not, write to the Free Software |
|
33 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA. |
|
34 |
* |
|
35 |
* For more information, contact: |
|
36 |
* |
|
37 |
* Generalitat Valenciana |
|
38 |
* Conselleria d'Infraestructures i Transport |
|
39 |
* Av. Blasco Ib??ez, 50 |
|
40 |
* 46010 VALENCIA |
|
41 |
* SPAIN |
|
42 |
* |
|
43 |
* +34 963862235 |
|
44 |
* gvsig@gva.es |
|
45 |
* www.gvsig.gva.es |
|
46 |
* |
|
47 |
* or |
|
48 |
* |
|
49 |
* IVER T.I. S.A |
|
50 |
* Salamanca 50 |
|
51 |
* 46005 Valencia |
|
52 |
* Spain |
|
53 |
* |
|
54 |
* +34 963163400 |
|
55 |
* dac@iver.es |
|
56 |
*/ |
|
57 |
/* CVS MESSAGES: |
|
58 |
* |
|
59 |
* $Id: WFSFormatPanel.java 5856 2006-06-15 07:50:58Z jorpiell $ |
|
60 |
* $Log$ |
|
61 |
* Revision 1.1 2006-06-15 07:50:58 jorpiell |
|
62 |
* A?adida la funcionalidad de reproyectar y hechos algunos cambios en la interfaz |
|
63 |
* |
|
64 |
* |
|
65 |
*/ |
|
66 |
/** |
|
67 |
* @author Jorge Piera Llodr? (piera_jor@gva.es) |
|
68 |
*/ |
|
69 |
public class WFSFormatPanel extends JPanel { |
|
70 |
private JPanel srsPanel = null; |
|
71 |
private JScrollPane jScrollPane2 = null; |
|
72 |
private JList lstSRSs = null; |
|
73 |
|
|
74 |
/** |
|
75 |
* This method initializes |
|
76 |
* |
|
77 |
*/ |
|
78 |
public WFSFormatPanel() { |
|
79 |
super(); |
|
80 |
initialize(); |
|
81 |
} |
|
82 |
|
|
83 |
/** |
|
84 |
* This method initializes this |
|
85 |
* |
|
86 |
*/ |
|
87 |
private void initialize() { |
|
88 |
this.setLayout(null); |
|
89 |
this.setBounds(10, 5, 481, 427); |
|
90 |
this.add(getSrsPanel(), null); |
|
91 |
|
|
92 |
} |
|
93 |
|
|
94 |
/** |
|
95 |
* This method initializes srsPanel |
|
96 |
* |
|
97 |
* @return javax.swing.JPanel |
|
98 |
*/ |
|
99 |
private JPanel getSrsPanel() { |
|
100 |
if (srsPanel == null) { |
|
101 |
srsPanel = new JPanel(); |
|
102 |
srsPanel.setLayout(null); |
|
103 |
srsPanel.setBorder(javax.swing.BorderFactory.createTitledBorder( |
|
104 |
null, PluginServices.getText(this, "seleccionar_srs"), |
|
105 |
javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, |
|
106 |
javax.swing.border.TitledBorder.DEFAULT_POSITION, null, null)); |
|
107 |
srsPanel.setBounds(7, 10, 453, 168); |
|
108 |
srsPanel.add(getJScrollPane2(), null); |
|
109 |
} |
|
110 |
return srsPanel; |
|
111 |
} |
|
112 |
|
|
113 |
/** |
|
114 |
* This method initializes jScrollPane2 |
|
115 |
* |
|
116 |
* @return javax.swing.JScrollPane |
|
117 |
*/ |
|
118 |
private javax.swing.JScrollPane getJScrollPane2() { |
|
119 |
if (jScrollPane2 == null) { |
|
120 |
jScrollPane2 = new javax.swing.JScrollPane(); |
|
121 |
jScrollPane2.setBounds(5, 23, 442, 141); |
|
122 |
jScrollPane2.setViewportView(getLstSRSs()); |
|
123 |
jScrollPane2.setPreferredSize(new java.awt.Dimension(100, 200)); |
|
124 |
} |
|
125 |
|
|
126 |
return jScrollPane2; |
|
127 |
} |
|
128 |
|
|
129 |
/** |
|
130 |
* This method initializes lstSRSs |
|
131 |
* |
|
132 |
* @return javax.swing.JList |
|
133 |
*/ |
|
134 |
public javax.swing.JList getLstSRSs() { |
|
135 |
if (lstSRSs == null) { |
|
136 |
lstSRSs = new javax.swing.JList(); |
|
137 |
lstSRSs.setModel(new SRSListModel()); |
|
138 |
lstSRSs.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION); |
|
139 |
lstSRSs.addListSelectionListener(new javax.swing.event.ListSelectionListener() { |
|
140 |
public void valueChanged( |
|
141 |
javax.swing.event.ListSelectionEvent e) { |
|
142 |
int i = lstSRSs.getSelectedIndex(); |
|
143 |
} |
|
144 |
}); |
|
145 |
} |
|
146 |
|
|
147 |
return lstSRSs; |
|
148 |
} |
|
149 |
|
|
150 |
/** |
|
151 |
* Refresh the panel |
|
152 |
* @param feature |
|
153 |
*/ |
|
154 |
public void refresh(WFSSelectedFeature feature) { |
|
155 |
setFormats(feature); |
|
156 |
} |
|
157 |
|
|
158 |
/** |
|
159 |
* Sets a SRS list |
|
160 |
* @param feature |
|
161 |
*/ |
|
162 |
private void setFormats(WFSSelectedFeature feature){ |
|
163 |
getLstSRSs().setListData(new Object[0]); |
|
164 |
Vector srs = feature.getSrs(); |
|
165 |
getLstSRSs().setListData(srs.toArray()); |
|
166 |
} |
|
167 |
|
|
168 |
public class SRSListModel extends AbstractListModel { |
|
169 |
private static final long serialVersionUID = -6134561791965083588L; |
|
170 |
ArrayList srs = new ArrayList(); |
|
171 |
|
|
172 |
public int getSize() { |
|
173 |
return srs.size(); |
|
174 |
} |
|
175 |
|
|
176 |
public Object getElementAt(int index) { |
|
177 |
return srs.get(index); |
|
178 |
} |
|
179 |
|
|
180 |
public void setAll(Collection c) { |
|
181 |
|
|
182 |
srs.clear(); |
|
183 |
srs.addAll(c); |
|
184 |
} |
|
185 |
|
|
186 |
public Collection intersect(Collection c) { |
|
187 |
TreeSet resul = new TreeSet(); |
|
188 |
for (int i = 0; i < srs.size(); i++) { |
|
189 |
if (c.contains(srs.get(i))) |
|
190 |
resul.add(srs.get(i)); |
|
191 |
} |
|
192 |
return resul; |
|
193 |
} |
|
194 |
} |
|
195 |
} |
Also available in: Unified diff