add(feedback);
add(hiddenContainersInfoPanel = new WebMarkupContainer("hiddenContainer"));
hiddenContainersInfoPanel.setOutputMarkupId(true);
hiddenContainersInfoPanel.add(new WebMarkupContainer(INFOPANEL));
final GEventHandler closeClickHandler = new GEventHandler()
{
private static final long serialVersionUID = 1L;
@Override
public void onEvent(AjaxRequestTarget target)
{
info("InfoWindow " + infoWindow.getId() + " was closed");
target.add(feedback);
}
};
map = new GMap("bottomPanel");
map.setOutputMarkupId(true);
map.setMapType(GMapType.SATELLITE);
map.setScrollWheelZoomEnabled(true);
map.add(new ClickListener()
{
private static final long serialVersionUID = 1L;
@Override
protected void onClick(AjaxRequestTarget target, GLatLng gLatLng)
{
if (gLatLng != null)
{
if (infoWindow != null)
{
infoWindow.close();
}
//Create the infoPanel
Component c = new InfoPanel(INFOPANEL, i);
i++;
c.setOutputMarkupId(true);
//Add or replace it on the hiddenContainer
hiddenContainersInfoPanel.addOrReplace(c);
infoWindow = new GInfoWindow(gLatLng, c);
map.addOverlay(infoWindow);
feedback.info("InfoWindow " + infoWindow.getId() + " was added");
target.add(feedback);
//add the hiddenContainer to be repainted
target.add(hiddenContainersInfoPanel);
// IMPORTANT: you must have the InfoWindow already added to the map
// before you can add any listeners
infoWindow.addListener(GEvent.closeclick, closeClickHandler);
}
}
});
add(map);
lbInfoWindow = new Label("infoWindow", "openInfoWindow");
lbInfoWindow.add(new AjaxEventBehavior("onclick")
{
private static final long serialVersionUID = 1L;
/**
* @see org.apache.wicket.ajax.AjaxEventBehavior#onEvent(org.apache.wicket.ajax.AjaxRequestTarget)
*/
@Override
protected void onEvent(AjaxRequestTarget target)
{
GInfoWindow tmpInfoWindow = new GInfoWindow(new GLatLng(37.5 * (0.9995 + Math.random() / 1000), -122.1 * (0.9995 + Math.random() / 1000)), "Opened via button");
map.addOverlay(tmpInfoWindow);
// IMPORTANT: you must have the InfoWindow already added to the map
// before you can add any listeners
GEventHandler closeClickHandler = new GEventHandler()
{
private static final long serialVersionUID = 1L;
@Override
public void onEvent(AjaxRequestTarget target)