Revision 8273

View differences:

trunk/extensions/extWFS2/src-test/com/iver/cit/gvsig/gui/panels/AttributesTableTest.java
6 6
import java.util.Vector;
7 7

  
8 8
import javax.swing.JFrame;
9
import javax.swing.JScrollPane;
10
import javax.swing.JTree;
11
import javax.swing.table.JTableHeader;
12
import javax.swing.tree.DefaultTreeCellRenderer;
13
import javax.swing.tree.TreeCellRenderer;
9 14

  
10 15
import org.gvsig.gui.beans.swing.treeTable.TreeTable;
16
import org.gvsig.gui.beans.swing.treeTable.TreeTableCellRenderer;
17
import org.gvsig.gui.beans.swing.treeTable.TreeTableModelAdapter;
11 18
import org.gvsig.remoteClient.gml.factories.XMLElementsFactory;
12 19
import org.gvsig.remoteClient.gml.schemas.IXMLType;
13 20
import org.gvsig.remoteClient.gml.schemas.XMLComplexType;
......
58 65
 *
59 66
 * $Id$
60 67
 * $Log$
61
 * Revision 1.1  2006-10-23 07:37:04  jorpiell
68
 * Revision 1.2  2006-10-24 07:27:56  jorpiell
69
 * Algunos cambios en el modelo que usa la tabla
70
 *
71
 * Revision 1.1  2006/10/23 07:37:04  jorpiell
62 72
 * Ya funciona el filterEncoding
63 73
 *
64 74
 *
......
80 90
		for (int i=0 ; i<att.size() ; i++){
81 91
			objs[i] = att.get(i);
82 92
		}
83
		TreeTable treetable = new TreeTable(new AttributesTableModel(objs));
84
		createFrame(treetable);
93
		TreeTable treetable = new TreeTable(new AttributesTreeTableModel(false));
94
		treetable.deleteIcons();
95
		treetable.setRootVisible(false);
96
				
97
		AttributesTreeTableModel model = new AttributesTreeTableModel(objs,true);
98
		treetable.setModel(model);
99
		treetable.deleteIcons();
100
		treetable.setRootVisible(false);
101
				
102
		JScrollPane scrollPane = new JScrollPane(); 
103
		scrollPane.setViewportView(treetable); 
104
				
105
		createFrame(scrollPane);
85 106
	}
86 107
	
