i use cuba platform version 6.0.8 , trying add map viewer component screen, it's not shown. screen descriptor listed below:
<window xmlns="http://schemas.haulmont.com/cuba/window.xsd"; caption="msg://browsecaption" class="com.mycompany.gui.mapsample.mapscreen" focuscomponent="mapbox" xmlns:chart="http://schemas.haulmont.com/charts/charts.xsd"> <layout margin="true" spacing="true"> <vbox id="mapbox"> <chart:mapviewer id="map" height="100%" width="100%" maptype="satellite"/> </vbox> </layout> </window>
i followed this step. these map properties:
cuba.charts.map.freeapikey = ******************************** cuba.charts.map.clientid = ******************************** cuba.charts.map.defaultzoom = 13.0 cuba.charts.map.defaultlatitude = 51.5001 cuba.charts.map.defaultlongitude = -0.1262
and here's controller:
public class mapscreen extends abstractlookup { @inject private mapviewer map; @override public void init(map<string, object> params) { geopoint center = map.creategeopoint(53.490905, -2.249558); map.setcenter(center);
what can problem or @ least should start debug it?
first, given link points 5.6 version of manuals, if work version 6, please use proper documentation can find here
regarding problem facing: it's not issue of map componet, layout issue. vbox height not specified, adding height="100%" vbox should solve problem:
<vbox id="mapbox" height="100%"> <chart:mapviewer id="map" height="100%" maptype="satellite" width="100%"></chart:mapviewer> </vbox>
also, useful tip, can analyze layout while run time , find out problem is. perform check right click on tab , press analyze layout (see picture below).
so, if analyze layout in tab following message:
[error] container 'mapbox', nested component 'map' nested component has relative height 100.0% inside container undefined height
which explains problem is.
Comments
Post a Comment