gwarzocha / gwt-google-apis

Automatically exported from code.google.com/p/gwt-google-apis
0 stars 0 forks source link

MapWidget does show correctly in a GWT-Ext panel #127

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
- Found in Release:

every release I tried (1.0, and milestone r290)

- Detailed description: 

When you add a MapWidget to a com.gwtext.client.widgets.Panel, the map
seems to the minimal size (default behaviour, ok), and a big grey area that
take almost the half of the map.

this works fine:
public void onModuleLoad() {
    RootPanel.get().add(map);
}

this generate the problem:
public void onModuleLoad() {
    Panel panel = new Panel();
    panel.add(map);
    RootPanel.get().add(panel);
}

It's very weird because MapWidget works fine in a
com.google.gwt.user.client.ui.HorizontalPanel

Every other widget of GWT works fine in a com.gwtext.client.widgets.Panel,
so I take my chance on filling a issue here

Original issue reported on code.google.com by mehdi.ra...@gmail.com on 6 Jun 2008 at 5:01

GoogleCodeExporter commented 9 years ago
Is this the same problem noted as issue 49 (maps start off at 0px in size.)  I 
wonder
if you'll see better results if you add the call:

map.setSize("100%","100%");
or
map.setSize("500px","300px");

or something else.

Original comment by galgwt.reviews@gmail.com on 6 Jun 2008 at 5:39

GoogleCodeExporter commented 9 years ago
Hi, thanks for you reply,

No, I forgot to say that but if you assign it a size, the map size ok but it 
have a
big gray area that take almost the half of the map (in the bottom right corner).

If you have GWT-Ext installed please try it, you'll see what I'm talking about.

I tried every possible configuration before posting this issue.

Original comment by mehdi.ra...@gmail.com on 6 Jun 2008 at 6:53

GoogleCodeExporter commented 9 years ago

Original comment by galgwt.reviews@gmail.com on 6 Jun 2008 at 7:05

GoogleCodeExporter commented 9 years ago
What I see here is a blank map tile.  The map is supposed to be centered on the
equator & 0' longitude, but instead, it seems to think that the center of the 
map is
the upper left corner.  As you move it, the Maps api usually brings tiles in
"offscreen", but you can see them added and clipped if you run the gwt-ext 
version.

I think this is a layout issue with either ext or gwtext (a wild guess is that
someone is using a negative value for x & y positioning in CSS).  The way to 
tell the
difference is to try to reproduce the problem with plain JavaScript and 
eliminate
GWT, gwt-google-apis, and gwt-ext entirely from the picture.  If you can 
reproduce it
with just JavaScript, then its likely a problem with the ext library 
interacting with
the Google Maps library.  If you can't reproduce it, its most likely an issue 
with
gwt-ext, so bring the issue to the support forums on http://www.gwt-ext.com/.

I will leave this issue open - please report back what you find.

GWT 1.5RC1
ext 2.02
gwtext build from 20080529
gwt-google-apis r311

package com.example.gwt.maps.gwtext.client;

import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.maps.client.MapWidget;
import com.google.gwt.maps.client.geom.LatLng;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.RootPanel;

import com.gwtext.client.widgets.Panel;

/**
 * Entry point classes define <code>onModuleLoad()</code>.
 */
public class TestGwtExtMaps implements EntryPoint {

  /**
   * This is the entry point method.
   */
  public void onModuleLoad() {
    onModuleLoadExt();
  }

  public void onModuleLoadBasic() {
    MapWidget map = new MapWidget();
    map.setSize("500px", "500px");
    RootPanel.get().add(map);
   }

  public void onModuleLoadGwtWidgets() {
    MapWidget map = new MapWidget();
    map.setSize("500px", "500px");
    HorizontalPanel panel = new HorizontalPanel();
    panel.add(map);
    RootPanel.get().add(panel);
   }

