It appears that your Map click handler is getting fired when you click
the maximize button.   I think you can add this test at the top of
your click handler before re-invoking the info window to avoid this:

  if (overlay instanceof InfoWindow) {
    return;
  }

Let me know if that solves the problem.

-Eric.

On Sun, Feb 1, 2009 at 3:59 AM, Yousef.Ghandour
<[email protected]> wrote:
>
> This will render the infoWindow just fine, and the max is working
> also:
>
>
>
> private void handleClick(MapClickEvent e) {
>
>                final MapWidget sender = e.getSender();
>
>                final Overlay overlay = e.getOverlay();
>
>                final LatLng point = e.getLatLng();
>
>
>
>                final InfoWindowContent content;
>
>                HTML htmlWidget = new HTML(
>
>                                "<h1>ATTENTION PLEASE</h1>"
>
>                                                + "<p> I have a few things to 
> say to you (click maximize.)</
> p>");
>
>                content = new InfoWindowContent(htmlWidget);
>
>                content.setMaxContent("<p>Now is the time for all good men to 
> come
> to the"
>
>                                                + " aid of their country 
> because we hold these truths to be
> self"
>
>                                                + " evident, that I have a 
> dream, that one day our children and
> our"
>
>                                                + " children's children will 
> tear down this wall!</p>"
>
>                                                + "<p>Now is the time for all 
> good men to come to the"
>
>                                                + " aid of their country 
> because we hold these truths to be
> self"
>
>                                                + " evident, that I have a 
> dream, that one day our children and
> our"
>
>                                                + " children's children will 
> tear down this wall!</p>");
>
>                content.setMaxTitle("ATTENTION PLEASE");
>
>
>
>
>
>                infoWindow = sender.getInfoWindow();
>
>                infoWindow.open(sender.getCenter(), content);
>
>
>
> }
>
>
>
> This will render the infoWindow, but when max btn is clicked, the
> window will disappear.
>
>
>
> private void handleClick(MapClickEvent e) {
>
>                final MapWidget sender = e.getSender();
>
>                final Overlay overlay = e.getOverlay();
>
>                final LatLng point = e.getLatLng();
>
>
>
>                final InfoWindowContent content;
>
>                HTML htmlWidget = new HTML(
>
>                                "<h1>ATTENTION PLEASE</h1>"
>
>                                                + "<p> I have a few things to 
> say to you (click maximize.)</
> p>");
>
>                content = new InfoWindowContent(htmlWidget);
>
>                content.setMaxContent("<p>Now is the time for all good men to 
> come
> to the"
>
>                                                + " aid of their country 
> because we hold these truths to be
> self"
>
>                                                + " evident, that I have a 
> dream, that one day our children and
> our"
>
>                                                + " children's children will 
> tear down this wall!</p>"
>
>                                                + "<p>Now is the time for all 
> good men to come to the"
>
>                                                + " aid of their country 
> because we hold these truths to be
> self"
>
>                                                + " evident, that I have a 
> dream, that one day our children and
> our"
>
>                                                + " children's children will 
> tear down this wall!</p>");
>
>                content.setMaxTitle("ATTENTION PLEASE");
>
>
>
>
>
>                infoWindow = sender.getInfoWindow();
>
>                infoWindow.open(point, content);
>
>
>
> }
>
>
>
> This will render the window, and will show the max window when the
> max btn is clicked
>
> however, it will throw the exception below
>
>
>
>
>
> private void handleClick(MapClickEvent e) {
>
>                final MapWidget sender = e.getSender();
>
>                final Overlay overlay = e.getOverlay();
>
>                final LatLng point = e.getLatLng();
>
>
>
>                final InfoWindowContent content;
>
>                HTML htmlWidget = new HTML(
>
>                                "<h1>ATTENTION PLEASE</h1>"
>
>                                                + "<p> I have a few things to 
> say to you (click maximize.)</
> p>");
>
>                content = new InfoWindowContent(htmlWidget);
>
>                content.setMaxContent("<p>Now is the time for all good men to 
> come
> to the"
>
>                                                + " aid of their country 
> because we hold these truths to be
> self"
>
>                                                + " evident, that I have a 
> dream, that one day our children and
> our"
>
>                                                + " children's children will 
> tear down this wall!</p>"
>
>                                                + "<p>Now is the time for all 
> good men to come to the"
>
>                                                + " aid of their country 
> because we hold these truths to be
> self"
>
>                                                + " evident, that I have a 
> dream, that one day our children and
> our"
>
>                                                + " children's children will 
> tear down this wall!</p>");
>
>                content.setMaxTitle("ATTENTION PLEASE");
>
>
>
>
>
>                infoWindow = sender.getInfoWindow();
>
>                LatLng newPoint = LatLng.newInstance(point.getLatitude(),
> point.getLongitude());
>
>                infoWindow.open(point, content);
>
>
>
> }
>
>
>
>
>
>
>
> [ERROR] Uncaught exception escaped
>
> com.google.gwt.core.client.JavaScriptException: (TypeError): this.lat
> is not a function
>
>  fileName: jar:file:/home/yousef/workspace/lib/gwt-maps.jar!/com/
> google/gwt/maps/client/geom/LatLng.java
>
>  lineNumber: 113
>
>  stack: ()@jar:file:/home/yousef/workspace/lib/gwt-maps.jar!/com/
> google/gwt/maps/client/geom/LatLng.java:113
>
> public void com.google.gwt.maps.client.impl.EventImpl
> $OverlayLatLngCallback.callbackWrapper
> (com.google.gwt.maps.client.overlay.Overlay,com.google.gwt.maps.client.geom.LatLng)
> ([object gwt_nativewrapper_class],null)@:0
>
> ([object Object],undefined,[object Object])@transient source for
> com.google.gwt.maps.client.impl.__EventImplImpl:167
>
> apply([object Object],[object Array])@:0
>
> ([object Array])@http://maps.google.com/intl/en_ALL/mapfiles/140g/
> maps2.api/main.js:307
>
> ([object Object],1)@http://maps.google.com/intl/en_ALL/mapfiles/140g/
> maps2.api/main.js:287
>
> l([object Array],(function (d) {if (Ej) {d.Ap(c);} else {try {d.Ap
> (c);} catch (e) {}}}))@http://maps.google.com/intl/en_ALL/mapfiles/
> 140g/maps2.api/main.js:90
>
> H([object Object],"click",[object Object],undefined,[object Object])
> @http://maps.google.com/intl/en_ALL/mapfiles/140g/maps2.api/main.js:
> 287
>
> ([object Object])@http://maps.google.com/intl/en_ALL/mapfiles/140g/
> maps2.api/main.js:608
>
> apply([object Object],[object Array])@:0
>
> ([object Array])@http://maps.google.com/intl/en_ALL/mapfiles/140g/
> maps2.api/main.js:307
>
> ([object Object],0)@http://maps.google.com/intl/en_ALL/mapfiles/140g/
> maps2.api/main.js:287
>
> l([object Array],(function (d) {if (Ej) {d.Ap(c);} else {try {d.Ap
> (c);} catch (e) {}}}))@http://maps.google.com/intl/en_ALL/mapfiles/
> 140g/maps2.api/main.js:90
>
> H([object Object],"click",[object Object])@http://maps.google.com/intl/
> en_ALL/mapfiles/140g/maps2.api/main.js:287
>
> ([object Event],[object HTMLDivElement])@http://maps.google.com/intl/
> en_ALL/mapfiles/140g/maps2.api/main.js:1423
>
> call([object Object],[object Event],[object HTMLDivElement])@:0
>
> ([object Event])@http://maps.google.com/intl/en_ALL/mapfiles/140g/
> maps2.api/main.js:290
>
> @:0
>
>
>
>        at com.google.gwt.maps.client.geom.LatLng$.getLatitude$(Native
> Method)
>
>        at com.timevel.client.timebrowser.TimeBrowserInstance.handleClick
> (TimeBrowserInstance.java:146)
>
>        at com.timevel.client.timebrowser.TimeBrowserInstance.access$0
> (TimeBrowserInstance.java:124)
>
>        at com.timevel.client.timebrowser.TimeBrowserInstance$1.onClick
> (TimeBrowserInstance.java:118)
>
>        at com.google.gwt.maps.client.MapWidget$8.callback(MapWidget.java:
> 418)
>
>        at com.google.gwt.maps.client.impl.EventImpl$OverlayLatLngCallback
> $1.execute(EventImpl.java:193)
>
>        at
> com.google.gwt.maps.client.impl.EventImpl.invokeAndReportUncaughtExceptions
> (EventImpl.java:260)
>
>        at
> com.google.gwt.maps.client.impl.EventImpl.invokeAndMaybeReportUncaughtExceptions
> (EventImpl.java:246)
>
>        at com.google.gwt.maps.client.impl.EventImpl.access$0(EventImpl.java:
> 241)
>
>        at com.google.gwt.maps.client.impl.EventImpl
> $OverlayLatLngCallback.callbackWrapper(EventImpl.java:191)
>
>
>
> I suspected that there is something with attaching the info window to
> the
>
> map, however i don't know why calling;
>
>                LatLng newPoint = LatLng.newInstance(point.getLatitude(),
> point.getLongitude());
>
> will allow the window to be rendered?????
>
>
>
> I've also used the following, in order to get a point that is attached
> to the
>
> map:
>
>
>
>        private void handleClick(MapClickEvent e) {
>
>                final MapWidget sender = e.getSender();
>
>                final Overlay overlay = e.getOverlay();
>
>                final LatLng point = e.getLatLng();
>
>                Marker marker = new Marker(sender.getCenter());
>
>                final InfoWindowContent content;
>
>                HTML htmlWidget = new HTML(
>
>                                "<h1>ATTENTION PLEASE</h1>"
>
>                                                + "<p> I have a few things to 
> say to you (click maximize.)</
> p>");
>
>                content = new InfoWindowContent(htmlWidget);
>
>                content.setMaxContent("<p>Now is the time for all good men to 
> come
> to the"
>
>                                                + " aid of their country 
> because we hold these truths to be
> self"
>
>                                                + " evident, that I have a 
> dream, that one day our children and
> our"
>
>                                                + " children's children will 
> tear down this wall!</p>"
>
>                                                + "<p>Now is the time for all 
> good men to come to the"
>
>                                                + " aid of their country 
> because we hold these truths to be
> self"
>
>                                                + " evident, that I have a 
> dream, that one day our children and
> our"
>
>                                                + " children's children will 
> tear down this wall!</p>");
>
>                content.setMaxTitle("ATTENTION PLEASE");
>
>
>
>
>
>                infoWindow = sender.getInfoWindow();
>
>                //LatLng newPoint = LatLng.newInstance(point.getLatitude(),
> point.getLongitude());
>
>
>
>                if (overlay != null && overlay instanceof Marker) {
>
>                        sender.removeOverlay(overlay);
>
>                } else {
>
>                        marker = new Marker(point);
>
>                        sender.addOverlay(marker);
>
>                        infoWindow.open(marker.getLatLng(), content);
>
>                }
>
>
>
>
>
>        }
>
>
>
> but it throws the following exception:
>
>
>
> [ERROR] Uncaught exception escaped
>
> com.google.gwt.core.client.JavaScriptException: (TypeError): a has no
> properties
>
>  fileName: http://maps.google.com/intl/en_ALL/mapfiles/140g/maps2.api/main.js
>
>  lineNumber: 1121
>
>  stack: (null)@http://maps.google.com/intl/en_ALL/mapfiles/140g/
> maps2.api/main.js:1121
>
> apply([object Object],[object Object])@:0
>
> R(null)@http://maps.google.com/intl/en_ALL/mapfiles/140g/maps2.api/
> main.js:1119
>
> (null)@transient source for
> com.google.gwt.maps.client.impl.__MarkerImplImpl:51
>
> public void com.google.gwt.maps.client.impl.EventImpl
> $OverlayLatLngCallback.callbackWrapper
> (com.google.gwt.maps.client.overlay.Overlay,com.google.gwt.maps.client.geom.LatLng)
> ([object gwt_nativewrapper_class],null)@:0
>
> ([object Object],undefined,[object Object])@transient source for
> com.google.gwt.maps.client.impl.__EventImplImpl:167
>
> apply([object Object],[object Array])@:0
>
> ([object Array])@http://maps.google.com/intl/en_ALL/mapfiles/140g/
> maps2.api/main.js:307
>
> ([object Object],1)@http://maps.google.com/intl/en_ALL/mapfiles/140g/
> maps2.api/main.js:287
>
> l([object Array],(function (d) {if (Ej) {d.Ap(c);} else {try {d.Ap
> (c);} catch (e) {}}}))@http://maps.google.com/intl/en_ALL/mapfiles/
> 140g/maps2.api/main.js:90
>
> H([object Object],"click",[object Object],undefined,[object Object])
> @http://maps.google.com/intl/en_ALL/mapfiles/140g/maps2.api/main.js:
> 287
>
> ([object Object])@http://maps.google.com/intl/en_ALL/mapfiles/140g/
> maps2.api/main.js:608
>
> apply([object Object],[object Array])@:0
>
> ([object Array])@http://maps.google.com/intl/en_ALL/mapfiles/140g/
> maps2.api/main.js:307
>
> ([object Object],0)@http://maps.google.com/intl/en_ALL/mapfiles/140g/
> maps2.api/main.js:287
>
> l([object Array],(function (d) {if (Ej) {d.Ap(c);} else {try {d.Ap
> (c);} catch (e) {}}}))@http://maps.google.com/intl/en_ALL/mapfiles/
> 140g/maps2.api/main.js:90
>
> H([object Object],"click",[object Object])@http://maps.google.com/intl/
> en_ALL/mapfiles/140g/maps2.api/main.js:287
>
> ([object Event],[object HTMLDivElement])@http://maps.google.com/intl/
> en_ALL/mapfiles/140g/maps2.api/main.js:1423
>
> call([object Object],[object Event],[object HTMLDivElement])@:0
>
> ([object Event])@http://maps.google.com/intl/en_ALL/mapfiles/140g/
> maps2.api/main.js:290
>
> @:0
>
>
>
>        at com.google.gwt.maps.client.impl.__MarkerImplImpl.construct(Native
> Method)
>
>        at com.google.gwt.maps.client.overlay.Marker.<init>(Marker.java:116)
>
>        at com.timevel.client.timebrowser.TimeBrowserInstance.handleClick
> (TimeBrowserInstance.java:151)
>
>        at com.timevel.client.timebrowser.TimeBrowserInstance.access$0
> (TimeBrowserInstance.java:124)
>
>        at com.timevel.client.timebrowser.TimeBrowserInstance$1.onClick
> (TimeBrowserInstance.java:118)
>
>        at com.google.gwt.maps.client.MapWidget$8.callback(MapWidget.java:
> 418)
>
>        at com.google.gwt.maps.client.impl.EventImpl$OverlayLatLngCallback
> $1.execute(EventImpl.java:193)
>
>        at
> com.google.gwt.maps.client.impl.EventImpl.invokeAndReportUncaughtExceptions
> (EventImpl.java:260)
>
>        at
> com.google.gwt.maps.client.impl.EventImpl.invokeAndMaybeReportUncaughtExceptions
> (EventImpl.java:246)
>
>        at com.google.gwt.maps.client.impl.EventImpl.access$0(EventImpl.java:
> 241)
>
>        at com.google.gwt.maps.client.impl.EventImpl
> $OverlayLatLngCallback.callbackWrapper(EventImpl.java:191)
>
>
>
>
>
> please note that calling sender.getCenter() works just fine as in the
> first example, as in all the smaple provided
>
> with the map GWT package.
>
>
>
> Any comment of what is happening????
>
> >
>



-- 
Eric Z. Ayers - GWT Team - Atlanta, GA USA
http://code.google.com/webtoolkit/

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to