Vaadin Newbie attempting to use Add-on

I am experienced in Java, somewhat so in Netbeans, but not in Vaadin. I’m not all that good with Maven either, and don’t know much about ant. I am attempting to use FlexibleOptionGroup, so I have the demo application in a NetBeans maven project.

I managed to alter my pom.xml and add the imports to FlexibleOptionGroupUI.java to leave only one NetBeans error; it appears on the following line:

@VaadinServletConfiguration(productionMode = false, ui = FlexibleOptionGroupUI.class, widgetset = "org.vaadin.hene.flexibleoptiongroup.demo.DemoWidgetSet")

The red line indicating an error starts with "widgetset = " and continues through the path to DemoWidgetSet, and indicates the DemoWidgetSet does not exist.

I don’t know yet why there is a custom widget set for the demo – I thought the add-on would have custom widgets, but don’t understand why the demo does. Nevertheless, I can’t run the demo and see what’s happening without this, and for all I know custom widget sets for demos are common or necessary for Vaadin.

I found instructions for using vaadin add-ons at “https://vaadin.com/directory/help/using-vaadin-add-ons/netbeans”, but am stuck. It says to download the jar for the add-on (which I did through Maven) and I downloaded the 4 files it tells me I need (the jars gwt-user, gwt-dev, validation-api-1.0.0.GA, and validation-api-1.0.0.GA-sources).

The instructions show a small screenshot indicating folder-things under MyVaadinProject which don’t quite match mine – I figure it’s the difference between Vaadin 6 and 7. It’s “Libraries” appears to match my “Dependencies” in having references to a number of jar files. But at this point I’m stuck – the only way to add dependencies to my project is by adding maven parameters (group id, artifact id, version), and the instructions just say “download these jars” and “you must also have the GWT libraries in your classpath for the widget set compilation.”

I don’t know how to put them in a classpath for a maven build. The instructions use “build.xml” and “build-widgetset.xml”, so I gather they’re ant instructions, not maven. Can someone help me 1. understand why I have a widgetset specific to the demo, 2. compile it in my Vaadin v7 project ?

Hi,

For the instructions below I used
NetBeans IDE 8.2 All.

Try installing the
Vaadin Plug-in for Netbeans
and you can create a Vaadin project using the “New Project” wizard. I would suggest using the “Vaadin Web Application Project”.

If what you wish to do is simply use an addon then you would need to do the following :

  1. Go to the addon page and copy the maven element and paste it inside the element in the generated project’s “pom.xml” file. If we use FlexibleOptionGroup as an example that would be :

<dependency> <groupId>org.vaadin.addons</groupId> <artifactId>flexibleoptiongroup</artifactId> <version>2.3.0</version> </dependency> 2. Delete “MyUI” (generated by the wizard) and replace it with the UI of the demo found
here.
Change the package accordingly (com.mycompany.{project_name} is the default generated one, where {project_name} is your project’s name).
3. The widget set is found under src/main/resources in “Other Sources”. For example for the default generated package this is “com.mycompany.{project_name}”. Inside this package you should find a file with the .gwt.xml extension (I get MyAppWidgetSet.gwt.xml).
For the widgetset you would need to set “com.mycompany.{project_name}.MyAppWidgetSet” where project_name is your project name.
If your widgetset has a different name then adjust accordingly.
4. Right click on the project, select Run and in the “Server” select your preferred server (I’m using the bundled 'GlassFish Server 4.1.1). If you have build your project previously this should open a tab in your browser with your application running.

In general for using an add-on all you need with maven is to add the dependency element in your pom.xml and you can use it while developing your Vaadin application (more information on Vaadin development can be found on
the book of Vaadin
) and you don’t have to worry about the widgetset, the maven plugin and the IDE integration should handle this for you.

Let me know if this solves your issue!