VisualizationsForVaadin setup with maven

I have added the VisualizationsForVaadin Addon to our project. Unfortanetely this took me two days until it worked properly.
To prevent others from that trouble I will post my configuration.

First of all I created a new widgetset.gwt.xml


    <?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.terminal.gwt.DefaultWidgetSet"/>
    <inherits name="org.vaadin.vaadinvisualizations.widgetset.VaadinvisualizationApplicationWidgetset"/>

</module>

In my maven pom I have added the following build plugin configuration


<build>
        <plugins>
            <plugin>
                <!--Das GWT Plugin compiliert die zusätlich hinzugefügten Widgets
                von Java nach Javascript -->
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>gwt-maven-plugin</artifactId>
                <version>2.2.0</version>
                <configuration>
                    <webappDirectory>${project.build.directory}/${project.build.finalName}/VAADIN/widgetsets</webappDirectory>
                    <extraJvmArgs>-Xmx512M -Xss1024k</extraJvmArgs>
                    <force>true</force>
                </configuration>
                <executions>
                    <execution>
                        <phase>generate-resources</phase>
                        <goals>
                            <!--suppress MavenModelInspection -->
                            <goal>resources</goal>
                            <!--suppress MavenModelInspection -->
                            <goal>compile</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>com.vaadin</groupId>
                <artifactId>vaadin-maven-plugin</artifactId>
                <version>1.0.2</version>
                <configuration>
                </configuration>
                <executions>
                    <execution>
                        <phase>generate-resources</phase>
                        <goals>
                            <goal>update-widgetset</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-war-plugin</artifactId>
                <version>2.2</version>
            </plugin>
        </plugins>
    </build>

At first my widgetset was not compiled correctly. It is already mentioned in the forum, that this is a dependency issue.
I couldn’t find the required gwt-visulization version in any repository so I downloaded the jar and uploaded in manually into our local nexus.

These are my dependencies:


<dependency>
            <groupId>com.vaadin</groupId>
            <artifactId>vaadin</artifactId>
            <version>6.8.1</version>
        </dependency>

        <dependency>
            <groupId>com.google.gwt</groupId>
            <artifactId>gwt-user</artifactId>
            <version>2.2.0</version>
        </dependency>

        <dependency>
            <groupId>org.vaadin.addons</groupId>
            <artifactId>visualizationsforvaadin</artifactId>
            <version>1.1.2</version>
        </dependency>

        <dependency>
            <groupId>com.google.gwt</groupId>
            <artifactId>gwt-visualization</artifactId>
            <version>1.1.2</version>
        </dependency>

I started the application and I had no errors at all. But the chart wasn’t showing up.
It is only displayed after refreshing from the client side, e.g. by resizing my browser.

I needed to setup the Size of the component and also the Size of the Chart within the component


        // Example from the demo 
        ColumnChart chart = new ColumnChart();
        chart.setOption( "is3D", true );
        chart.setOption( "isStacked", true );

        chart.addXAxisLabel( "Year" );
        chart.addColumn( "Expenses" );
        chart.addColumn( "Sales" );
        chart.addColumn( "Stock" );
        // Values in double are Expenses, Sales, Stock
        chart.add( "2004", new double[]{ 100, 200, 320 } );
        chart.add( "2005", new double[]{ 75, 100, 250 } );
        chart.add( "2006", new double[]{ 32, 234, 75 } );
        chart.add( "2007", new double[]{ 25, 253, 4 } );
        chart.add( "2008", new double[]{ 343, 12, 260 } );

        //You need to set the size!
        chart.setHeight( 400, Sizeable.UNITS_PIXELS );
        chart.setWidth( 400, Sizeable.UNITS_PIXELS );
        chart.setOption( "width", 400 );
        chart.setOption( "height", 400 );

        return chart;

If someone has a better solution for the refreshing problem, let me know!