Issue 2: Custom overlay class not correct implemented...
Status:  New
Owner: ----
Reported by baze...@gmail.com, Mar 2, 2012
What steps will reproduce the problem?

1. As we see in the implementation for the CustomOverlay object in the js specification this class needs to be, so to say, extended and than the api calls its on methods onAdd, onRemove and draw which we extend and we can make coresponding actions.
2.  If we use the CustomOverlay class from the gwt wraper, the class it self is abstract what is ok, but the 3 methods are final(must be final, because this class extends JavaScriptObject class) so there is no way we can extend this class and create our custom overlay..
3. In the previus GWT API 2 this class was not extendind JSO and the callback methods wore annotetad with @Export, I didnt had time to go inside the implementation but I also check in the https://code.google.com/p/gwt-google-maps-v3/ and the implement of the Overlay abstract class looks similar as the one in V2 api. 

I tryed by wraping this class and setting the 3 methods on a native calls which make a reverse call to java methods, the native methods work but this coresponding java methods are never called..
Example:

public class MyTextOverlay {

    private final LatLng latLng;

    private final SimplePanel textPanel;

    private String text;
   
    private Point offset;
    
    private OverlayView overlay = OverlayView.newInstance();

    /**
     * Main constructor
     * @param latLng
     */
    public MyTextOverlay(LatLng latLng, String text, Point offset) {
        /* Save our inputs to the object */
    	String[] st = text.split(" ");
    	text = "";
    	for (String s : st)
    		text+=s;
    	
        this.latLng = latLng;
        this.text = text;
        this.offset = offset;
        
        /* Create a widget for the text */
        ....
       
        // must be call to init the callbacks
        initOverlay( overlay);
      
    }

   
    private final native void initOverlay( JavaScriptObject jso) /*-{
    	var instance = this;
		jso.draw = function() {

			instance.@mk.icelabs.vtcustomer.client.view.components.map.MyTextOverlay::myDraw();
		};
	
		jso.onAdd = function() {
	instance.@mk.icelabs.vtcustomer.client.view.components.map.MyTextOverlay::myOnAdd();
		};
	
		jso.onRemove = function() {
			instance.@mk.icelabs.vtcustomer.client.view.components.map.MyTextOverlay::myOnRemove();
		};
	}-*/;

... the methods here...


Any idea?!


I really like your library you have done a very good job, it still  has some small problems but I fix some of dose on the fly:)


Blaze


Oct 10, 2012
#1 jien...@gmail.com
hey thanks alot i was looking away to do this. to make ur code work

$entry(instance.@com.shared.lib.com.map.CustomOverlayView::myDraw()());

seems to be the way to assign function