You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by toytown <pr...@gmail.com> on 2011/12/14 10:33:26 UTC

Google map without GMap2

Currently I am using GMap2 but my app needs a Stateless page. So wheneever I
add GMap2 panel the page becomes Stateful since GMap2 is a stateful
component. I tried to refactor the GMap2 but it seems not to be designed for
extensibility as most methods and fields are privat.
  All I need is a simple map with geocoding and a marker for which I can use
jquery. Has anyone expereince such issues before ?

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Google-map-without-GMap2-tp4194249p4194249.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Google map without GMap2

Posted by toytown <pr...@gmail.com>.
Thanks for a quick reply. 

To correct a little bit - the method signature should be protected.

Also the component are by default stateless . I also refactored getJSinit()
method to remove some listeners or behaviours which case the statless nature
to change to stateful. This is because the class
AbstractAjaxBehavior has stateless hint set to false by default.


	@Override
	protected boolean getStatelessHint() {
	    return overlays.isEmpty();
	}

//removed some behaviour which can cause stateful component
private String getJSinit()
	{
		StringBuffer js = new StringBuffer("new WicketMap2('" + map.getMarkupId()
+ "');\n");
            
                 //Commented out as OverLayListner implements IBehaviour
		//REMOVED js.append(overlayListener.getJSinit());
		js.append(getJSsetCenter(getCenter()));
		js.append(getJSsetZoom(getZoom()));
		js.append(getJSsetDraggingEnabled(draggingEnabled));
		js.append(getJSsetDoubleClickZoomEnabled(doubleClickZoomEnabled));
		js.append(getJSsetScrollWheelZoomEnabled(scrollWheelZoomEnabled));
		js.append(getJSsetGoogleBarEnabled(googleBarEnabled));

		js.append(mapType.getJSsetMapType(this));

		// Add the controls.
		for (GControl control : controls)
		{
			js.append(control.getJSadd(this));
		}

		// Add the overlays.
		for (GOverlay overlay : overlays)
		{
			js.append(overlay.getJSadd());
		}

		js.append(infoWindow.getJSinit());

//REMOVED		for (Object behavior :
getBehaviors(GEventListenerBehavior.class))
//		{
//			js.append(((GEventListenerBehavior)behavior).getJSaddListener());
//		}


		return js.toString();
	}


--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Google-map-without-GMap2-tp4194249p4194834.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Google map without GMap2

Posted by Sven Meier <sv...@meiers.net>.
Hi,

with a small tweak GMap2 can be made stateless when no markers are present:

--- 
a/jdk-1.5-parent/gmap2-parent/gmap2/src/main/java/wicket/contrib/gmap/GMap2.java
+++ 
b/jdk-1.5-parent/gmap2-parent/gmap2/src/main/java/wicket/contrib/gmap/GMap2.java
@@ -823,6 +823,11 @@ public class GMap2 extends Panel implements 
GOverlayContainer
                 private static final long serialVersionUID = 1L;

                 @Override
+               public boolean getStatelessHint(Component component) {
+                       return overlays.isEmpty();
+               }
+
+               @Override
                 protected void respond(AjaxRequestTarget target)
                 {
                         Request request = RequestCycle.get().getRequest();

Hope this helps
Sven


Am 14.12.2011 10:33, schrieb toytown:
> Currently I am using GMap2 but my app needs a Stateless page. So wheneever I
> add GMap2 panel the page becomes Stateful since GMap2 is a stateful
> component. I tried to refactor the GMap2 but it seems not to be designed for
> extensibility as most methods and fields are privat.
>    All I need is a simple map with geocoding and a marker for which I can use
> jquery. Has anyone expereince such issues before ?
>
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/Google-map-without-GMap2-tp4194249p4194249.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org