87
	private void createFrame(TreeTable tree){
108
	private void createFrame(JScrollPane scrollPane){
88 109
		JFrame f = new JFrame();
89 110
		f.addWindowListener(this);
90
		f.getContentPane().add(tree);	    
111
		f.getContentPane().add(scrollPane);	    
91 112
		f.setBounds(0,0,600,500);
92 113
		f.setVisible(true);
93 114
	}
trunk/extensions/extWFS2/src/com/iver/cit/gvsig/fmap/drivers/wfs/filters/SQLExpressionFormat.java
56 56
 *
57 57
 * $Id$
58 58
 * $Log$
59
 * Revision 1.3  2006-10-23 07:37:04  jorpiell
59
 * Revision 1.4  2006-10-24 07:27:56  jorpiell
60
 * Algunos cambios en el modelo que usa la tabla
61
 *
62
 * Revision 1.3  2006/10/23 07:37:04  jorpiell
60 63
 * Ya funciona el filterEncoding
61 64
 *
62 65
 * Revision 1.2  2006/10/10 12:55:06  jorpiell
......
77 80
	 * @see org.gvsig.remoteClient.wfs.filters.ISQLExpressionFormat#format(java.lang.String)
78 81
	 */
79 82
	public String format(String query) {
80
		if (query == null){
83
		if ((query == null) || (query.equals(""))){
81 84
			return null;
82 85
		}
83 86
		InputStream is = new ByteArrayInputStream(query.getBytes());
trunk/extensions/extWFS2/src/com/iver/cit/gvsig/gui/panels/AttributesTableModel.java
1
package com.iver.cit.gvsig.gui.panels;
2

  
3
import java.io.File;
4
import java.util.Vector;
5

  
6
import org.gvsig.gui.beans.swing.treeTable.AbstractTreeTableModel;
7
import org.gvsig.gui.beans.swing.treeTable.MergeSort;
8
import org.gvsig.gui.beans.swing.treeTable.TreeTableModel;
9
import org.gvsig.remoteClient.gml.schemas.IXMLType;
10
import org.gvsig.remoteClient.gml.schemas.XMLComplexType;
11
import org.gvsig.remoteClient.gml.schemas.XMLElement;
12

  
13
import com.iver.andami.PluginServices;
14
import com.sun.rsasign.v;
15

  
16
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
17
 *
18
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
19
 *
20
 * This program is free software; you can redistribute it and/or
21
 * modify it under the terms of the GNU General Public License
22
 * as published by the Free Software Foundation; either version 2
23
 * of the License, or (at your option) any later version.
24
 *
25
 * This program is distributed in the hope that it will be useful,
26
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
27
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
28
 * GNU General Public License for more details.
29
 *
30
 * You should have received a copy of the GNU General Public License
31
 * along with this program; if not, write to the Free Software
32
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
33
 *
34
 * For more information, contact:
35
 *
36
 *  Generalitat Valenciana
37
 *   Conselleria d'Infraestructures i Transport
38
 *   Av. Blasco Ib??ez, 50
39
 *   46010 VALENCIA
40
 *   SPAIN
41
 *
42
 *      +34 963862235
43
 *   gvsig@gva.es
44
 *      www.gvsig.gva.es
45
 *
46
 *    or
47
 *
48
 *   IVER T.I. S.A
49
 *   Salamanca 50
50
 *   46005 Valencia
51
 *   Spain
52
 *
53
 *   +34 963163400
54
 *   dac@iver.es
55
 */
56
/* CVS MESSAGES:
57
 *
58
 * $Id$
59
 * $Log$
60
 * Revision 1.2  2006-10-23 08:17:18  jorpiell
61
 * Algunos cambios realizados para tener un ?rbol com m?s de una ra?z
62
 *
63
 * Revision 1.1  2006/10/23 07:37:04  jorpiell
64
 * Ya funciona el filterEncoding
65
 *
66
 *
67
 */
68
/**
69
 * @author Jorge Piera Llodr? (piera_jor@gva.es)
70
 */
71
public class AttributesTableModel extends AbstractTreeTableModel implements TreeTableModel {
72
	// Names of the columns.
73
	private String[]  cNames = {PluginServices.getText(this,"attributeName"), 
74
			PluginServices.getText(this,"attributeType")};
75
	
76
	// Types of the columns.
77
	private Class[]  cTypes = {TreeTableModel.class, String.class};
78
	private Object[] attributes = null;
79
	
80
	public AttributesTableModel(Object[] attributes) { 
81
		super(attributes); 
82
		this.attributes = attributes;
83
	}	
84

  
85
	protected Object[] getChildren(Object node) {
86
		XMLElement element = (XMLElement)node;			
87
		if (element.getEntityType().getType() == IXMLType.COMPLEX){
88
			Vector vector = ((XMLComplexType)element.getEntityType()).getAttributes();
89
			Object[] objs = new Object[vector.size()];
90
			for (int i=0 ; i<vector.size() ; i++){
91
				objs[i] = vector.get(i);
92
			}
93
		}
94
		return null;	
95
	}
96
	
97
	//
98
	// The TreeModel interface
99
	//
100
	
101
	public int getChildCount(Object node) { 
102
		if (node instanceof AbstractTreeTableModel.Root){
103
			return ((AbstractTreeTableModel.Root)node).getChildCount();
104
		}
105
		XMLElement element = (XMLElement)node;			
106
		if (element.getEntityType().getType() == IXMLType.COMPLEX){
107
			return ((XMLComplexType)element.getEntityType()).getAttributes().size();
108
		}else{
109
			return 0;
110
		}
111
	}
112
	
113
	public Object getChild(Object node, int i) { 
114
		if (node instanceof AbstractTreeTableModel.Root){
115
			return ((AbstractTreeTableModel.Root)node).getChildren()[i];
116
		}
117
		XMLElement element = (XMLElement)node;			
118
		if (element.getEntityType().getType() == IXMLType.COMPLEX){
119
			Vector vector = ((XMLComplexType)element.getEntityType()).getAttributes();
120
			return vector.get(i);
121
		}
122
		return null;
123
	}
124
	
125
	// The superclass's implementation would work, but this is more efficient. 
126
	public boolean isLeaf(Object node) { 
127
		if (node instanceof AbstractTreeTableModel.Root){
128
			return false;
129
		}
130
		XMLElement element = (XMLElement)node;			
131
		if (element.getEntityType().getType() == IXMLType.COMPLEX){
132
			return false;
133
		}
134
		return true;
135
	}
136
	
137
	//
138
	//  The TreeTableNode interface. 
139
	//
140
	
141
	public int getColumnCount() {
142
		return cNames.length;
143
	}
144
	
145
	public String getColumnName(int column) {
146
		return cNames[column];
147
	}
148
	
149
	public Class getColumnClass(int column) {
150
		return cTypes[column];
151
	}
152
	
153
	public Object getValueAt(Object node, int column) {
154
		if (node instanceof AbstractTreeTableModel.Root){
155
			return "";
156
		}
157
		XMLElement element = (XMLElement)node;	
158
		try {
159
			switch(column) {
160
			case 0:
161
				return element.getName();
162
			case 1:
163
				return element.getEntityType().getName();
164
			}
165
		}
166
		catch  (SecurityException se) { }
167
		
168
		return null; 
169
	}
170
}
171

  
172

  
trunk/extensions/extWFS2/src/com/iver/cit/gvsig/gui/panels/AttributesTreeTable.java
1
package com.iver.cit.gvsig.gui.panels;
2

  
3
import java.util.Vector;
4

  
5
import org.gvsig.gui.beans.swing.treeTable.TreeTable;
6
import org.gvsig.gui.beans.swing.treeTable.TreeTableModel;
7
import org.gvsig.gui.beans.swing.treeTable.TreeTableModelAdapter;
8

  
9
import com.iver.cit.gvsig.gui.panels.AttributesTable.AttributesTableModel;
10

  
11
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
12
 *
13
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
14
 *
15
 * This program is free software; you can redistribute it and/or
16
 * modify it under the terms of the GNU General Public License
17
 * as published by the Free Software Foundation; either version 2
18
 * of the License, or (at your option) any later version.
19
 *
20
 * This program is distributed in the hope that it will be useful,
21
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
23
 * GNU General Public License for more details.
24
 *
25
 * You should have received a copy of the GNU General Public License
26
 * along with this program; if not, write to the Free Software
27
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
28
 *
29
 * For more information, contact:
30
 *
31
 *  Generalitat Valenciana
32
 *   Conselleria d'Infraestructures i Transport
33
 *   Av. Blasco Ib??ez, 50
34
 *   46010 VALENCIA
35
 *   SPAIN
36
 *
37
 *      +34 963862235
38
 *   gvsig@gva.es
39
 *      www.gvsig.gva.es
40
 *
41
 *    or
42
 *
43
 *   IVER T.I. S.A
44
 *   Salamanca 50
45
 *   46005 Valencia
46
 *   Spain
47
 *
48
 *   +34 963163400
49
 *   dac@iver.es
50
 */
51
/* CVS MESSAGES:
52
 *
53
 * $Id$
54
 * $Log$
55
 * Revision 1.1  2006-10-24 07:27:56  jorpiell
56
 * Algunos cambios en el modelo que usa la tabla
57
 *
58
 *
59
 */
60
/**
61
 * @author Jorge Piera Llodr? (piera_jor@gva.es)
62
 */
63
public class AttributesTreeTable extends TreeTable{
64
	Object[] attributes = null;
65
	
66
	public AttributesTreeTable(TreeTableModel treeTableModel) {
67
		super(treeTableModel);		
68
	}
69
	
70
	/**
71
	 * Sets the attributes
72
	 * @param attributes
73
	 */
74
	public void setAttributes(Vector vAttributes){
75
		attributes = new Object[vAttributes.size()];
76
		for (int i=0 ; i<vAttributes.size() ; i++){
77
			attributes[i] = vAttributes.get(i);
78
		}
79
		setModel(new AttributesTreeTableModel(attributes,true));
80
		deleteIcons();
81
		setRootVisible(false);
82
	}
83
	
84
	/**
85
	 * Gets the selected layer
86
	 * @return
87
	 */
88
	public Object[] getSelectedValues(){
89
		int[] selectedRows = getSelectedRows();
90
		TreeTableModelAdapter obj = (TreeTableModelAdapter)getModel();
91
		Object[] objects = new Object[selectedRows.length];
92
		for (int i=0 ; i<selectedRows.length ; i++){
93
			objects[i] = obj.nodeForRow(selectedRows[i]);
94
		}
95
		return objects;
96
	}
97

  
98
	/**
99
	 * Return all the attributes
100
	 * @return
101
	 */
102
	public Object[] getAllValues() {
103
		return attributes;
104
	}
105
	
106
	/**
107
	 * Return true if the node is queryable
108
	 * @param node
109
	 * @return
110
	 */
111
	public boolean isQueryable(Object node){
112
		for (int i=0 ; i<attributes.length ; i++){
113
			if (node.equals(attributes[i])){
114
				return true;
115
			}
116
		}
117
		return false;
118
	}
119

  
120

  
121
}
0 122

  
trunk/extensions/extWFS2/src/com/iver/cit/gvsig/gui/panels/AttributesTreeTableModel.java
1
package com.iver.cit.gvsig.gui.panels;
2

  
3
import java.io.File;
4
import java.util.Vector;
5

  
6
import org.gvsig.gui.beans.swing.treeTable.AbstractTreeTableModel;
7
import org.gvsig.gui.beans.swing.treeTable.MergeSort;
8
import org.gvsig.gui.beans.swing.treeTable.TreeTableModel;
9
import org.gvsig.remoteClient.gml.schemas.IXMLType;
10
import org.gvsig.remoteClient.gml.schemas.XMLComplexType;
11
import org.gvsig.remoteClient.gml.schemas.XMLElement;
12

  
13
import com.iver.andami.PluginServices;
14
import com.iver.cit.gvsig.fmap.drivers.wfs.WFSUtils;
15
import com.sun.rsasign.v;
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$
60
 * $Log$
61
 * Revision 1.1  2006-10-24 07:27:56  jorpiell
62
 * Algunos cambios en el modelo que usa la tabla
63
 *
64
 * Revision 1.2  2006/10/23 08:17:18  jorpiell
65
 * Algunos cambios realizados para tener un ?rbol com m?s de una ra?z
66
 *
67
 * Revision 1.1  2006/10/23 07:37:04  jorpiell
68
 * Ya funciona el filterEncoding
69
 *
70
 *
71
 */
72
/**
73
 * @author Jorge Piera Llodr? (piera_jor@gva.es)
74
 */
75
public class AttributesTreeTableModel extends AbstractTreeTableModel {
76
	private String[]  cNames = null;
77
	private Class[]  cTypes = null;
78
	private Object[] attributes = null;
79
		
80
	public AttributesTreeTableModel(Object[] attributes,boolean isTypeShowed) { 
81
		super(attributes);
82
		setTypeShowed(isTypeShowed);
83
		this.attributes = attributes;
84
	}		
85
	
86
	public AttributesTreeTableModel(boolean isTypeShowed) { 
87
		super(null); 
88
		setTypeShowed(isTypeShowed);
89
		this.attributes = null;
90
	}
91
	
92
	public void setNodes(Object[] attributes){
93
		this.attributes = attributes;		
94
	}
95
	
96
	private void setTypeShowed(boolean isTypeShowed){
97
		if (isTypeShowed){
98
			cNames = new String[2];
99
			cNames[0] = PluginServices.getText(this,"attributeName");
100
			cNames[1] = PluginServices.getText(this,"attributeType");
101
			cTypes = new Class[2];
102
			cTypes[0] = TreeTableModel.class;
103
			cTypes[1] = String.class;
104
		}else{
105
			cNames = new String[1];
106
			cNames[0] = PluginServices.getText(this,"attributeName");
107
			cTypes = new Class[1];
108
			cTypes[0] = TreeTableModel.class;
109
		}
110
	}
111

  
112
	protected Object[] getChildren(Object node) {
113
		XMLElement element = (XMLElement)node;			
114
		if (element.getEntityType().getType() == IXMLType.COMPLEX){
115
			Vector vector = ((XMLComplexType)element.getEntityType()).getAttributes();
116
			Object[] objs = new Object[vector.size()];
117
			for (int i=0 ; i<vector.size() ; i++){
118
				objs[i] = vector.get(i);
119
			}
120
		}
121
		return null;	
122
	}
123
	
124
	//
125
	// The TreeModel interface
126
	//
127
	
128
	public int getChildCount(Object node) { 
129
		if (node instanceof AbstractTreeTableModel.Root){
130
			return ((AbstractTreeTableModel.Root)node).getChildCount();
131
		}
132
		XMLElement element = (XMLElement)node;			
133
		if (element.getEntityType().getType() == IXMLType.COMPLEX){
134
			return ((XMLComplexType)element.getEntityType()).getAttributes().size();
135
		}else{
136
			return 0;
137
		}
138
	}
139
	
140
	public Object getChild(Object node, int i) { 
141
		if (node instanceof AbstractTreeTableModel.Root){
142
			return ((AbstractTreeTableModel.Root)node).getChildren()[i];
143
		}
144
		XMLElement element = (XMLElement)node;			
145
		if (element.getEntityType().getType() == IXMLType.COMPLEX){
146
			Vector vector = ((XMLComplexType)element.getEntityType()).getAttributes();
147
			return vector.get(i);
148
		}
149
		return null;
150
	}
151
	
152
	// The superclass's implementation would work, but this is more efficient. 
153
	public boolean isLeaf(Object node) { 
154
		if (node instanceof AbstractTreeTableModel.Root){
155
			return false;
156
		}
157
		XMLElement element = (XMLElement)node;			
158
		if (element.getEntityType().getType() == IXMLType.COMPLEX){
159
			return false;
160
		}
161
		return true;
162
	}
163

  
164
	/*
165
	 *  (non-Javadoc)
166
	 * @see org.gvsig.gui.beans.swing.treeTable.TreeTableModel#getColumnCount()
167
	 */
168
	public int getColumnCount() {
169
		return cNames.length;
170
	}
171
	
172
	/*
173
	 *  (non-Javadoc)
174
	 * @see org.gvsig.gui.beans.swing.treeTable.TreeTableModel#getColumnName(int)
175
	 */
176
	public String getColumnName(int column) {
177
		return cNames[column];
178
	}
179
	
180
	/*
181
	 *  (non-Javadoc)
182
	 * @see org.gvsig.gui.beans.swing.treeTable.TreeTableModel#getColumnClass(int)
183
	 */
184
	public Class getColumnClass(int column) {
185
		return cTypes[column];
186
	}
187
	
188
	/*
189
	 *  (non-Javadoc)
190
	 * @see org.gvsig.gui.beans.swing.treeTable.TreeTableModel#getValueAt(java.lang.Object, int)
191
	 */
192
	public Object getValueAt(Object node, int column) {
193
		if (node instanceof AbstractTreeTableModel.Root){
194
			return "";
195
		}
196
		XMLElement element = (XMLElement)node;	
197
		try {
198
			switch(column) {
199
			case 0:
200
				return element.getName();
201
			case 1:
202
				return PluginServices.getText(this,WFSUtils.getAttributeType(element.getEntityType()));
203
			}
204
		}
205
		catch  (SecurityException se) { }
206
		
207
		return null; 
208
	}
209
}
210

  
211

  
0 212

  
trunk/extensions/extWFS2/src/com/iver/cit/gvsig/gui/panels/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