Revision 5948
trunk/extensions/extWFS2/src/com/iver/cit/gvsig/wfs/WFSClientExtension.java | ||
---|---|---|
2 | 2 |
|
3 | 3 |
import com.iver.andami.plugins.Extension; |
4 | 4 |
import com.iver.cit.gvsig.AddLayer; |
5 |
import com.iver.cit.gvsig.gui.toc.FPopupMenu; |
|
6 |
import com.iver.cit.gvsig.gui.toc.WFSPropsTocMenuEntry; |
|
5 | 7 |
import com.iver.cit.gvsig.gui.wizards.WFSWizard; |
6 | 8 |
|
7 | 9 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana |
... | ... | |
48 | 50 |
* |
49 | 51 |
* $Id$ |
50 | 52 |
* $Log$ |
51 |
* Revision 1.3 2006-05-19 12:57:34 jorpiell |
|
53 |
* Revision 1.4 2006-06-21 12:35:45 jorpiell |
|
54 |
* 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 |
|
55 |
* |
|
56 |
* Revision 1.3 2006/05/19 12:57:34 jorpiell |
|
52 | 57 |
* Ahora hereda de Extension |
53 | 58 |
* |
54 | 59 |
* Revision 1.1 2006/04/19 12:50:16 jorpiell |
... | ... | |
63 | 68 |
|
64 | 69 |
public void initialize() { |
65 | 70 |
System.out.println("A?ado Wizard WFS2."); |
71 |
|
|
72 |
FPopupMenu.addEntry(new WFSPropsTocMenuEntry()); |
|
66 | 73 |
|
67 | 74 |
// Adds a new tab to the "add layer" wizard for WFS layer creation |
68 | 75 |
AddLayer.addWizard(WFSWizard.class); |
trunk/extensions/extWFS2/src/com/iver/cit/gvsig/fmap/drivers/geotools/WFSFilter.java | ||
---|---|---|
63 | 63 |
* |
64 | 64 |
* $Id$ |
65 | 65 |
* $Log$ |
66 |
* Revision 1.4 2006-06-14 07:57:19 jorpiell |
|
66 |
* Revision 1.5 2006-06-21 12:35:45 jorpiell |
|
67 |
* 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 |
|
68 |
* |
|
69 |
* Revision 1.4 2006/06/14 07:57:19 jorpiell |
|
67 | 70 |
* Ya no se usa la estrategia ni se usa geotools para hacer el getFeature. Ahora se usa ?nicamente para el parseo de GML |
68 | 71 |
* |
69 | 72 |
* Revision 1.3 2006/05/25 15:32:01 jorpiell |
... | ... | |
132 | 135 |
* @return |
133 | 136 |
*/ |
134 | 137 |
public static String getGeometry(WFSLayerNode layer){ |
135 |
Vector attributes = layer.getFields(); |
|
136 |
|
|
137 |
for (int i=0 ; i<attributes.size() ; i++){ |
|
138 |
WFSAttribute attribute = (WFSAttribute)attributes.get(i); |
|
139 |
if (WFSFilter.isGeometry(attribute.getType())){ |
|
140 |
return attribute.getType().split(":")[1]; |
|
141 |
} |
|
142 |
} |
|
143 |
return ""; |
|
138 |
if (layer.getGeometry() != null){ |
|
139 |
return layer.getGeometry().getType().split(":")[1]; |
|
140 |
} |
|
141 |
return ""; |
|
142 |
|
|
144 | 143 |
} |
145 | 144 |
|
146 | 145 |
/** |
trunk/extensions/extWFS2/src/com/iver/cit/gvsig/fmap/drivers/geotools/WFSFeatureLayer.java | ||
---|---|---|
71 | 71 |
* |
72 | 72 |
* $Id$ |
73 | 73 |
* $Log$ |
74 |
* Revision 1.2 2006-06-15 10:34:12 jorpiell |
|
74 |
* Revision 1.3 2006-06-21 12:35:45 jorpiell |
|
75 |
* 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 |
|
76 |
* |
|
77 |
* Revision 1.2 2006/06/15 10:34:12 jorpiell |
|
75 | 78 |
* Ya se pueden ver los atributos de las tablas |
76 | 79 |
* |
77 | 80 |
* Revision 1.1 2006/06/14 07:57:19 jorpiell |
... | ... | |
116 | 119 |
for (int i=0 ; i<schemas.length ; i++){ |
117 | 120 |
if (schemas[i].getName().equals(status.getFeatureName())){ |
118 | 121 |
schema = schemas[i]; |
119 |
numField = schema.getFields().size();
|
|
120 |
attributes = WFSGetFeatureParser.attributteTypefromGeotoolsToGvSIG(schema);
|
|
122 |
attributes = WFSGetFeatureParser.attributteTypefromGeotoolsToGvSIG2(schema);
|
|
123 |
numField = attributes.length;
|
|
121 | 124 |
} |
122 | 125 |
} |
123 | 126 |
iterator = WFSGetFeatureParser.getFeatureReader(file, |
trunk/extensions/extWFS2/src/com/iver/cit/gvsig/fmap/drivers/geotools/WFSFeaturesIterator.java | ||
---|---|---|
73 | 73 |
* |
74 | 74 |
* $Id$ |
75 | 75 |
* $Log$ |
76 |
* Revision 1.5 2006-06-15 11:17:06 jorpiell |
|
76 |
* Revision 1.6 2006-06-21 12:35:45 jorpiell |
|
77 |
* 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 |
|
78 |
* |
|
79 |
* Revision 1.5 2006/06/15 11:17:06 jorpiell |
|
77 | 80 |
* Se ha encontrado la forma de comprobar cuando se prodicia un error de parseo al hacer un hasnext (en la feature). Se atrapa y se lanza la excepci?n hacia arriba |
78 | 81 |
* |
79 | 82 |
* Revision 1.4 2006/06/15 07:50:58 jorpiell |
... | ... | |
194 | 197 |
* @param attr |
195 | 198 |
* @return |
196 | 199 |
*/ |
197 |
private Value[] getValues(Object[] attr) { |
|
198 |
Value[] values = new Value[attr.length]; |
|
200 |
private Value[] getValues(Object[] attr) {
|
|
201 |
Value[] values = new Value[attr.length - 1];
|
|
199 | 202 |
for (int i=1;i<attr.length;i++){ |
200 | 203 |
if (attr[i]!=null){ |
201 | 204 |
if (attr[i] instanceof Double){ |
202 |
values[i]=ValueFactory.createValue(((Double)attr[i]).doubleValue()); |
|
205 |
values[i-1]=ValueFactory.createValue(((Double)attr[i]).doubleValue());
|
|
203 | 206 |
}else if (attr[i] instanceof String){ |
204 |
values[i]=ValueFactory.createValue(String.valueOf(attr[i])); |
|
207 |
values[i-1]=ValueFactory.createValue(String.valueOf(attr[i]));
|
|
205 | 208 |
}else if (attr[i] instanceof Long){ |
206 |
values[i]=ValueFactory.createValue(((Long)attr[i]).longValue()); |
|
209 |
values[i-1]=ValueFactory.createValue(((Long)attr[i]).longValue());
|
|
207 | 210 |
}else if (attr[i] instanceof Integer){ |
208 |
values[i]=ValueFactory.createValue(((Integer)attr[i]).intValue()); |
|
211 |
values[i-1]=ValueFactory.createValue(((Integer)attr[i]).intValue());
|
|
209 | 212 |
}else if (attr[i] instanceof Float){ |
210 |
values[i]=ValueFactory.createValue(((Float)attr[i]).floatValue()); |
|
213 |
values[i-1]=ValueFactory.createValue(((Float)attr[i]).floatValue());
|
|
211 | 214 |
}else if (attr[i] instanceof Short){ |
212 |
values[i]=ValueFactory.createValue(((Short)attr[i]).shortValue()); |
|
215 |
values[i-1]=ValueFactory.createValue(((Short)attr[i]).shortValue());
|
|
213 | 216 |
}else if (attr[i] instanceof Boolean){ |
214 |
values[i]=ValueFactory.createValue(((Boolean)attr[i]).booleanValue()); |
|
217 |
values[i-1]=ValueFactory.createValue(((Boolean)attr[i]).booleanValue());
|
|
215 | 218 |
}else if (attr[i] instanceof Date){ |
216 |
values[i]=ValueFactory.createValue(((Date)attr[i])); |
|
219 |
values[i-1]=ValueFactory.createValue(((Date)attr[i]));
|
|
217 | 220 |
} |
218 | 221 |
}else{ |
219 |
values[i]=ValueFactory.createValue(""); |
|
222 |
values[i-1]=ValueFactory.createValue("");
|
|
220 | 223 |
} |
221 | 224 |
} |
222 | 225 |
return values; |
trunk/extensions/extWFS2/src/com/iver/cit/gvsig/fmap/drivers/geotools/WFSGetFeatureParser.java | ||
---|---|---|
2 | 2 |
|
3 | 3 |
import java.io.File; |
4 | 4 |
import java.io.FileInputStream; |
5 |
import java.io.FileNotFoundException; |
|
6 |
import java.io.IOException; |
|
7 | 5 |
import java.io.InputStream; |
8 |
import java.net.Authenticator; |
|
9 |
import java.net.URI; |
|
10 |
import java.net.URL; |
|
11 |
import java.util.HashMap; |
|
12 |
import java.util.List; |
|
13 |
import java.util.Map; |
|
14 | 6 |
import java.util.Vector; |
15 | 7 |
|
16 |
import org.geotools.data.AbstractDataStore; |
|
17 |
import org.geotools.data.DefaultQuery; |
|
18 | 8 |
import org.geotools.data.FeatureReader; |
19 |
import org.geotools.data.ows.FeatureSetDescription; |
|
20 |
import org.geotools.data.ows.WFSCapabilities; |
|
21 | 9 |
import org.geotools.data.wfs.WFSFeatureReader; |
22 | 10 |
import org.geotools.data.wfs.WFSTransactionState; |
23 | 11 |
import org.geotools.factory.FactoryConfigurationError; |
... | ... | |
26 | 14 |
import org.geotools.feature.FeatureType; |
27 | 15 |
import org.geotools.feature.FeatureTypeBuilder; |
28 | 16 |
import org.geotools.feature.SchemaException; |
29 |
import org.geotools.xml.gml.GMLComplexTypes; |
|
30 |
import org.geotools.xml.schema.Element; |
|
31 | 17 |
import org.gvsig.remoteClient.wfs.WFSAttribute; |
32 | 18 |
import org.gvsig.remoteClient.wfs.WFSStatus; |
33 | 19 |
import org.xml.sax.SAXException; |
... | ... | |
79 | 65 |
* |
80 | 66 |
* $Id$ |
81 | 67 |
* $Log$ |
82 |
* Revision 1.4 2006-06-15 11:17:06 jorpiell |
|
68 |
* Revision 1.5 2006-06-21 12:35:45 jorpiell |
|
69 |
* 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 |
|
70 |
* |
|
71 |
* Revision 1.4 2006/06/15 11:17:06 jorpiell |
|
83 | 72 |
* Se ha encontrado la forma de comprobar cuando se prodicia un error de parseo al hacer un hasnext (en la feature). Se atrapa y se lanza la excepci?n hacia arriba |
84 | 73 |
* |
85 | 74 |
* Revision 1.3 2006/06/15 10:34:12 jorpiell |
... | ... | |
173 | 162 |
private static FeatureType featureTypefromGeotoolsToGvSIG(WFSLayerNode schema) throws FactoryConfigurationError, SchemaException{ |
174 | 163 |
AttributeType[] types = attributteTypefromGeotoolsToGvSIG(schema); |
175 | 164 |
String typeName = schema.getName(); |
176 |
|
|
177 |
FeatureType featureType = FeatureTypeBuilder.newFeatureType(types,typeName); |
|
165 |
FeatureType featureType = FeatureTypeBuilder.newFeatureType(types,typeName); |
|
178 | 166 |
return featureType; |
179 | 167 |
} |
180 | 168 |
|
... | ... | |
186 | 174 |
* @return |
187 | 175 |
*/ |
188 | 176 |
public static AttributeType[] attributteTypefromGeotoolsToGvSIG(WFSLayerNode schema){ |
189 |
Vector attributes = schema.getFields(); |
|
190 |
AttributeType[] types = new AttributeType[attributes.size()];
|
|
177 |
Vector attributes = schema.getSelectedFields();
|
|
178 |
AttributeType[] attributeTypes = new AttributeType[attributes.size()];
|
|
191 | 179 |
for (int i=0 ; i<attributes.size() ; i++){ |
192 | 180 |
WFSAttribute attribute = (WFSAttribute)attributes.get(i); |
193 |
AttributeType type = AttributeTypeFactory.newAttributeType(attribute.getName(),
|
|
181 |
AttributeType type = AttributeTypeFactory.newAttributeType(attribute.getName(),
|
|
194 | 182 |
WFSFilter.getAttributeJavaType(attribute)); |
195 |
types[i] = type;
|
|
183 |
attributeTypes[i] = type;
|
|
196 | 184 |
} |
197 |
return types;
|
|
185 |
return attributeTypes;
|
|
198 | 186 |
} |
199 | 187 |
|
188 |
public static AttributeType[] attributteTypefromGeotoolsToGvSIG2(WFSLayerNode schema){ |
|
189 |
Vector attributes = schema.getSelectedFields(); |
|
190 |
Vector addedAttributes = new Vector(); |
|
191 |
for (int i=0 ; i<attributes.size() ; i++){ |
|
192 |
WFSAttribute attribute = (WFSAttribute)attributes.get(i); |
|
193 |
if (!(WFSFilter.isGeometry(attribute.getType()))){ |
|
194 |
AttributeType type = AttributeTypeFactory.newAttributeType(attribute.getName(), |
|
195 |
WFSFilter.getAttributeJavaType(attribute)); |
|
196 |
addedAttributes.add(type); |
|
197 |
} |
|
198 |
} |
|
199 |
AttributeType[] attributeTypes = new AttributeType[addedAttributes.size()]; |
|
200 |
for (int i=0 ; i<addedAttributes.size() ; i++){ |
|
201 |
attributeTypes[i] = (AttributeType)addedAttributes.get(i); |
|
202 |
} |
|
203 |
return attributeTypes; |
|
204 |
} |
|
200 | 205 |
|
201 | 206 |
} |
trunk/extensions/extWFS2/src/com/iver/cit/gvsig/fmap/layers/FLyrWFS.java | ||
---|---|---|
2 | 2 |
|
3 | 3 |
import java.awt.geom.Rectangle2D; |
4 | 4 |
import java.io.IOException; |
5 |
import java.net.MalformedURLException; |
|
5 | 6 |
import java.net.URL; |
7 |
import java.util.HashMap; |
|
8 |
import java.util.Vector; |
|
6 | 9 |
|
7 | 10 |
import org.gvsig.remoteClient.wfs.WFSAttribute; |
8 | 11 |
import org.gvsig.remoteClient.wfs.WFSStatus; |
... | ... | |
59 | 62 |
* |
60 | 63 |
* $Id$ |
61 | 64 |
* $Log$ |
62 |
* Revision 1.6 2006-06-15 11:17:06 jorpiell |
|
65 |
* Revision 1.7 2006-06-21 12:35:45 jorpiell |
|
66 |
* 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 |
|
67 |
* |
|
68 |
* Revision 1.6 2006/06/15 11:17:06 jorpiell |
|
63 | 69 |
* Se ha encontrado la forma de comprobar cuando se prodicia un error de parseo al hacer un hasnext (en la feature). Se atrapa y se lanza la excepci?n hacia arriba |
64 | 70 |
* |
65 | 71 |
* Revision 1.5 2006/06/14 07:57:19 jorpiell |
... | ... | |
96 | 102 |
private int timeout = 10000; |
97 | 103 |
private FMapWFSDriver wfsDriver = null; |
98 | 104 |
private VectorialAdapter vectorialAdapter = null; |
105 |
private WFSLayerNode wfsLayerNode = null; |
|
99 | 106 |
|
100 | 107 |
/** |
101 | 108 |
* Constructor |
... | ... | |
310 | 317 |
public void setOnlineResource(String onlineResource) { |
311 | 318 |
this.onlineResource = onlineResource; |
312 | 319 |
} |
320 |
|
|
321 |
public HashMap getProperties() { |
|
322 |
HashMap info = new HashMap(); |
|
323 |
info.put("name", getName()); |
|
324 |
info.put("layerName", getLayerName()); |
|
325 |
info.put("layerText", getLayerText()); |
|
326 |
info.put("attributes", getFields()); |
|
327 |
info.put("host", getHost()); |
|
328 |
info.put("wfsLayerNode", getWfsLayerNode()); |
|
329 |
WFSStatus status = new WFSStatus(getLayerName()); |
|
330 |
status.setBuffer(getNumfeatures()); |
|
331 |
status.setTimeout(getTimeout()); |
|
332 |
status.setUserName(getUserName()); |
|
333 |
status.setPassword(getPassword()); |
|
334 |
info.put("status",status); |
|
335 |
return info; |
|
336 |
|
|
337 |
} |
|
338 |
|
|
339 |
/** |
|
340 |
* @return Returns the wfsLayerNode. |
|
341 |
*/ |
|
342 |
public WFSLayerNode getWfsLayerNode() { |
|
343 |
return wfsLayerNode; |
|
344 |
} |
|
345 |
|
|
346 |
/** |
|
347 |
* @param wfsLayerNode The wfsLayerNode to set. |
|
348 |
*/ |
|
349 |
public void setWfsLayerNode(WFSLayerNode wfsLayerNode) { |
|
350 |
this.wfsLayerNode = wfsLayerNode; |
|
351 |
} |
|
352 |
|
|
353 |
public void setHost(String host2) { |
|
354 |
try { |
|
355 |
setHost(new URL(host2)); |
|
356 |
} catch (MalformedURLException e) { |
|
357 |
// TODO Auto-generated catch block |
|
358 |
e.printStackTrace(); |
|
359 |
} |
|
360 |
|
|
361 |
} |
|
313 | 362 |
} |
trunk/extensions/extWFS2/src/com/iver/cit/gvsig/fmap/layers/WFSLayerNode.java | ||
---|---|---|
4 | 4 |
import java.util.Vector; |
5 | 5 |
|
6 | 6 |
import org.gvsig.remoteClient.utils.BoundaryBox; |
7 |
import org.gvsig.remoteClient.wfs.WFSAttribute; |
|
7 | 8 |
|
8 | 9 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana |
9 | 10 |
* |
... | ... | |
49 | 50 |
* |
50 | 51 |
* $Id$ |
51 | 52 |
* $Log$ |
52 |
* Revision 1.5 2006-06-15 07:50:58 jorpiell |
|
53 |
* Revision 1.6 2006-06-21 12:35:45 jorpiell |
|
54 |
* 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 |
|
55 |
* |
|
56 |
* Revision 1.5 2006/06/15 07:50:58 jorpiell |
|
53 | 57 |
* A?adida la funcionalidad de reproyectar y hechos algunos cambios en la interfaz |
54 | 58 |
* |
55 | 59 |
* Revision 1.4 2006/05/25 10:31:55 jorpiell |
... | ... | |
77 | 81 |
private String _abstract = null; |
78 | 82 |
private Vector fields = new Vector(); |
79 | 83 |
private Vector selectedFields = new Vector(); |
84 |
private WFSAttribute geometry = null; |
|
80 | 85 |
private Vector srs = new Vector(); |
81 | 86 |
private BoundaryBox latLonBbox = null; |
82 | 87 |
private String userName = ""; |
... | ... | |
223 | 228 |
public void setLatLonBbox(BoundaryBox latLonBbox) { |
224 | 229 |
this.latLonBbox = latLonBbox; |
225 | 230 |
} |
231 |
/** |
|
232 |
* @return Returns the geometry. |
|
233 |
*/ |
|
234 |
public WFSAttribute getGeometry() { |
|
235 |
return geometry; |
|
236 |
} |
|
237 |
/** |
|
238 |
* @param geometry The geometry to set. |
|
239 |
*/ |
|
240 |
public void setGeometry(WFSAttribute geometry) { |
|
241 |
this.geometry = geometry; |
|
242 |
} |
|
226 | 243 |
|
227 | 244 |
|
228 | 245 |
|
trunk/extensions/extWFS2/src/com/iver/cit/gvsig/gui/dialogs/WFSPropsDialog.java | ||
---|---|---|
1 |
package com.iver.cit.gvsig.gui.dialogs; |
|
2 |
|
|
3 |
import java.awt.Component; |
|
4 |
import java.awt.event.ActionEvent; |
|
5 |
import java.awt.event.ActionListener; |
|
6 |
import java.net.URL; |
|
7 |
import java.util.HashMap; |
|
8 |
|
|
9 |
import javax.swing.JButton; |
|
10 |
import javax.swing.JOptionPane; |
|
11 |
import javax.swing.JPanel; |
|
12 |
|
|
13 |
import org.gvsig.remoteClient.wfs.WFSStatus; |
|
14 |
|
|
15 |
import com.iver.andami.PluginServices; |
|
16 |
import com.iver.andami.ui.mdiManager.View; |
|
17 |
import com.iver.andami.ui.mdiManager.ViewInfo; |
|
18 |
import com.iver.cit.gvsig.fmap.DriverException; |
|
19 |
import com.iver.cit.gvsig.fmap.MapControl; |
|
20 |
import com.iver.cit.gvsig.fmap.layers.FLayer; |
|
21 |
import com.iver.cit.gvsig.fmap.layers.FLayers; |
|
22 |
import com.iver.cit.gvsig.fmap.layers.FLyrWFS; |
|
23 |
import com.iver.cit.gvsig.fmap.layers.WFSLayerNode; |
|
24 |
import com.iver.cit.gvsig.gui.panels.WFSParamsPanel; |
|
25 |
import com.iver.cit.gvsig.gui.wizards.WFSWizardData; |
|
26 |
import com.iver.cit.gvsig.gui.wizards.WizardListener; |
|
27 |
import com.iver.cit.gvsig.gui.wizards.WizardListenerSupport; |
|
28 |
|
|
29 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana |
|
30 |
* |
|
31 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana. |
|
32 |
* |
|
33 |
* This program is free software; you can redistribute it and/or |
|
34 |
* modify it under the terms of the GNU General Public License |
|
35 |
* as published by the Free Software Foundation; either version 2 |
|
36 |
* of the License, or (at your option) any later version. |
|
37 |
* |
|
38 |
* This program is distributed in the hope that it will be useful, |
|
39 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
40 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
41 |
* GNU General Public License for more details. |
|
42 |
* |
|
43 |
* You should have received a copy of the GNU General Public License |
|
44 |
* along with this program; if not, write to the Free Software |
|
45 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA. |
|
46 |
* |
|
47 |
* For more information, contact: |
|
48 |
* |
|
49 |
* Generalitat Valenciana |
|
50 |
* Conselleria d'Infraestructures i Transport |
|
51 |
* Av. Blasco Ib??ez, 50 |
|
52 |
* 46010 VALENCIA |
|
53 |
* SPAIN |
|
54 |
* |
|
55 |
* +34 963862235 |
|
56 |
* gvsig@gva.es |
|
57 |
* www.gvsig.gva.es |
|
58 |
* |
|
59 |
* or |
|
60 |
* |
|
61 |
* IVER T.I. S.A |
|
62 |
* Salamanca 50 |
|
63 |
* 46005 Valencia |
|
64 |
* Spain |
|
65 |
* |
|
66 |
* +34 963163400 |
|
67 |
* dac@iver.es |
|
68 |
*/ |
|
69 |
/* CVS MESSAGES: |
|
70 |
* |
|
71 |
* $Id$ |
|
72 |
* $Log$ |
|
73 |
* Revision 1.1 2006-06-21 12:35:45 jorpiell |
|
74 |
* 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 |
|
75 |
* |
|
76 |
* |
|
77 |
*/ |
|
78 |
/** |
|
79 |
* @author Jorge Piera Llodr? (piera_jor@gva.es) |
|
80 |
*/ |
|
81 |
public class WFSPropsDialog extends JPanel implements View{ |
|
82 |
private WFSParamsPanel wfsParamsTabbedPane = null; |
|
83 |
private ViewInfo m_ViewInfo = null; |
|
84 |
private FLayer fLayer = null; |
|
85 |
private JButton btnApply = null; |
|
86 |
private JButton btnOk = null; |
|
87 |
private JButton btnCancel = null; |
|
88 |
private CommandListener m_actionListener = null; |
|
89 |
private JPanel buttonsPanel = null; |
|
90 |
boolean applied = false; |
|
91 |
|
|
92 |
|
|
93 |
public WFSPropsDialog(FLayer layer) { |
|
94 |
super(); |
|
95 |
initialize(layer); |
|
96 |
} |
|
97 |
|
|
98 |
private void initialize(FLayer layer) { |
|
99 |
setLayout(null); |
|
100 |
setFLayer(layer); |
|
101 |
wfsParamsTabbedPane = getParamsPanel(((FLyrWFS) layer).getProperties()); |
|
102 |
wfsParamsTabbedPane.addWizardListener(new WizardListener(){ |
|
103 |
public void wizardStateChanged(boolean finishable) { |
|
104 |
getBtnOk().setEnabled(finishable); |
|
105 |
getBtnApply().setEnabled(finishable); |
|
106 |
} |
|
107 |
|
|
108 |
public void error(Exception e) { |
|
109 |
} |
|
110 |
|
|
111 |
}) ; |
|
112 |
//wfsParamsTabbedPane.disableDisagregatedLayers(); |
|
113 |
this.add(wfsParamsTabbedPane); |
|
114 |
this.add(getButtonsPanel(), null); |
|
115 |
} |
|
116 |
|
|
117 |
public JPanel getButtonsPanel() { |
|
118 |
if (buttonsPanel == null) { |
|
119 |
m_actionListener = new CommandListener(this); |
|
120 |
buttonsPanel = new JPanel(); |
|
121 |
buttonsPanel.setBounds(5, wfsParamsTabbedPane.getHeight(), 471, 40); |
|
122 |
buttonsPanel.setLayout(null); |
|
123 |
buttonsPanel.setName("buttonPanel"); |
|
124 |
|
|
125 |
buttonsPanel.add(getBtnOk(), null); |
|
126 |
buttonsPanel.add(getBtnApply(), null); |
|
127 |
buttonsPanel.add(getBtnCancel(), null); |
|
128 |
} |
|
129 |
return buttonsPanel; |
|
130 |
} |
|
131 |
|
|
132 |
|
|
133 |
/** |
|
134 |
* With getParamsPanel we have access to the map config TabbedPane. |
|
135 |
* If this panel doesn't exist yet (which can occur when an existing project is |
|
136 |
* recovered) it is been automatically constructed by connecting to the server, |
|
137 |
* reloading the necessary data, filling up the content and setting the selected |
|
138 |
* values that were selected when the projet was saved. |
|
139 |
* |
|
140 |
* |
|
141 |
* Since a connection to the server is needed when rebuiliding the panel, this |
|
142 |
* causes a delay for the panel's showing up or a nullPointer error if there is |
|
143 |
* no path to the server. |
|
144 |
* |
|
145 |
* |
|
146 |
* Con getParamsPanel tenemos acceso a juego de pesta?as de configuraci?n |
|
147 |
* del mapa. Si este panel todav?a no existe (como puede ser cuando |
|
148 |
* recuperamos un proyecto guardado) ?ste se crea autom?ticamente conectando |
|
149 |
* al servidor, recuperando los datos necesarios, rellenando el contenido y |
|
150 |
* dejando seleccionados los valores que estaban seleccionados cuando se |
|
151 |
* guard� el proyecto. |
|
152 |
* |
|
153 |
* |
|
154 |
* Como para reconstruirse requiere una conexi�n con el servidor esto causa |
|
155 |
* un retardo en la aparici�n en el toc o un error de nullPointer si no |
|
156 |
* hay conexi�n hasta el servidor. |
|
157 |
* |
|
158 |
* |
|
159 |
* @return WMSParamsPanel |
|
160 |
*/ |
|
161 |
public WFSParamsPanel getParamsPanel(HashMap info) { |
|
162 |
if (info!=null){ |
|
163 |
try { |
|
164 |
URL host = (URL) info.get("host"); |
|
165 |
WFSWizardData dataSource = new WFSWizardData(); |
|
166 |
dataSource.setHost(host, false); |
|
167 |
|
|
168 |
WFSParamsPanel toc = new WFSParamsPanel(); |
|
169 |
toc.setWizardData(dataSource); |
|
170 |
toc.setListenerSupport(new WizardListenerSupport()); |
|
171 |
toc.setSelectedFeature((WFSLayerNode)info.get("wfsLayerNode")); |
|
172 |
toc.setselectedAttributes((WFSLayerNode)info.get("wfsLayerNode")); |
|
173 |
toc.setLayerName(fLayer.getName()); |
|
174 |
toc.refreshInfo((WFSLayerNode)info.get("wfsLayerNode")); |
|
175 |
toc.setStatus((WFSStatus)info.get("status")); |
|
176 |
toc.setVisible(true); |
|
177 |
applied = false; |
|
178 |
return toc; |
|
179 |
} catch (DriverException e) { |
|
180 |
// TODO Auto-generated catch block |
|
181 |
e.printStackTrace(); |
|
182 |
} |
|
183 |
} |
|
184 |
return null; |
|
185 |
} |
|
186 |
|
|
187 |
|
|
188 |
public ViewInfo getViewInfo() { |
|
189 |
if (m_ViewInfo == null){ |
|
190 |
m_ViewInfo=new ViewInfo(ViewInfo.MODALDIALOG); |
|
191 |
m_ViewInfo.setTitle(PluginServices.getText(this,"fit_WFS_layer")); |
|
192 |
m_ViewInfo.setWidth(wfsParamsTabbedPane.getWidth()+ 10); |
|
193 |
m_ViewInfo.setHeight(wfsParamsTabbedPane.getHeight() + 40); |
|
194 |
} |
|
195 |
return m_ViewInfo; |
|
196 |
} |
|
197 |
|
|
198 |
/** |
|
199 |
* @return Returns the fLayer. |
|
200 |
*/ |
|
201 |
public FLayer getFLayer() { |
|
202 |
return fLayer; |
|
203 |
} |
|
204 |
|
|
205 |
/** |
|
206 |
* @param layer The fLayer to set. |
|
207 |
*/ |
|
208 |
public void setFLayer(FLayer layer) { |
|
209 |
fLayer = layer; |
|
210 |
} |
|
211 |
|
|
212 |
public JButton getBtnOk() { |
|
213 |
if (btnOk == null) { |
|
214 |
btnOk = new JButton("ok"); |
|
215 |
btnOk.setText(PluginServices.getText(this,"ok")); |
|
216 |
btnOk.setActionCommand("OK"); |
|
217 |
btnOk.addActionListener(m_actionListener); |
|
218 |
btnOk.setBounds(367, 9, 90, 25); |
|
219 |
} |
|
220 |
return btnOk; |
|
221 |
} |
|
222 |
|
|
223 |
public JButton getBtnApply() { |
|
224 |
if (btnApply == null) { |
|
225 |
btnApply = new JButton("apply"); |
|
226 |
btnApply.setText(PluginServices.getText(this,"apply")); |
|
227 |
btnApply.setEnabled(false); |
|
228 |
btnApply.setActionCommand("APPLY"); |
|
229 |
btnApply.addActionListener(m_actionListener); |
|
230 |
btnApply.setBounds(267, 9, 90, 25); |
|
231 |
} |
|
232 |
return btnApply; |
|
233 |
} |
|
234 |
|
|
235 |
public JButton getBtnCancel() { |
|
236 |
if (btnCancel == null) { |
|
237 |
btnCancel = new JButton("cancel"); |
|
238 |
btnCancel.setText(PluginServices.getText(this,"cancel")); |
|
239 |
btnCancel.setActionCommand("CANCEL"); |
|
240 |
btnCancel.addActionListener(m_actionListener); |
|
241 |
btnCancel.setBounds(137, 9, 90, 25); |
|
242 |
} |
|
243 |
return btnCancel; |
|
244 |
} |
|
245 |
|
|
246 |
public void close() { |
|
247 |
PluginServices.getMDIManager().closeView(this); |
|
248 |
} |
|
249 |
|
|
250 |
/** |
|
251 |
* Merge two FLayers in one |
|
252 |
* @param group1 |
|
253 |
* @param group2 |
|
254 |
* @return |
|
255 |
*/ |
|
256 |
private FLayers mergeFLayers(FLayers group1, FLayers group2) |
|
257 |
{ |
|
258 |
FLayer layer; |
|
259 |
for(int i = 0; i < group2.getLayersCount(); i++) |
|
260 |
{ |
|
261 |
layer = group2.getLayer( i ); |
|
262 |
if(group1.getLayer( layer.getName()) == null ){ |
|
263 |
group1.addLayer( layer ); |
|
264 |
} |
|
265 |
} |
|
266 |
|
|
267 |
return group1; |
|
268 |
} |
|
269 |
|
|
270 |
private class CommandListener implements ActionListener { |
|
271 |
public CommandListener(WFSPropsDialog tp) { |
|
272 |
//m_tp = tp; |
|
273 |
} |
|
274 |
|
|
275 |
/* (non-Javadoc) |
|
276 |
* @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent) |
|
277 |
*/ |
|
278 |
public void actionPerformed(ActionEvent e) { |
|
279 |
if (e.getActionCommand() == "CANCEL"){ |
|
280 |
close(); |
|
281 |
}else{ |
|
282 |
String layerName = fLayer.getName(); |
|
283 |
|
|
284 |
fLayer = wfsParamsTabbedPane.getLayer(); |
|
285 |
((FLyrWFS) fLayer).setHost(wfsParamsTabbedPane.getData().getHost()); |
|
286 |
((FLyrWFS) fLayer).setWfsDriver(wfsParamsTabbedPane.getData().getDriver()); |
|
287 |
|
|
288 |
if (e.getActionCommand() == "APPLY"){ |
|
289 |
if (loadLayer(fLayer)){ |
|
290 |
com.iver.cit.gvsig.gui.View vista = (com.iver.cit.gvsig.gui.View) PluginServices.getMDIManager().getActiveView(); |
|
291 |
MapControl mapCtrl = vista.getMapControl(); |
|
292 |
|
|
293 |
mapCtrl.getMapContext().getLayers().replaceLayer(layerName, fLayer); |
|
294 |
|
|
295 |
mapCtrl.getMapContext().invalidate(); |
|
296 |
applied = true; |
|
297 |
getBtnApply().setEnabled(!applied); |
|
298 |
} |
|
299 |
} |
|
300 |
if (e.getActionCommand() == "OK") { |
|
301 |
if (!applied) { |
|
302 |
if (loadLayer(fLayer)){ |
|
303 |
com.iver.cit.gvsig.gui.View vista = (com.iver.cit.gvsig.gui.View) PluginServices.getMDIManager().getActiveView(); |
|
304 |
MapControl mapCtrl = vista.getMapControl(); |
|
305 |
mapCtrl.getMapContext().getLayers().replaceLayer(layerName, fLayer); |
|
306 |
mapCtrl.getMapContext().invalidate(); |
|
307 |
} |
|
308 |
} |
|
309 |
close(); |
|
310 |
} |
|
311 |
} |
|
312 |
} |
|
313 |
private boolean loadLayer(FLayer flayer){ |
|
314 |
try { |
|
315 |
((FLyrWFS)fLayer).load(); |
|
316 |
} catch (Exception e1) { |
|
317 |
// TODO Auto-generated catch block |
|
318 |
e1.printStackTrace(); |
|
319 |
JOptionPane.showMessageDialog((Component)PluginServices.getMainFrame(), |
|
320 |
PluginServices.getText(this,"cantLoad")); |
|
321 |
return false; |
|
322 |
} |
|
323 |
return true; |
|
324 |
} |
|
325 |
|
|
326 |
} |
|
327 |
} |
|
328 |
|
|
0 | 329 |
trunk/extensions/extWFS2/src/com/iver/cit/gvsig/gui/panels/WFSInfoPanel.java | ||
---|---|---|
58 | 58 |
* |
59 | 59 |
* $Id$ |
60 | 60 |
* $Log$ |
61 |
* Revision 1.6 2006-06-15 07:50:58 jorpiell |
|
61 |
* Revision 1.7 2006-06-21 12:35:45 jorpiell |
|
62 |
* 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 |
|
63 |
* |
|
64 |
* Revision 1.6 2006/06/15 07:50:58 jorpiell |
|
62 | 65 |
* A?adida la funcionalidad de reproyectar y hechos algunos cambios en la interfaz |
63 | 66 |
* |
64 | 67 |
* Revision 1.5 2006/05/25 16:22:23 jorpiell |
... | ... | |
185 | 188 |
if (i < attributes.size() -1){ |
186 | 189 |
layer_attributes_text = layer_attributes_text + ", "; |
187 | 190 |
} |
188 |
} |
|
189 |
layer_geometry_text = PluginServices.getText(this,WFSFilter.getGeometry(layer)); |
|
190 |
if (layer_geometry_text.equals("")){ |
|
191 |
layer_geometry_text = "-"; |
|
192 |
} |
|
193 |
} |
|
191 |
} |
|
192 |
} |
|
194 | 193 |
|
194 |
layer_geometry_text = PluginServices.getText(this,WFSFilter.getGeometry(layer)); |
|
195 |
if (layer_geometry_text.equals("")){ |
|
196 |
layer_geometry_text = "-"; |
|
197 |
} |
|
198 |
|
|
195 | 199 |
if (layer.getSrs().size() > 0){ |
196 | 200 |
layer_srs_text = (String)layer.getSrs().get(0); |
197 | 201 |
} |
trunk/extensions/extWFS2/src/com/iver/cit/gvsig/gui/panels/WFSOptionsPanel.java | ||
---|---|---|
12 | 12 |
import javax.swing.JTextField; |
13 | 13 |
import javax.swing.border.TitledBorder; |
14 | 14 |
|
15 |
import org.gvsig.remoteClient.wfs.WFSStatus; |
|
16 |
|
|
15 | 17 |
import com.iver.andami.PluginServices; |
16 | 18 |
import com.iver.cit.gvsig.fmap.layers.WFSLayerNode; |
17 | 19 |
import com.iver.utiles.StringUtilities; |
... | ... | |
60 | 62 |
* |
61 | 63 |
* $Id$ |
62 | 64 |
* $Log$ |
63 |
* Revision 1.5 2006-06-15 07:50:58 jorpiell |
|
65 |
* Revision 1.6 2006-06-21 12:35:45 jorpiell |
|
66 |
* 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 |
|
67 |
* |
|
68 |
* Revision 1.5 2006/06/15 07:50:58 jorpiell |
|
64 | 69 |
* A?adida la funcionalidad de reproyectar y hechos algunos cambios en la interfaz |
65 | 70 |
* |
66 | 71 |
* Revision 1.4 2006/06/01 15:40:50 jorpiell |
... | ... | |
95 | 100 |
private JPanel formatPanel = null; |
96 | 101 |
private JLabel srsLabel = null; |
97 | 102 |
private JTextField srsText = null; |
103 |
private WFSParamsPanel parent = null; |
|
98 | 104 |
/** |
99 | 105 |
* This method initializes |
100 | 106 |
* |
101 | 107 |
*/ |
102 |
public WFSOptionsPanel() { |
|
108 |
public WFSOptionsPanel(WFSParamsPanel parent) {
|
|
103 | 109 |
super(); |
110 |
this.parent = parent; |
|
104 | 111 |
initialize(); |
105 | 112 |
} |
106 | 113 |
|
... | ... | |
159 | 166 |
if (usernameText == null) { |
160 | 167 |
usernameText = new JTextField(); |
161 | 168 |
usernameText.setBounds(new java.awt.Rectangle(100,25,200,20)); |
169 |
usernameText.addKeyListener(new java.awt.event.KeyAdapter() { |
|
170 |
public void keyTyped(java.awt.event.KeyEvent e) { |
|
171 |
parent.isApplicable(true); |
|
172 |
} |
|
173 |
}); |
|
162 | 174 |
} |
163 | 175 |
return usernameText; |
164 | 176 |
} |
... | ... | |
172 | 184 |
if (passwordText == null) { |
173 | 185 |
passwordText = new JPasswordField(); |
174 | 186 |
passwordText.setBounds(new java.awt.Rectangle(100,50,200,20)); |
187 |
passwordText.addKeyListener(new java.awt.event.KeyAdapter() { |
|
188 |
public void keyTyped(java.awt.event.KeyEvent e) { |
|
189 |
parent.isApplicable(true); |
|
190 |
} |
|
191 |
}); |
|
175 | 192 |
} |
176 | 193 |
return passwordText; |
177 | 194 |
} |
... | ... | |
213 | 230 |
private JFormattedTextField getBufferText() { |
214 | 231 |
if (bufferText == null) { |
215 | 232 |
bufferText = new JFormattedTextField(NumberFormat.getIntegerInstance()); |
216 |
bufferText.setValue(new Integer(100)); |
|
233 |
bufferText.setValue(new Integer(1000));
|
|
217 | 234 |
bufferText.setBounds(new Rectangle(100, 25, 70, 20)); |
235 |
bufferText.addKeyListener(new java.awt.event.KeyAdapter() { |
|
236 |
public void keyTyped(java.awt.event.KeyEvent e) { |
|
237 |
parent.isApplicable(true); |
|
238 |
} |
|
239 |
}); |
|
218 | 240 |
} |
219 | 241 |
return bufferText; |
220 | 242 |
} |
... | ... | |
229 | 251 |
timeOutText = new JFormattedTextField(NumberFormat.getIntegerInstance()); |
230 | 252 |
timeOutText.setValue(new Integer(10000)); |
231 | 253 |
timeOutText.setBounds(new Rectangle(100, 50, 70, 20)); |
254 |
timeOutText.addKeyListener(new java.awt.event.KeyAdapter() { |
|
255 |
public void keyTyped(java.awt.event.KeyEvent e) { |
|
256 |
parent.isApplicable(true); |
|
257 |
} |
|
258 |
}); |
|
232 | 259 |
} |
233 | 260 |
return timeOutText; |
234 | 261 |
} |
235 | 262 |
|
236 | 263 |
/** |
264 |
/** |
|
237 | 265 |
* |
238 | 266 |
* @return the username |
239 | 267 |
*/ |
... | ... | |
256 | 284 |
public int getBuffer(){ |
257 | 285 |
try{ |
258 | 286 |
String buffer = StringUtilities.replace(getBufferText().getText(),".",""); |
259 |
buffer = StringUtilities.replace(getBufferText().getText(),",","");
|
|
287 |
buffer = StringUtilities.replace(buffer,",","");
|
|
260 | 288 |
return Integer.parseInt(buffer); |
261 | 289 |
}catch(NumberFormatException e){ |
262 | 290 |
return 10000; |
... | ... | |
270 | 298 |
public int getTimeout(){ |
271 | 299 |
try{ |
272 | 300 |
String timeOut = StringUtilities.replace(getTimeOutText().getText(),".",""); |
273 |
timeOut = StringUtilities.replace(getTimeOutText().getText(),",","");
|
|
301 |
timeOut = StringUtilities.replace(timeOut,",","");
|
|
274 | 302 |
return Integer.parseInt(timeOut); |
275 | 303 |
}catch(NumberFormatException e){ |
276 | 304 |
return 10000; |
... | ... | |
292 | 320 |
srsLabel.setBounds(new java.awt.Rectangle(10, 25, 85, 16)); |
293 | 321 |
formatPanel = new JPanel(); |
294 | 322 |
formatPanel.setLayout(null); |
295 |
formatPanel.setBorder(BorderFactory.createTitledBorder(null, PluginServices.getText(this, "seleccionar_srs"), TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, null, null));
|
|
323 |
formatPanel.setBorder(BorderFactory.createTitledBorder(null, PluginServices.getText(this, "srs"), TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, null, null)); |
|
296 | 324 |
formatPanel.setBounds(new java.awt.Rectangle(4,5,457,55)); |
297 | 325 |
formatPanel.add(srsLabel, null); |
298 | 326 |
formatPanel.add(getSrsText(), null); |
... | ... | |
324 | 352 |
getSrsText().setText((String)srs.get(0)); |
325 | 353 |
} |
326 | 354 |
} |
355 |
|
|
356 |
public void setStatus(WFSStatus status) { |
|
357 |
getBufferText().setText(String.valueOf(status.getBuffer())); |
|
358 |
getTimeOutText().setText(String.valueOf(status.getTimeout())); |
|
359 |
getUsernameText().setText(status.getUserName()); |
|
360 |
getPasswordText().setText(status.getPassword()); |
|
361 |
} |
|
327 | 362 |
} |
trunk/extensions/extWFS2/src/com/iver/cit/gvsig/gui/panels/WFSSelectFeaturePanel.java | ||
---|---|---|
8 | 8 |
|
9 | 9 |
import com.iver.andami.PluginServices; |
10 | 10 |
import com.iver.cit.gvsig.fmap.layers.WFSLayerNode; |
11 |
import com.iver.cit.gvsig.gui.panels.LayerTable.LayerTableModel; |
|
11 | 12 |
import com.iver.cit.gvsig.gui.wizards.WFSWizardData; |
12 | 13 |
|
13 | 14 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana |
... | ... | |
54 | 55 |
* |
55 | 56 |
* $Id$ |
56 | 57 |
* $Log$ |
57 |
* Revision 1.5 2006-05-25 10:31:06 jorpiell |
|
58 |
* Revision 1.6 2006-06-21 12:35:45 jorpiell |
|
59 |
* 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 |
|
60 |
* |
|
61 |
* Revision 1.5 2006/05/25 10:31:06 jorpiell |
|
58 | 62 |
* Como ha cambiado la forma de mostrar las capas (una tabla, en lugar de una lista), los paneles han tenido que ser modificados |
59 | 63 |
* |
60 | 64 |
* Revision 1.4 2006/05/23 08:09:39 jorpiell |
... | ... | |
168 | 172 |
txtName.setText(PluginServices.getText(this, "WFSLayer")); |
169 | 173 |
txtName.addKeyListener(new java.awt.event.KeyAdapter() { |
170 | 174 |
public void keyTyped(java.awt.event.KeyEvent e) { |
171 |
// fireWizardComplete(isCorrectlyConfigured());
|
|
175 |
parent.isApplicable(true);
|
|
172 | 176 |
} |
173 | 177 |
}); |
174 | 178 |
} |
... | ... | |
210 | 214 |
return (WFSLayerNode)getLstFeatures().getSelectedValue(); |
211 | 215 |
} |
212 | 216 |
|
217 |
public void setSelectedFeature(WFSLayerNode layerNode){ |
|
218 |
int index = -1; |
|
219 |
for (int i=0; i<getLstFeatures().getRowCount(); i++){ |
|
220 |
WFSLayerNode node = (WFSLayerNode)getLstFeatures().getValueAt(i); |
|
221 |
if (node != null && layerNode.getName().equals(node.getName())){ |
|
222 |
index = i; |
|
223 |
} |
|
224 |
} |
|
225 |
if (index != -1){ |
|
226 |
getLstFeatures().changeSelection(index,0,false,false); |
|
227 |
} |
|
228 |
} |
|
229 |
|
|
213 | 230 |
/** |
214 | 231 |
* Sets the object that holds the wizard data. |
215 | 232 |
* |
... | ... | |
273 | 290 |
return ((WFSLayerNode)getLstFeatures().getSelectedValue()).getName(); |
274 | 291 |
} |
275 | 292 |
|
293 |
public WFSLayerNode getWFSLayerNode(){ |
|
294 |
WFSLayerNode layerNode = (WFSLayerNode)getLstFeatures().getSelectedValue(); |
|
295 |
return layerNode; |
|
296 |
} |
|
297 |
|
|
276 | 298 |
/** |
277 | 299 |
* |
278 | 300 |
* @return the test that will be showed it the gvSIG |
... | ... | |
281 | 303 |
public String getLayerText(){ |
282 | 304 |
return getTxtName().getText(); |
283 | 305 |
} |
306 |
|
|
307 |
public void setLayerName(String name) { |
|
308 |
getTxtName().setText(name); |
|
309 |
} |
|
284 | 310 |
|
285 | 311 |
|
286 | 312 |
|
trunk/extensions/extWFS2/src/com/iver/cit/gvsig/gui/panels/WFSParamsPanel.java | ||
---|---|---|
6 | 6 |
|
7 | 7 |
import javax.swing.JTabbedPane; |
8 | 8 |
|
9 |
import org.gvsig.remoteClient.wfs.WFSStatus; |
|
10 |
|
|
9 | 11 |
import com.iver.andami.PluginServices; |
10 | 12 |
import com.iver.cit.gvsig.fmap.drivers.wfs.FMapWFSDriver; |
11 | 13 |
import com.iver.cit.gvsig.fmap.layers.FLayer; |
... | ... | |
13 | 15 |
import com.iver.cit.gvsig.fmap.layers.WFSLayerNode; |
14 | 16 |
import com.iver.cit.gvsig.gui.WizardPanel; |
15 | 17 |
import com.iver.cit.gvsig.gui.wizards.WFSWizardData; |
18 |
import com.iver.cit.gvsig.gui.wizards.WizardListener; |
|
16 | 19 |
import com.iver.cit.gvsig.gui.wizards.WizardListenerSupport; |
17 | 20 |
|
18 | 21 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana |
... | ... | |
59 | 62 |
* |
60 | 63 |
* $Id$ |
61 | 64 |
* $Log$ |
62 |
* Revision 1.8 2006-06-15 07:50:58 jorpiell |
|
65 |
* Revision 1.9 2006-06-21 12:35:45 jorpiell |
|
66 |
* 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 |
|
67 |
* |
|
68 |
* Revision 1.8 2006/06/15 07:50:58 jorpiell |
|
63 | 69 |
* A?adida la funcionalidad de reproyectar y hechos algunos cambios en la interfaz |
64 | 70 |
* |
65 | 71 |
* Revision 1.7 2006/05/25 16:22:47 jorpiell |
... | ... | |
89 | 95 |
* @author Jorge Piera Llodr? (piera_jor@gva.es) |
90 | 96 |
*/ |
91 | 97 |
public class WFSParamsPanel extends WizardPanel{ |
92 |
|
|
93 | 98 |
private JTabbedPane jTabbedPane = null; // @jve:decl-index=0:visual-constraint="37,30" |
94 | 99 |
private WFSSelectFeaturePanel featurePanel = null; |
95 | 100 |
private WFSSelectAttributesPanel fieldsPanel = null; |
... | ... | |
192 | 197 |
|
193 | 198 |
private void refreshInfo() { |
194 | 199 |
WFSLayerNode selectedNode = featurePanel.getSelectedFeature(); |
195 |
selectedNode.setSelectedFields(fieldsPanel.getSelectedFields()); |
|
200 |
if (selectedNode != null){ |
|
201 |
selectedNode.setSelectedFields(fieldsPanel.getSelectedFields()); |
|
202 |
} |
|
196 | 203 |
data.setUserName(optionsPanel.getUserName()); |
197 | 204 |
data.setBuffer(optionsPanel.getBuffer()); |
198 | 205 |
data.setTimeOut(optionsPanel.getTimeout()); |
... | ... | |
236 | 243 |
*/ |
237 | 244 |
private WFSSelectAttributesPanel getPanelFields(){ |
238 | 245 |
if (fieldsPanel == null) { |
239 |
fieldsPanel = new WFSSelectAttributesPanel(); |
|
246 |
fieldsPanel = new WFSSelectAttributesPanel(this);
|
|
240 | 247 |
fieldsPanel.setLayout(null); |
241 | 248 |
} |
242 | 249 |
return fieldsPanel; |
... | ... | |
251 | 258 |
*/ |
252 | 259 |
private WFSOptionsPanel getOptionsPanel(){ |
253 | 260 |
if (optionsPanel == null) { |
254 |
optionsPanel = new WFSOptionsPanel(); |
|
261 |
optionsPanel = new WFSOptionsPanel(this);
|
|
255 | 262 |
optionsPanel.setLayout(null); |
256 | 263 |
} |
257 | 264 |
return optionsPanel; |
... | ... | |
321 | 328 |
listenerSupport.callStateChanged(isCorretlyConfigured()); |
322 | 329 |
|
323 | 330 |
} |
331 |
|
|
332 |
public void refreshInfo(WFSLayerNode feature){ |
|
333 |
infoPanel.refresh(data,feature); |
|
334 |
} |
|
324 | 335 |
|
325 | 336 |
/** |
326 | 337 |
* Sets the object that holds the wizard data. |
... | ... | |
437 | 448 |
FLyrWFS layer = new FLyrWFS(); |
438 | 449 |
layer.setName(getPanelFeatures().getLayerText()); |
439 | 450 |
layer.setLayerName(getPanelFeatures().getLayerName()); |
451 |
layer.setWfsLayerNode(getLayerNode()); |
|
440 | 452 |
layer.setFields(getPanelFields().getSelectedFields()); |
441 | 453 |
layer.setUserName(getOptionsPanel().getUserName()); |
442 | 454 |
layer.setPassword(getOptionsPanel().getPassword()); |
... | ... | |
446 | 458 |
return layer; |
447 | 459 |
} |
448 | 460 |
|
461 |
private WFSLayerNode getLayerNode(){ |
|
462 |
WFSLayerNode layerNode = getPanelFeatures().getWFSLayerNode(); |
|
463 |
layerNode.setSelectedFields(getPanelFields().getSelectedFields()); |
|
464 |
return layerNode; |
|
465 |
} |
|
449 | 466 |
|
467 |
|
|
468 |
public void setSelectedFeature(WFSLayerNode layerNode){ |
|
469 |
getPanelFeatures().setSelectedFeature(layerNode); |
|
470 |
} |
|
471 |
public void setselectedAttributes(WFSLayerNode layerNode) { |
|
472 |
getPanelFields().setSelectedFields(layerNode); |
|
473 |
} |
|
474 |
/** |
|
475 |
* @return Returns the data. |
|
476 |
*/ |
|
477 |
public WFSWizardData getData() { |
|
478 |
return data; |
|
479 |
} |
|
480 |
public void setLayerName(String name) { |
|
481 |
getPanelFeatures().setLayerName(name); |
|
482 |
|
|
483 |
} |
|
484 |
|
|
485 |
public void addWizardListener(WizardListener listener) { |
|
486 |
listenerSupport.addWizardListener(listener); |
|
487 |
} |
|
488 |
|
|
489 |
public void isApplicable(boolean applicable){ |
|
490 |
listenerSupport.callStateChanged(applicable); |
|
491 |
} |
|
492 |
|
|
493 |
|
|
494 |
public void setStatus(WFSStatus status) { |
|
495 |
getOptionsPanel().setStatus(status); |
|
496 |
} |
|
497 |
|
|
498 |
|
|
450 | 499 |
} |
trunk/extensions/extWFS2/src/com/iver/cit/gvsig/gui/panels/LayerTable.java | ||
---|---|---|
57 | 57 |
* |
58 | 58 |
* $Id$ |
59 | 59 |
* $Log$ |
60 |
* Revision 1.2 2006-05-25 16:01:43 jorpiell |
|
60 |
* Revision 1.3 2006-06-21 12:35:45 jorpiell |
|
61 |
* 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 |
|
62 |
* |
|
63 |
* Revision 1.2 2006/05/25 16:01:43 jorpiell |
|
61 | 64 |
* Se ha a?adido la funcionalidad para eliminar el namespace de los tipos de atributos |
62 | 65 |
* |
63 | 66 |
* Revision 1.1 2006/05/25 10:29:50 jorpiell |
... | ... | |
84 | 87 |
return model.getLayerAt(selectedRow); |
85 | 88 |
} |
86 | 89 |
|
90 |
public WFSLayerNode getValueAt(int position){ |
|
91 |
if (position<this.getRowCount()){ |
|
92 |
LayerTableModel model = (LayerTableModel)getModel(); |
|
93 |
return model.getLayerAt(position); |
|
94 |
} |
|
95 |
return null; |
|
96 |
} |
|
97 |
|
|
87 | 98 |
/** |
88 | 99 |
* Adds a vector of features |
89 | 100 |
* @param features |
... | ... | |
209 | 220 |
public void deleteRow(int rowPosition){ |
210 | 221 |
layers.remove(rowPosition); |
211 | 222 |
fireTableRowsDeleted(rowPosition, rowPosition); |
212 |
fireTableRowsUpdated(0,getRowCount()); |
|
223 |
fireTableRowsUpdated(0,getRowCount());
|
|
213 | 224 |
} |
214 | 225 |
|
226 |
|
|
227 |
|
|
215 | 228 |
/* |
216 | 229 |
* (non-Javadoc) |
217 | 230 |
* @see javax.swing.table.TableModel#getColumnName(int) |
trunk/extensions/extWFS2/src/com/iver/cit/gvsig/gui/panels/WFSSelectAttributesPanel.java | ||
---|---|---|
60 | 60 |
* |
61 | 61 |
* $Id$ |
62 | 62 |
* $Log$ |
63 |
* Revision 1.3 2006-06-15 07:50:58 jorpiell |
|
63 |
* Revision 1.4 2006-06-21 12:35:45 jorpiell |
|
64 |
* 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 |
|
65 |
* |
|
66 |
* Revision 1.3 2006/06/15 07:50:58 jorpiell |
|
64 | 67 |
* A?adida la funcionalidad de reproyectar y hechos algunos cambios en la interfaz |
65 | 68 |
* |
66 | 69 |
* Revision 1.2 2006/05/26 06:29:42 jorpiell |
... | ... | |
94 | 97 |
private JList selectedAttributesList = null; |
95 | 98 |
private JButton addAllButton = null; |
96 | 99 |
private JButton delAllButton = null; |
100 |
private WFSParamsPanel parent = null; |
|
97 | 101 |
|
98 |
public WFSSelectAttributesPanel(){ |
|
102 |
public WFSSelectAttributesPanel(WFSParamsPanel parent){
|
|
99 | 103 |
super(); |
104 |
this.parent = parent; |
|
100 | 105 |
initialize(); |
101 | 106 |
} |
102 | 107 |
|
... | ... | |
128 | 133 |
new java.awt.event.ActionListener() { |
129 | 134 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
130 | 135 |
addAttribute(); |
136 |
parent.isApplicable(true); |
|
131 | 137 |
} |
132 | 138 |
}); |
133 | 139 |
addButton.setIcon(new ImageIcon(getClass().getClassLoader().getResource("images/forward.png"))); |
... | ... | |
148 | 154 |
new java.awt.event.ActionListener() { |
149 | 155 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
150 | 156 |
delAttribute(); |
157 |
parent.isApplicable(true); |
|
151 | 158 |
} |
152 | 159 |
}); |
153 | 160 |
delButton.setIcon(new ImageIcon(getClass().getClassLoader().getResource("images/backward.png"))); |
... | ... | |
168 | 175 |
new java.awt.event.ActionListener() { |
169 | 176 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
170 | 177 |
addAllAttributes(); |
178 |
parent.isApplicable(true); |
|
171 | 179 |
} |
172 | 180 |
}); |
173 | 181 |
addAllButton.setIcon(new ImageIcon(getClass().getClassLoader().getResource("images/forwardDouble.png"))); |
... | ... | |
188 | 196 |
new java.awt.event.ActionListener() { |
189 | 197 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
190 | 198 |
delAllAttributes(); |
199 |
parent.isApplicable(true); |
|
191 | 200 |
} |
192 | 201 |
}); |
193 | 202 |
delAllButton.setIcon(new ImageIcon(getClass().getClassLoader().getResource("images/backwardDouble.png"))); |
... | ... | |
263 | 272 |
*/ |
264 | 273 |
private void setFields(WFSLayerNode feature){ |
265 | 274 |
getSelectedAttributesList().setListData(new Object[0]); |
266 |
Vector fields = feature.getFields(); |
|
275 |
Vector fields = feature.getFields();
|
|
267 | 276 |
getAttributesList().addAttributes(fields.toArray()); |
268 | 277 |
for (int i=0 ; i<fields.size() ;i++){ |
269 | 278 |
WFSAttribute field = (WFSAttribute)fields.get(i); |
... | ... | |
271 | 280 |
Vector geometry = new Vector(); |
272 | 281 |
geometry.add(field); |
273 | 282 |
getSelectedAttributesList().setListData(geometry.toArray()); |
283 |
feature.setGeometry(field); |
|
274 | 284 |
} |
275 | 285 |
} |
286 |
|
|
276 | 287 |
} |
277 | 288 |
|
289 |
public void setSelectedFields(WFSLayerNode feature){ |
|
290 |
Vector selectedFields = feature.getSelectedFields(); |
|
291 |
Vector addedFields = new Vector(); |
|
292 |
Object[] selectableAttributes = getAttributesList().getAllValues(); |
|
293 |
for (int i=0 ; i<selectedFields.size() ; i++){ |
|
294 |
WFSAttribute selectedAttribute = (WFSAttribute)selectedFields.get(i); |
|
295 |
for (int j=0; j < selectableAttributes.length; j++) { |
|
296 |
WFSAttribute attribute = (WFSAttribute)selectableAttributes[j]; |
|
297 |
if (attribute.getName().equals(selectedAttribute.getName())){ |
|
298 |
addedFields.add(attribute); |
|
299 |
} |
|
300 |
} |
|
301 |
} |
|
302 |
getSelectedAttributesList().setListData(addedFields.toArray()); |
|
303 |
} |
|
304 |
|
|
278 | 305 |
/** |
279 | 306 |
* Adds the selected items from the time list to the selected |
280 | 307 |
* features list. |
trunk/extensions/extWFS2/src/com/iver/cit/gvsig/gui/toc/WFSPropsTocMenuEntry.java | ||
---|---|---|
1 |
package com.iver.cit.gvsig.gui.toc; |
|
2 |
|
|
3 |
import java.awt.event.ActionEvent; |
|
4 |
|
|
5 |
import javax.swing.JMenuItem; |
|
6 |
|
|
7 |
import com.iver.andami.PluginServices; |
|
8 |
import com.iver.cit.gvsig.fmap.layers.FLayer; |
|
9 |
import com.iver.cit.gvsig.fmap.layers.FLyrWFS; |
|
10 |
import com.iver.cit.gvsig.gui.dialogs.WFSPropsDialog; |
|
11 |
|
|
12 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana |
|
13 |
* |
|
14 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana. |
|
15 |
* |
|
16 |
* This program is free software; you can redistribute it and/or |
|
17 |
* modify it under the terms of the GNU General Public License |
|
18 |
* as published by the Free Software Foundation; either version 2 |
|
19 |
* of the License, or (at your option) any later version. |
|
20 |
* |
|
21 |
* This program is distributed in the hope that it will be useful, |
|
22 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
23 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
24 |
* GNU General Public License for more details. |
|
25 |
* |
|
26 |
* You should have received a copy of the GNU General Public License |
|
27 |
* along with this program; if not, write to the Free Software |
|
28 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA. |
|
29 |
* |
|
30 |
* For more information, contact: |
|
31 |
* |
|
32 |
* Generalitat Valenciana |
|
33 |
* Conselleria d'Infraestructures i Transport |
|
34 |
* Av. Blasco Ib??ez, 50 |
|
35 |
* 46010 VALENCIA |
|
36 |
* SPAIN |
|
37 |
* |
|
38 |
* +34 963862235 |
|
39 |
* gvsig@gva.es |
|
40 |
* www.gvsig.gva.es |
|
41 |
* |
|
42 |
* or |
|
43 |
* |
|
44 |
* IVER T.I. S.A |
|
45 |
* Salamanca 50 |
|
46 |
* 46005 Valencia |
|
47 |
* Spain |
|
48 |
* |
|
49 |
* +34 963163400 |
|
50 |
* dac@iver.es |
|
51 |
*/ |
|
52 |
/* CVS MESSAGES: |
|
53 |
* |
|
54 |
* $Id$ |
|
55 |
* $Log$ |
|
56 |
* Revision 1.1 2006-06-21 12:35:45 jorpiell |
|
57 |
* 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 |
|
58 |
* |
|
59 |
* |
|
60 |
*/ |
|
61 |
/** |
|
62 |
* @author Jorge Piera Llodr? (piera_jor@gva.es) |
|
63 |
*/ |
|
64 |
public class WFSPropsTocMenuEntry extends TocMenuEntry { |
|
65 |
private JMenuItem propsMenuItem; |
|
66 |
FLayer lyr = null; |
|
67 |
|
|
68 |
public void initialize(FPopupMenu m) { |
|
69 |
super.initialize(m); |
|
70 |
|
|
71 |
if (isTocItemBranch()) { |
|
72 |
lyr = getNodeLayer(); |
|
73 |
if ((lyr instanceof FLyrWFS)) { |
|
74 |
propsMenuItem = new JMenuItem(PluginServices.getText(this, "wfs_properties")); |
|
75 |
getMenu().add( propsMenuItem ); |
|
76 |
propsMenuItem.setFont(FPopupMenu.theFont); |
|
77 |
getMenu().setEnabled(true); |
|
78 |
propsMenuItem.addActionListener(this); |
|
79 |
} |
|
80 |
} |
|
81 |
} |
|
82 |
|
|
83 |
public void actionPerformed(ActionEvent e) { |
|
84 |
lyr = getNodeLayer(); |
|
85 |
WFSPropsDialog dialog = new WFSPropsDialog(lyr); |
|
86 |
PluginServices.getMDIManager().addView(dialog); |
|
87 |
} |
|
88 |
|
|
89 |
} |
|
0 | 90 |
Also available in: Unified diff