  public void onModuleLoadExt(){
    MapWidget map = new MapWidget();
    map.setSize("500px", "500px");
    Panel panel = new Panel();
    panel.add(map);
    RootPanel.get().add(panel);
    map.setCenter(new LatLng(0.0,0.0));
  }
}

Original comment by galgwt.reviews@gmail.com on 6 Jun 2008 at 8:57

Attachments:

GoogleCodeExporter commented 9 years ago
Well I completely stopped using GWT-Ext, so I guess you won't have anymore 
feedback
from me. I wanted to let you know in case you want to close issue.

Original comment by mehdi.ra...@gmail.com on 13 Jul 2008 at 10:15

GoogleCodeExporter commented 9 years ago

Original comment by galgwt.reviews@gmail.com on 14 Jul 2008 at 1:08

GoogleCodeExporter commented 9 years ago
From Guillem:  
http://groups.google.com/group/Google-Web-Toolkit/browse_thread/thread/657ed9bb2
e2e9011/794322db35f85adc?lnk=gst&q=Guillem#794322db35f85adc

In my app, I add MapWidgets at runtime, all with setVisible(false).
By clicking on a link, you can show or hide any of the MapWidgets, but
all
MapWidgets added this way were having the same problem you report.
What I did to fix this is to add a checkResize() call after
setVisible(true).
This solved the problem.

Example:

final MapWidget map = new MapWidget();
map.setVisible(false);

Button b = new Button("Show", new ClickListener(){
     public void onClick(Widget arg0) {
           map.setVisible(true);
           map.checkResize();
     }
});

RootPanel.get().add(map);
RootPanel.get().add(b);
Hope this helps.

Original comment by galgwt.reviews@gmail.com on 28 Jul 2008 at 12:10

GoogleCodeExporter commented 9 years ago
Hi,

not sure if this issue was ever taken further.  But i found another post which 
dealt
with the same issue and it helped me solve the same problem(discussed in the 
forum) I
had.

Please refer to to http://code.google.com/p/gwt-google-apis/issues/detail?id=223

Original comment by ksprave...@gmail.com on 23 Feb 2009 at 8:56

GoogleCodeExporter commented 9 years ago
The problem is not isolated to gwt ext although I also saw it with gwt ext. 

I have same problem using gwt query where I initialise the map widget, append() 
it to
a div and the map center is in top left corner of view pane and RHS or map is 
grey.
in other words center is miscalculated.

Related issue posted by  kspraveenk fixed my problem: call 
map.checkResizeAndCenter()
after appending to dom.

Original comment by jolyonbl...@yahoo.com.au on 11 Aug 2009 at 1:00

GoogleCodeExporter commented 9 years ago
I have a problem specific to the decoratedTabPanel. When I add a map (contained 
in a simple panel) to the tab panel, the RHS of the map is grey. However if the 
map is placed outside the tab panel, the whole map is visible.

I have tried the map.checkResizAndCenter() method and have tried setting 
different sizes. None of the above fix the problems.

Original comment by racbha...@gmail.com on 19 Jan 2011 at 4:04

GoogleCodeExporter commented 9 years ago
This is happening because the map doesn't size itself correctly when it isn't 
attached to the DOM.  Try using a ScheduledCommand to call 
checkResizeAndCenter() and also add the call after the tab is selected.  

Original comment by zundel@google.com on 19 Jan 2011 at 4:00

GoogleCodeExporter commented 9 years ago
Hi,

Thanks #7 galgwt.reviews@gmail.com
public void onClick(Widget arg0) {
           map.setVisible(true);
           map.checkResize();
     }

In the lib I use (https://github.com/branflake2267/GWT-Maps-V3-Api) the method 
name is mapWidget.triggerResize()

  {
    ...
    mapControllerPanel.setVisible(visible);
    if (visible)
     mapWidget.triggerResize();
  } 

Original comment by zHa...@gmail.com on 31 Oct 2013 at 11:29