I have some code that allows a user to select an attribute value from a list,
and I run a filter on it so that only that item is displayed.
The code reads:
private void showSelectedValues(Object[] selValues)
{
int nvals = selValues.length;
String attName = selAttribute.getLocalName();
FeatureSource fs = ml.getFeatureSource();
Vector filters = new Vector(nvals);
Class cls = selAttribute.getBinding();
System.out.println(cls.getName());
for (int i = 0; i < nvals; i++)
{
PropertyIsEqualTo ef = ff.equals(ff2.property(attName),
ff.literal(selValues[i])); //ff==FilterFactory, ff2 == FilterFactory2
filters.add(ef);
}
ml.setQuery(new DefaultQuery("",ff.or(filters))); //ml == maplayer
mp.setReset(true);// mp == mappane
mp.repaint();
}
This will not work when the attribute is "the_geom" (i.e. the binding is
of the type com.vividsolutions.jts.geom.*) and it often fails when the
binding is an Integer, thought I can't see any rhyme or reason in it.
Gaby
--
************************************************************************
http://www.chimere.org/ http://walbatross.blogspot.com
************************************************************************
** Throw the radio up high / Watch us drown out half the sky **
** Synaesthesia coloured blue / Aquaman knows what to do **
************************************************************************
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users