Revision 8273 trunk/extensions/extWFS2/src/com/iver/cit/gvsig/gui/panels/WFSSelectAttributesPanel.java
WFSSelectAttributesPanel.java | ||
---|---|---|
1 | 1 |
package com.iver.cit.gvsig.gui.panels; |
2 | 2 |
|
3 |
import java.awt.Component; |
|
3 | 4 |
import java.util.ArrayList; |
4 | 5 |
import java.util.Vector; |
5 | 6 |
|
... | ... | |
9 | 10 |
import javax.swing.JScrollPane; |
10 | 11 |
|
11 | 12 |
import org.gvsig.gui.beans.swing.JButton; |
13 |
import org.gvsig.gui.beans.swing.treeTable.TreeTable; |
|
12 | 14 |
import org.gvsig.remoteClient.gml.schemas.GMLGeometryType; |
13 | 15 |
import org.gvsig.remoteClient.gml.schemas.IXMLType; |
14 | 16 |
import org.gvsig.remoteClient.gml.schemas.XMLElement; |
... | ... | |
60 | 62 |
* |
61 | 63 |
* $Id$ |
62 | 64 |
* $Log$ |
63 |
* Revision 1.10 2006-10-10 12:55:06 jorpiell |
|
65 |
* Revision 1.11 2006-10-24 07:27:56 jorpiell |
|
66 |
* Algunos cambios en el modelo que usa la tabla |
|
67 |
* |
|
68 |
* Revision 1.10 2006/10/10 12:55:06 jorpiell |
|
64 | 69 |
* Se ha a?adido el soporte de features complejas |
65 | 70 |
* |
66 | 71 |
* Revision 1.9 2006/10/02 09:09:45 jorpiell |
... | ... | |
114 | 119 |
private JButton delButton = null; |
115 | 120 |
private JScrollPane jScrollPane3 = null; |
116 | 121 |
private JScrollPane jScrollPane4 = null; |
117 |
private AttributesTable attributesList = null;
|
|
122 |
private AttributesTreeTable attributesTreeTable = null;
|
|
118 | 123 |
private JList selectedAttributesList = null; |
119 | 124 |
private JButton addAllButton = null; |
120 | 125 |
private JButton delAllButton = null; |
... | ... | |
259 | 264 |
* |
260 | 265 |
* @return javax.swing.JList |
261 | 266 |
*/ |
262 |
public AttributesTable getAttributesList() { |
|
263 |
if (attributesList == null) { |
|
264 |
attributesList = new AttributesTable(); |
|
267 |
public AttributesTreeTable getAttributesList() { |
|
268 |
if (attributesTreeTable == null) { |
|
269 |
attributesTreeTable = new AttributesTreeTable(new AttributesTreeTableModel(true)); |
|
270 |
attributesTreeTable.deleteIcons(); |
|
271 |
attributesTreeTable.setRootVisible(false); |
|
265 | 272 |
} |
266 |
return attributesList;
|
|
273 |
return attributesTreeTable;
|
|
267 | 274 |
} |
268 | 275 |
|
269 | 276 |
/** |
... | ... | |
294 | 301 |
private void setFields(WFSLayerNode feature){ |
295 | 302 |
getSelectedAttributesList().setListData(new Object[0]); |
296 | 303 |
Vector fields = feature.getFields(); |
297 |
getAttributesList().addAttributes(fields.toArray());
|
|
304 |
getAttributesList().setAttributes(fields);
|
|
298 | 305 |
for (int i=0 ; i<fields.size() ;i++){ |
299 | 306 |
XMLElement field = (XMLElement)fields.get(i); |
300 | 307 |
IXMLType type = field.getEntityType(); |
... | ... | |
305 | 312 |
feature.setGeometry((GMLGeometryType)type); |
306 | 313 |
} |
307 | 314 |
} |
308 |
|
|
309 | 315 |
} |
310 |
|
|
316 |
|
|
311 | 317 |
public void setSelectedFields(WFSLayerNode feature){ |
312 |
Vector selectedFields = feature.getSelectedFields(); |
|
313 |
Vector addedFields = new Vector(); |
|
314 |
Object[] selectableAttributes = getAttributesList().getAllValues(); |
|
315 |
for (int i=0 ; i<selectedFields.size() ; i++){ |
|
316 |
XMLElement selectedAttribute = (XMLElement)selectedFields.get(i); |
|
317 |
for (int j=0; j < selectableAttributes.length; j++) { |
|
318 |
XMLElement attribute = (XMLElement)selectableAttributes[j]; |
|
319 |
if (attribute.getName().equals(selectedAttribute.getName())){ |
|
320 |
addedFields.add(attribute); |
|
321 |
} |
|
322 |
} |
|
323 |
} |
|
324 |
getSelectedAttributesList().setListData(addedFields.toArray()); |
|
318 |
// Vector selectedFields = feature.getSelectedFields();
|
|
319 |
// Vector addedFields = new Vector();
|
|
320 |
// Object[] selectableAttributes = getAttributesList().getAllValues();
|
|
321 |
// for (int i=0 ; i<selectedFields.size() ; i++){
|
|
322 |
// XMLElement selectedAttribute = (XMLElement)selectedFields.get(i);
|
|
323 |
// for (int j=0; j < selectableAttributes.length; j++) {
|
|
324 |
// XMLElement attribute = (XMLElement)selectableAttributes[j];
|
|
325 |
// if (attribute.getName().equals(selectedAttribute.getName())){
|
|
326 |
// addedFields.add(attribute);
|
|
327 |
// }
|
|
328 |
// }
|
|
329 |
// }
|
|
330 |
// getSelectedAttributesList().setListData(addedFields.toArray());
|
|
325 | 331 |
} |
326 | 332 |
|
327 | 333 |
/** |
... | ... | |
335 | 341 |
times.add(getSelectedAttributesList().getModel() |
336 | 342 |
.getElementAt(i)); |
337 | 343 |
} |
338 |
|
|
339 |
Object[] obj = getAttributesList().getSelectedValues(); |
|
344 |
Object[] obj = getAttributesList().getSelectedValues(); |
|
340 | 345 |
for (int i = 0; i < obj.length; i++) { |
341 |
if (!times.contains(obj[i])) |
|
342 |
times.add(obj[i]); |
|
346 |
if (getAttributesList().isQueryable(obj[i])){ |
|
347 |
if (!times.contains(obj[i])){ |
|
348 |
times.add(obj[i]); |
|
349 |
} |
|
350 |
} |
|
343 | 351 |
} |
344 | 352 |
getSelectedAttributesList() |
345 | 353 |
.setListData(times.toArray()); |
Also available in: Unified diff