bwalsh
December 6, 2008, 8:12am
1
I can create a google sample map with in the <body/>
However, if I try to create it within a smartgwt layout, the map flickers and then clears …
from sample layout … (slightly modified)
// create right panel
HLayout hLayout = new HLayout();
hLayout.addMember(new BlueBox(50, (Integer) null, "width 50"));
// Add the map to the HTML host page
hLayout.addMember(getMap()) ;
I tried your sample and it works. I don’t see any flicker
/**
* This is the entry point method.
*/
public void onModuleLoad() {
RootPanel.get().add(getViewPanel());
}
private MapWidget getMap() {
MapWidget map = new MapWidget();
map.setSize("500px", "300px");
return map;
}
public Canvas getViewPanel() {
HLayout hLayout = new HLayout(5);
hLayout.addMember(new BlueBox(50, 300, "width 50"));
// Add the map to the HTML host page
hLayout.addMember(getMap());
return hLayout;
}
class BlueBox extends Label {
public BlueBox(String contents) {
setAlign(Alignment.CENTER);
setBorder("1px solid #808080");
setBackgroundColor("lightblue");
setContents(contents);
}
public BlueBox(Integer width, Integer height, String contents) {
this(contents);
if (width != null)
setWidth(width);
if (height != null)
setHeight(height);
}
public BlueBox(Integer width, String height, String contents) {
this(contents);
if (width != null)
setWidth(width);
if (height != null)
setHeight(height);
}
public BlueBox(String width, String height, String contents) {
this(contents);
if (width != null)
setWidth(width);
if (height != null)
setHeight(height);
}
}