[OpenLayers-Users] GWT WFS Feature name

paweluz paweluz at o2.pl
Mon Mar 8 05:14:57 EST 2010


Hi!

I am working with GWT-OL from page
http://sourceforge.net/projects/gwt-openlayers/.
I was thinking if someone may know the way to get the name of attribute
(name of column in the database) dynamically? My idea is not to hardcode the
name of attributions in the code. Is there a way to do this?? In javascript
that was easy. It was something like this:

function onFeatureSelect(feature) {
  var object_attributes = feature.attributes;
  for (var key in object_attributes)
  {
   .... //key was may column name and the object_attributes[key] was my
value
  }
 ...
}

How to do this kind of thinks in JAVA in GWT-OL?? I have something like
this:

SelectFeatureListener selectFeatureListener = new SelectFeatureListener() {   
  @Override
  public void onFeatureSelected(VectorFeature vectorFeature) {

  objectAttributes = vectorFeature.getAttributes();
  vectorFeature.?????????
  objectAttributes.????????

  // I have tried with:
  Window.alert(vectorFeature.getJSObject().getProperty("id")+ "Id \n"+
    vectorFeature.getJSObject().getProperty("data")+ "Data \n"+
    vectorFeature.getJSObject().getProperty("geometry")+ "Geometry \n" +
   
vectorFeature.getJSObject().getProperty("attributes").getPropertyNames()+
"Attributes \n"+
    vectorFeature.getJSObject().getProperty("layer")+ "Layer \n"+
    vectorFeature.getJSObject().getProperty("???????")+ "???\n");
  }
};
... with no success

Does anyone know??

Regards, 
Poul
-- 
View this message in context: http://n2.nabble.com/GWT-WFS-Feature-name-tp4694354p4694354.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.



More information about the Users mailing list