我使用古巴平台版本6.0.8并尝试将地图查看器组件添加到屏幕上,但没有显示。屏幕描述符列示如下:
<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>我跟着这走一步。这些是映射属性:
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这是控制器:
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);什么是问题,或者至少我应该从哪里开始调试它?
发布于 2016-03-26 14:29:14
首先,给出的链接指向手册的5.6版本,如果您使用版本6,请使用适当的文档可以找到这里
关于您面临的问题:这不是Map组件的问题,而是布局问题。未指定Vbox高度,因此将height="100%“添加到vbox应解决以下问题:
<vbox id="mapBox" height="100%">
<chart:mapViewer id="map"
height="100%"
mapType="satellite"
width="100%"></chart:mapViewer>
</vbox>另外,作为一个有用的提示,您可以在运行时分析布局并找出问题所在。要执行此检查,右键单击一个选项卡并按分析布局(见下图)。
分析运行时的布局
因此,如果您在选项卡中分析布局,您将得到以下消息:
[ERROR] Container 'mapBox', nested component 'map'
Nested component has relative height 100.0% inside container with undefined height这清楚地解释了问题的所在。
https://stackoverflow.com/questions/36235917
复制相似问题