look for the contract of ClickListener.onClick
http://fisheye3.atlassian.com/browse/wicket-stuff/trunk/wicketstuff-core/gmap2-parent/gmap2/src/main/java/wicket/contrib/gmap/event/ClickListener.java?r=4444#l65

An Overlay was clicked, so glatLng is null.

mf

2010/2/16 Josh Kamau <[email protected]>

> Team;;
>
>
> Whats wrong with this code?
>
> The map is being displayed properly and when i click on it, a new marker is
> added and the infoWindow is shown. when i click on the info window, i get
> the below error.
>
>
>
> package org.at.example;
>
> import org.apache.wicket.PageParameters;
> import org.apache.wicket.ajax.AjaxRequestTarget;
> import org.apache.wicket.markup.html.WebPage;
> import org.apache.wicket.markup.html.basic.Label;
>
> import wicket.contrib.gmap.GMap2;
> import wicket.contrib.gmap.api.GControl;
> import wicket.contrib.gmap.api.GEvent;
> import wicket.contrib.gmap.api.GEventHandler;
> import wicket.contrib.gmap.api.GLatLng;
> import wicket.contrib.gmap.api.GMarker;
> import wicket.contrib.gmap.api.GMarkerOptions;
> import wicket.contrib.gmap.api.GOverlay;
> import wicket.contrib.gmap.event.ClickListener;
> import wicket.contrib.gmap.event.InfoWindowCloseListener;
> import wicket.contrib.gmap.event.InfoWindowOpenListener;
>
> /**
>  * Homepage
>  */
> public class HomePage extends WebPage {
>
> private static final long serialVersionUID = 1L;
>
> /**
>  * Constructor that is invoked when page is invoked without a session.
>  *
>  * @param parameters
>  *            Page parameters
>  */
> public HomePage(final PageParameters parameters) {
>
> final GMap2 gmap = new GMap2(
> "gmap",
>
> "ABQIAAAA5IYWHbtyKMSxjbiygH-jRxQqloa41_x1QYpvvO_ao_uBs0dQxxQQyhzR9MXmD-ENkRmQIOig-WC-iw");
>
> gmap.addControl(GControl.GMapTypeControl);
> gmap.addControl(GControl.GLargeMapControl);
>
> gmap.setOutputMarkupId(true);
> gmap.setScrollWheelZoomEnabled(true);
>
> gmap.add(new ClickListener() {
>
> @Override
> protected void onClick(AjaxRequestTarget target, GLatLng glatLng,
> GOverlay overlay) {
>
> // GMarkerOptions gmo = new GMarkerOptions();
> // gmo.draggable(true);
> // gmo.bouncy(true);
> if (!(overlay instanceof GMarker)) {                //This section was
> added
> to stop the same error from occouring when the marker is clicked.
> GMarker gm = new GMarker(glatLng);
> gmap.getInfoWindow().open(glatLng,
> new Label("Hello", "Hi , am here"));
> gmap.addOverlay(gm);
> }
>
> }
>
> });
>
>  add(gmap);
> }
> }
>
>
>
>
> Error:
>
> ERROR - RequestCycle               -
> java.lang.NullPointerException
> at wicket.contrib.gmap.api.GInfoWindow.getJSopen(GInfoWindow.java:162)
> at wicket.contrib.gmap.api.GInfoWindow.open(GInfoWindow.java:115)
> at wicket.contrib.gmap.api.GInfoWindow.open(GInfoWindow.java:91)
> at org.at.example.HomePage$1.onClick(HomePage.java:56)
> at wicket.contrib.gmap.event.ClickListener.onEvent(ClickListener.java:61)
> at
>
> wicket.contrib.gmap.event.GEventListenerBehavior.respond(GEventListenerBehavior.java:58)
> at
>
> org.apache.wicket.ajax.AbstractDefaultAjaxBehavior.onRequest(AbstractDefaultAjaxBehavior.java:299)
> at
>
> org.apache.wicket.request.target.component.listener.BehaviorRequestTarget.processEvents(BehaviorRequestTarget.java:119)
> at
>
> org.apache.wicket.request.AbstractRequestCycleProcessor.processEvents(AbstractRequestCycleProcessor.java:92)
> at
>
> org.apache.wicket.RequestCycle.processEventsAndRespond(RequestCycle.java:1250)
> at org.apache.wicket.RequestCycle.step(RequestCycle.java:1329)
> at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1428)
> at org.apache.wicket.RequestCycle.request(RequestCycle.java:545)
> at
> org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:479)
> at
>
> org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:312)
> at
>
> org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
> at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:388)
> at
> org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
> at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
> at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765)
> at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:418)
> at
>
> org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:230)
> at
>
> org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114)
> at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
> at org.mortbay.jetty.Server.handle(Server.java:326)
> at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)
> at
>
> org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:923)
> at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:547)
> at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:212)
> at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
> at
>
> org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:409)
> at
>
> org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582)
>
>
>
>
> On Mon, Feb 15, 2010 at 9:15 PM, TahitianGabriel <[email protected]> wrote:
>
> >
> > You can get the source code here :
> >
> >
> https://wicket-stuff.svn.sf.net/svnroot/wicket-stuff/trunk/wicketstuff-core/gmap2-parent
> >
> >
> https://wicket-stuff.svn.sf.net/svnroot/wicket-stuff/trunk/wicketstuff-core/gmap2-parent
> >
> > And use it in your pom.xml like that :
> >                <dependency>
> >                        <groupId>org.wicketstuff</groupId>
> >                        <artifactId>gmap2</artifactId>
> >                        <version>1.4.1</version>
> >                </dependency>
> >
> >
> > I'm using it for a couple of projects and it's working just fine.
> >
> > Regards,
> >
> > Gabriel.
> >
> >
> > Josh Kamau wrote:
> > >
> > > Thanks alot Erik. Is the library in maven repository?
> > >
> > > regards
> > >
> > > On Mon, Feb 15, 2010 at 5:03 PM, Erik van Oosten
> > > <[email protected]>wrote:
> > >
> > >> Hi Joshue,
> > >>
> > >> I believe wicket-contrib-gmap is not active anymore.
> > >> You are probably better off with wicket-gmap2 project.
> > >>
> > >> Regards,
> > >>   Erik.
> > >>
> > >>
> > >>
> > >> Josh Kamau wrote:
> > >>
> > >>> Hi guys;
> > >>>
> > >>> Is the wicket-contrib-gmap project still active? I need to intergrate
> > >>> google
> > >>> maps and i was wondering if i can use it.
> > >>>
> > >>> Regards
> > >>> Joshua
> > >>>
> > >>
> > >> --
> > >> Send from my SMTP compliant software
> > >> Erik van Oosten
> > >> http://day-to-day-stuff.blogspot.com/
> > >>
> > >>
> > >>
> > >> ---------------------------------------------------------------------
> > >> To unsubscribe, e-mail: [email protected]
> > >> For additional commands, e-mail: [email protected]
> > >>
> > >>
> > >
> > >
> >
> > --
> > View this message in context:
> >
> http://old.nabble.com/wicket-Google-maps-integration-tp27593866p27597761.html
> > Sent from the Wicket - User mailing list archive at Nabble.com.
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [email protected]
> > For additional commands, e-mail: [email protected]
> >
> >
>

Reply via email to