Using Vaadin Add-ons in NetBeans

Hi,

as you probably know the
Vaadin Directory
is full of useful add-ons for Vaadin. Most add-ons require the client-side code to be compiled into JavaScript files via the GWT compiler. Eclipse plugin does this automatically but for people who like to use NetBeans IDE there weren’t any decent instructions.

I tried to fill this gap by writing a step-by-step tutorial on how to setup an Ant script for your project to compile a widget set for your Vaadin application. With these instructions it should be quite straightforward to use any add-ons inside NetBeans.


Using Add-on in NetBeans

If you have any questions or comments, please don’t hesitate to post them to this thread.

Yaay! Finally I don’t need anymore to contemplate that
über-ugly Eclipse
. :slight_smile: I am still perplexed why Vaadin’s bright minds started messing around with Eclipse, but that’s probably will be never answered…

Anyway, your tutor forced me to try add-ons again with a little hope they probably will work and… boom! it made finally possible add-on running on my GlassFish/Liferay installation, since video tutorial & all the Eclipse magic behind just
went wacky and never worked properly
for me.

However, I think you should add portlet handling to the documentation a little bit, something like:

Also, probably you should change

<property name="widgetset" value="com.example.myapp.widgetset.MyAppWidgetSet"/> …to:

<property name="widgetset" value="com.tehapo.gwt.MyApplicationWidgetSet"/> in the original
build-widgetset.xml
, well or change in your doc to “com.example…”. It is just in order to be more clear that these should have the same name — well, to avoid forums traffic, because probably people will just literally copy-paste and it won’t work for them of course… :slight_smile:

Thanks a lot!

Thanks for your comments! You made some very good points. Using the widget set in a portal environment should definitely be mentioned in the tutorial. And perhaps it would be more clear to use com.example.* everywhere. :slight_smile:

I’ll edit the tutorial later today to include these changes.

I am probably one to blame :slight_smile: (as usual). In 2001 we were 100% Netbeans based company. In the beginning of 2002 we quickly adopted Eclipse for two reasons: UI was a lot faster and transparent compilation while editing code made the development so much less painful…

Oh, now we see where is the root of all evil!.. :grin: And you, guys, still thinking like this at your company? Yes, NetBeans
was
slow as hell before 6.0, but not anymore. And as of code editing seems like NB is much more intuitive and sophisticated. You, guys, don’t think so?

As far as we talk here with Oracle guys, seems like Oracle will push NetBeans as flagship IDE for new stuff (JavaFX, GUI, Web etc) and Eclipse remains to be praised a lot, but way not because it is so cool-and-great, but Oracle just have a huge cluster of corporate users with Oracle proprietary stuff for their DB — that’s why Eclipse will be around for a long while. I would agree that NetBeans the only thing now misses that it does not have such massive refactoring tools for projects being done in stone-age era with 1.4 and older Java versions. But do we really need that?

So your
atonement for this awful deadly sin
:grin: is now to
quickly make things back
by adding full functionality of Vaadin to the
http://vaadin.com/netbeans
plugin! :grin:

Take care.

While it is very hard to find reliable recent surveys, Eclipse does still have a bigger market share among developers than NetBeans - although NetBeans has been catching up quickly since 6.0. It looks like the two together have a market share of almost 90% of Java IDEs.

I am an Eclipse user, but if someone does start to develop the NetBeans plugin, I can provide support in getting widgetset compilation and other key features to work from the Vaadin point of view. The plugin should be much simpler to implement than the Eclipse plugin as it can drop support for old versions of Vaadin and IT Mill toolkit etc.

You probably getting
a free milk
from the company to withstand this mortal torture… :smug:

hi, thanks for this thread anyway i’m new to vaadin. i have question… i want to add multiple widget in my vaadin project using netbeans…
after compilation, i put this code in web.xml

… but an error occured

please help. what should i do to use multiple widget… Thanks before

[quote=Boy Gorby ST]
hi, thanks for this thread anyway i’m new to vaadin. i have question… i want to add multiple widget in my vaadin project using netbeans…
after compilation, i put this code in web.xml

… but an error occured

Old question that just keeps popping up again and again… An application cannot use multiple widgetsets at a time - the reasons are quite technical and relate to how GWT works, and there should be explanations about that available.

As explained in the book
here
and
in the chapter about creating custom widgets
as well as elsewhere, you need to create your own widgetset in your project and import/inherit the widgetsets (widgetset fragments) of the add-ons. Then, you need to compile your own widgetset.

At the moment, GWT architecture does not permit circumventing this without incurring very significant additional overhead and complexity.

Thanks Teemu for that great post, it is really helpful.

Although, the post has a minor issue. It provides a link to an older version of GWT, so if you follow those instructions step by step with the latest versions of vaadin, it will not compile, producing some errors. Here is one
example
of those errors.

