Migration from 5.3.1 to 6.0.0

Hi everyone,


The release notes
summarize the process very nicely, but these are my notes along the way of upgrading the
TubeTunes application
from IT Mill Toolkit 5.3.1 to Vaadin 6.0.0.

You can consider this as a short version of migration process for any standalone IT Mill Toolkit 5.3/5.4 application that makes a heavy use of CSS themes and widgets.


The main (server-side) application upgrade process:

  • Find and replace imports “com.itmill.toolkit.” to “com.vaadin.” in all application Java files

  • Remember to update web.xml servlet class from “com.itmill.toolkit.terminal.gwt.server.ApplicationServlet” to “com.vaadin.terminal.gwt.server.ApplicationServlet”.

  • If using security manager when running the application, update the permissions in policy file using the same renaming scheme: from “com.itmill.toolkit.” to “com.vaadin.”

Done with the main application!

[b]
For client-side widgets and CSS themes (which this application uses a lot) you need to consider the following:

[/b]

  • Rename the theme and widgetset resource folder from “WebContent/ITMILL” folder to “WebContent/VAADIN”.

  • The old CSS theme has been renamed to “runo”: Update your theme CSS import: from “@import url(…/default/styles.css);” to @import url(…/runo/styles.css);"

  • Update gwt.xml to inherit the right widgetset:
    “com.itmill.toolkit.terminal.gwt.DefaultWidgetSet” should be changed to “com.vaadin.terminal.gwt.DefaultWidgetSet”

  • Optional: Rename (refactor) client widget classes from “I*” to “V*” in client. If using JSNI functions, make sure the they are updated also. I think this is not required, but as the library itself uses this naming scheme I’d recommend it.


The compile-widgetsets.xml Ant file needed some changes:

  • Use vaadin-6-0-0.jar instead of itmill-toolkit-5.3.1.jar

  • The GWT compiler class has changed from “com.google.gwt.dev.GWTCompiler” to “com.google.gwt.dev.Compiler”. The old one seems to work, but gives you a warning.

  • Also change the compile target directory to “WebContent/VAADIN/widgetsets”

  • Use the GWT version 1.6.4. that comes with the package. Older one will not work.
    “com.vaadin.terminal.gwt.DefaultWidgetSet”

Compile the widgetsets, refresh and try it. You’ll probably notice some small changes that still need to be taken care of, but most of your work is done.

Bottom line: Refactoring of Java code is very easy. Minimal amount of XML configuration files means less migration trouble.

See also
Upgrading between major versions a minor task
blog post.

I think the only thing (for me) missing from release notes was the fact that ApplicationConnection.translateToolkitUri method should be renamed to translateVaadinUri. Also, few type changes in otherwise stable API but these were trivial to figure out.

Happy Midsummer’s day for all Vaadin users, Jani.

Hi all,
Something you should also consider is a subtle change in the application’s lifecycle.
WebApplicationContext is not accessible during the init() method.
A log is better than a thousand words -_-


        WebBrowser browser = ((WebApplicationContext) getContext()).getBrowser();
        System.out.println("INIT - Locale: " + browser.getLocale());
        System.out.println("INIT - Address: " + browser.getAddress());
        System.out.println("INIT - User Browser: " + browser.getBrowserApplication());

        Button testButton = new Button("TEST ME");
        testButton.addListener(new Button.ClickListener()
        {
            public void buttonClick(ClickEvent event)
            {
                WebBrowser browser = ((WebApplicationContext) getContext()).getBrowser();
                System.out.println("Locale: " + browser.getLocale());
                System.out.println("Address: " + browser.getAddress());
                System.out.println("User Browser: " + browser.getBrowserApplication());
            }
        });

Running with Vaadin:

Vaadin is running in DEBUG MODE.
Add productionMode=true to web.xml to disable debug features.
To show debug window, add ?debug to your application URL.

16:00:40,568 INFO [STDOUT]
INIT - Locale: null
16:00:40,572 INFO [STDOUT]
INIT - Address: null
16:00:40,572 INFO [STDOUT]
INIT - User Browser: null
16:00:46,357 INFO [STDOUT]
BUTTON LISTENER - Locale: en_AU
16:00:46,357 INFO [STDOUT]
BUTTON LISTENER - Address: 127.0.0.1
16:00:46,357 INFO [STDOUT]
BUTTON LISTENER - User Browser: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.10) Gecko

Running with ITMill:

IT Mill Toolkit is running in DEBUG MODE.
Add productionMode=true to web.xml to disable debug features.
To show debug window, add ?debug to your application URL.

16:08:41,412 INFO [STDOUT]
INIT - Locale: en_AU
16:08:41,412 INFO [STDOUT]
INIT - Address: 127.0.0.1
16:08:41,412 INFO [STDOUT]
INIT - User Browser: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.10) Gecko
16:09:21,714 INFO [STDOUT]
BUTTON LISTENER - Locale: en_AU
16:09:21,715 INFO [STDOUT]
BUTTON LISTENER - Address: 127.0.0.1
16:09:21,715 INFO [STDOUT]
BUTTON LISTENER - User Browser: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.10) Gecko

This really sounds like a regression - not intentional change.

Thanks for pointing it out!

Created a ticket: http://dev.vaadin.com/ticket/3181

Thanks for creating the ticket and, of course, being so quick.