java - 如何将 vaadin 7 与 Google map 连接

标签 java google-maps vaadin

我使用 com.vaadin.tapio.googlemaps.GoogleMap 组件从 vaadin 连接 Google map 。

我尝试了下面的代码。(Vaadin 7.0.2)

public class StoresMainView extends VerticalLayout implements View {

    @Override
    public void enter(ViewChangeEvent event) {
        setSizeFull();


        GoogleMap googleMap = new GoogleMap(new LatLon(-27.47101, 153.02429), 10.0, "");
        googleMap.setSizeFull();
        googleMap.setImmediate(true);
        googleMap.setMinZoom(4.0);
        addComponent(googleMap);


    }

但是运行时出现以下错误。我在我的pom中添加了依赖项。

Widgetset does not contain implementation for com.vaadin.tapio.googlemaps.GoogleMap. Check its component connector's @Connect mapping, widgetsets GWT module description file and re-compile your widgetset. In case you have downloaded a vaadin add-on package, you might want to refer to add-on instructions.

在我的 web.xml 中,我定义了如下的 Widget 集

 <init-param>
        <param-name>widgetset</param-name>
        <param-value>com.client.DashboardWidgetSet</param-value>
    </init-param>

我的 DashboardWidgetSet 如下

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 1.7.0//EN" "http://google-web-toolkit.googlecode.com/svn/tags/1.7.0/distro-source/core/src/gwt-module.dtd">
<module>
    <inherits name="com.vaadin.DefaultWidgetSet" />

    <inherits name="org.vaadin.cssinject.Cssinject_addonWidgetset" />
    <!--  -->

    <set-configuration-property name="devModeRedirectEnabled"
        value="true" />

    <!-- Uncomment the following to compile the widgetset for one browser only. 
        This can reduce the GWT compilation time significantly when debugging. The 
        line should be commented out before deployment to production environments. 
        Multiple browsers can be specified for GWT 1.7 as a comma separated list. 
        The supported user agents at the moment of writing were: ie6,ie8,gecko,gecko1_8,safari,opera 
        The value gecko1_8 is used for Firefox 3 and later and safari is used for 
        webkit based browsers including Google Chrome. -->
    <!-- <set-property name="user.agent" value="safari"/> -->

    <!-- WidgetSetOptimizer -->

    <inherits name="org.vaadin.easyuploads.Widgetset" />

    <inherits name="com.vaadin.tapio.googlemaps.WidgetSet" />

</module>

非常感谢任何帮助。

最佳答案

您需要确保 web.xml 中的 widgetset init-param 指向正确的 widgetset。默认值不包含有关 Google map 组件小部件的任何信息。

关于java - 如何将 vaadin 7 与 Google map 连接,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19223722/

相关文章:

java - 如何在选择模式下使用多个ID "Property"

java - 为什么变量 x 不采用我给出的值,并且当传递给其他类时变得与变量 in 相等?

javascript - 从 php Controller 动态添加标记

java - Tomcat 耗尽虚拟机内存

php - 随机生成圆内坐标

Android - 从 SupportMapFragment 中的 Google map 中删除流量

java - 将数组中的 BeanItemContainer 绑定(bind)到表

Vaadin @JavaScript 适用于不同的构建

java - 变量不会从 JTextField 获取数据

java - Idea 在生成的源代码中报告了许多错误