WMS layer = new WMS("States WMS/WFS", "http://demo.opengeo.org:80/geoserver/wms", options);
layerList.add(layer);
final WFSProxyBehavior proxyBehaviour = new WFSProxyBehavior();
final AbstractDefaultAjaxBehavior callbackBehaviour = new AbstractDefaultAjaxBehavior()
{
private static final long serialVersionUID = 1L;
@Override
protected void respond(AjaxRequestTarget target)
{
RequestCycle rc = RequestCycle.get();
WebRequest wr = (WebRequest)rc.getRequest();
String state = wr.getRequestParameters()
.getParameterValue("propertyValue")
.toString();
target.prependJavaScript("alert('you selected state = " + state + ");");
}
};
GetSpecificFeature control = new GetSpecificFeature(layer, proxyBehaviour,
callbackBehaviour, "http://demo.opengeo.org:80/geoserver/wms", "topp",
"http://www.openplans.org/topp", "states", 4326, "STATE_NAME");
HashMap<String, String> mapOptions = new LinkedHashMap<String, String>();
mapOptions.put("projection", JSUtils.getQuotedString("EPSG:4326"));
mapOptions.put("units", JSUtils.getQuotedString("degrees"));
// mapOptions.put("maxExtent",
// "new OpenLayers.Bounds(143.834,-43.648,148.479,-39.573)");
OpenLayersMap map = new OpenLayersMap("map", true, layerList, mapOptions)
{
private static final long serialVersionUID = 1L;
/*
* (non-Javadoc)
*
* @see org.wicketstuff.openlayers.OpenLayersMap#getJSinit()
*/
@Override
protected String getJSinit()
{
return "OpenLayers.ProxyHost='" + proxyBehaviour.getProxyUrl() + "';\n" +
super.getJSinit();
}
};