From: Jon B. <jon...@go...> - 2010-12-10 19:22:32
|
I've got this same issue. I get 100% width, but it only allows me.to set a fixed height, otherwise it ends up 0 pixels. Jon On 10 Dec 2010 16:39, "Edwin Commandeur" <com...@gm...> wrote: > Hi Piotr, > > Have you tried initiating the MapWidget like this: > > mapWidget = new MapWidget("100%", "100%", mapOptions); > > I haven't checked the SmartGWT forums, but I'd be happy to know if a > SmartGWT user has a fix for this particular problem. When you use > SmartGWT then SmartGWT will be in charge of resizing, as not all > browsers throw resize events for div's. For GWT-OL it is better not to > know about SmartGWT's resizing, but to get told the new size upon a > SmartGWT event that triggers a resize. > > Greetings, > Edwin > > On 8 December 2010 19:22, Piotr Tracz <pi...@cg...> wrote: >> Hello, >> >> I recently changed QxWT to SmartGWT and started to play with it. >> Unfortunately there is pretty big problem with rescaling OL-GWT widget >> in SmartGWT layout's. Problem seems to be nothing really new as some >> people are complain about that on SmartGWT's forum (unfortunately it >> seems to be ignored). >> >> >> Some code snippets: >> >> public class OLMapWidget extends Layout >> { >> final public MapWidget mapWidget; >> final MapOptions mapOptions; >> final WMSParams mapWMSParams; >> >> public OLMapWidget() >> { >> >> mapWMSParams = new WMSParams(); >> mapOptions = new MapOptions(); >> mapOptions.setNumZoomLevels(16); >> mapOptions.setProjection("EPSG:4326"); >> mapWidget = new MapWidget("1600", "1080", mapOptions); >> >> mapWMSParams.setFormat("image/png"); >> mapWMSParams.setLayers("basic"); >> mapWMSParams.setStyles(""); >> >> WMSOptions wmsLayerParams = new WMSOptions(); >> wmsLayerParams.setTransitionEffect(TransitionEffect.RESIZE); >> >> WMS wmsLayer; >> >> wmsLayer = new WMS( >> "Basic WMS", >> "http://labs.metacarta.com/wms/vmap0", >> mapWMSParams, >> wmsLayerParams); >> >> mapWidget.getMap().addLayers(new Layer[] {wmsLayer}); >> mapWidget.getMap().setCenter(new LonLat(0, 0), 5); >> >> >> setWidth100(); >> setHeight100(); >> setAlign(Alignment.CENTER); >> setOverflow(Overflow.HIDDEN); >> setShowResizeBar(true); >> >> >> this.addChild(mapWidget); >> >> Scheduler.get().scheduleDeferred(new Command() >> { >> @Override >> public void execute() >> { >> /* >> String mapHeight = getParentElement().getHeightAsString(); >> String mapWidth = getParentElement().getWidthAsString(); >> >> mapWidget.setHeight(mapHeight); >> mapWidget.setWidth(mapWidth); >> */ >> >> mapWidget.setHeight(getHeightAsString()); >> mapWidget.setWidth(getWidthAsString()); >> >> mapWidget.getMap().updateSize(); >> } >> }); >> >> >> this.addResizedHandler( new ResizedHandler() >> { >> public void onResized( ResizedEvent event ) >> { >> //mapWidget.setHeight(Integer.toString(getInnerHeight())); >> //mapWidget.setWidth(Integer.toString(getInnerWidth())); >> mapWidget.setWidth(getWidthAsString()); >> mapWidget.setHeight(getHeightAsString()); >> mapWidget.getMap().updateSize(); >> } >> } ) ; >> } >> } >> >> public class Application implements EntryPoint { >> >> public void onModuleLoad() { >> >> >> VLayout mainLayout = new VLayout(); >> mainLayout.setWidth100(); >> mainLayout.setHeight100(); >> mainLayout.addMember(ViewHelper.createToolBar()); >> >> HLayout layout1 = new HLayout(); >> layout1.setWidth100(); >> layout1.addMember(ViewHelper.createLayerPanel()); >> final VLayout layout2 = new VLayout(); >> layout2.setHeight100(); >> layout2.setOverflow(Overflow.HIDDEN); >> layout2.addMember (new OLMapWidget()); >> >> >> >> >> >> >> layout2.addMember(ViewHelper.createTablePanel()); >> layout1.addMember(layout2); >> mainLayout.addMember(layout1); >> // >> mainLayout.addMember(ViewHelper.createStatusBar()); >> mainLayout.draw(); >> } >> >> >> } >> >> All is working ok unless browser windows is started as small and then >> expanded to bigger size - in that case OL-GWT widget size is always the >> same small. >> I guess its SmartGWT problem and the easiest way is saying bye bye to >> SmartGWT but maybe someone have some hack to override this problem (I >> know I can use ugly hack to manually change size of DIV but that doesnt >> look like good solution). >> >> /Peter >> >> >> >> >> >> ------------------------------------------------------------------------------ >> This SF Dev2Dev email is sponsored by: >> >> WikiLeaks The End of the Free Internet >> http://p.sf.net/sfu/therealnews-com >> _______________________________________________ >> Gwt-openlayers-users mailing list >> Gwt...@li... >> https://lists.sourceforge.net/lists/listinfo/gwt-openlayers-users >> > > ------------------------------------------------------------------------------ > Oracle to DB2 Conversion Guide: Learn learn about native support for PL/SQL, > new data types, scalar functions, improved concurrency, built-in packages, > OCI, SQL*Plus, data movement tools, best practices and more. > http://p.sf.net/sfu/oracle-sfdev2dev > _______________________________________________ > Gwt-openlayers-users mailing list > Gwt...@li... > https://lists.sourceforge.net/lists/listinfo/gwt-openlayers-users |