You can solve this problem by using the same GWT files included in the vaadin installation package, under the gwt folder.

Can you please edit the post so that everyone knows about this? thanks!

Hi Sebastian,

thank you for your feedback. I’ll open up the post later today and edit your corrections in.

I’m having issues with recent versions of Vaadin (i.e. 6.7.1) and its respective gwt libraries:

Oct 31, 2011 12:38:24 PM com.vaadin.terminal.gwt.widgetsetutils.ClassPathExplorer getAvailableWidgetSets
INFO: Widgetsets found from classpath:
	org.vaadin.teemu.wizards.WizardsforvaadinWidgetset in jar:file:Z:/NetBeans/Xinco/3.00.xx/XincoLibs/Vaadin Addons/wizards-for-vaadin-0.4.0.jar!/
	com.vaadin.terminal.gwt.DefaultWidgetSet in jar:file:Z:/NetBeans/Xinco/3.00.xx/XincoLibs/vaadin-6.7.1.jar!/
	org.vaadin.easyuploads.EasyuploadsWidgetset in jar:file:Z:/NetBeans/Xinco/3.00.xx/XincoLibs/Vaadin Addons/easyuploads-0.4.9.jar!/
	org.vaadin.peter.contextmenu.ContextmenuWidgetset in jar:file:Z:/NetBeans/Xinco/3.00.xx/XincoLibs/Vaadin Addons/ContextMenu3.1.0.jar!/

Oct 31, 2011 12:38:26 PM com.vaadin.terminal.gwt.widgetsetutils.ClassPathExplorer getAvailableWidgetSets
INFO: Search took 17ms
Exception in thread "main" java.io.IOException: The filename, directory name, or volume label syntax is incorrect
	at java.io.WinNTFileSystem.canonicalize0(Native Method)
	at java.io.Win32FileSystem.canonicalize(Win32FileSystem.java:414)
	at java.io.File.getCanonicalPath(File.java:589)
	at com.vaadin.terminal.gwt.widgetsetutils.WidgetSetBuilder.updateWidgetSet(WidgetSetBuilder.java:79)
	at com.vaadin.terminal.gwt.widgetsetutils.WidgetSetBuilder.main(WidgetSetBuilder.java:52)
Z:\NetBeans\Xinco\3.00.xx\XincoWebApp\build-widgetset.xml:51: Java returned: 1

Looks like is having issues opening jar files. Any ideas?

I managed to get a little bit further by exploding the jar files and using that, but still get errors. See the full issue
here
.

Issue fixed with release of 6.7.2

But now, I receive this error:


[info]
 Updating GWT module description file...
[info]
 Widgetset compilation finished
[error]
 Nov 29, 2011 5:08:37 PM com.vaadin.terminal.gwt.widgetsetutils.ClassPathExplorer getAvailableWidgetSets
[error]
 Informaþ§es: Widgetsets found from classpath:
[error]
         com.vaadin.terminal.gwt.DefaultWidgetSet in jar:file:E:/Projetos/smarthome/view/lib/vaadin-6.7.2.jar!/
[error]
         com.invient.vaadin.charts.widgetset.InvientChartsWidgetset in jar:file:E:/Projetos/smarthome/view/lib_managed/scala_2.9.0-1/compile/invient-charts-0.8.5.jar!/
[error]

[error]
 Nov 29, 2011 5:08:37 PM com.vaadin.terminal.gwt.widgetsetutils.ClassPathExplorer getAvailableWidgetSets
[error]
 Informaþ§es: Search took 10ms
[error]
 Nov 29, 2011 5:08:37 PM com.vaadin.tools.WidgetsetCompiler$1 run
[error]
 Grave: Widgetset compilation failed
[error]
 java.io.IOException: Could not create directory for the widgetset: file:E:\Projetos\smarthome\view\lib\vaadin-6.7.2.jar!\com\vaadin\terminal\gwt
[error]
         at com.vaadin.terminal.gwt.widgetsetutils.WidgetSetBuilder.updateWidgetSet(WidgetSetBuilder.java:79)
[error]
         at com.vaadin.tools.WidgetsetCompiler$1.run(WidgetsetCompiler.java:76)
[error]
         at java.lang.Thread.run(Unknown Source)
[error]

Any ideas?

A wild guess, you have decided to name your widget set DefaultWidgetSet, which collides with the real DefaultWidgetSet in the Vaadin jar. As a result the compiler will try to put the output inside the Vaadin jar.

i have some questions
in step two , is these two lines depends on something except of the package name ?

in the compilation step (3)

i got some an error , Unable to find type ‘com.vaadin.terminal.gwt.client.DefaultWidgetSet’

Solved , the problem was in my vaadin version
it was 6.2.3
newer one solved the problem , 6.7.X