Loading widget sets, themes, and the Vaadin JAR from a portlet is possible as long as you have a single portlet, but causes a problem if you have multiple portlets. To solve this, Vaadin portlets need to use a globally installed widget set, themes, and Vaadin JAR. They, and all the required configuration, are bundled with Liferay 5.3 and later, but if you are using an earlier version of Liferay or use a custom widget set, custom themes, or a later version of Vaadin, you need to install them in Liferay.
The easiest way to install or upgrade Vaadin or compile the widget set in Liferay is to use the Vaadin Control Panel for Liferay, as described in Section 13.9, “Vaadin Control Panel for Liferay”. If you need to make the installation or compilation manually, read ahead.
In these instructions, we assume that you use Liferay bundled with Apache
Tomcat, although you can use almost any other application server with Liferay
just as well. The Tomcat installation is included in the Liferay installation
package, under the tomcat-x.x.x
directory.
The Vaadin JAR should be put in
tomcat-x.x.x/webapps/ROOT/WEB-INF/lib/vaadin.jar
. The
Vaadin version number should normally be left out from the JAR.
The widget set needs to be located at
/html/VAADIN/widgetsets/
and themes at
/html/VAADIN/themes/
path under the portal context. You
simply need to copy the contents from under your
WebContent/VAADIN
directory to the
tomcat-x.x.x/webapps/ROOT/html/VAADIN
directory under the
Liferay installation directory. If you use a built-in widget set or theme
included in the Vaadin JAR, such as the
PortalDefaultWidgetSet
, you should extract it from the
JAR, from under VAADIN/widgetsets
. The default themes are
located under VAADIN/themes
in the JAR.
You need to define the widget set, the theme, and the JAR in the
portal-ext.properties
configuration file for Liferay, as
described earlier. The file should normally be placed in the Liferay
installation directory. See Liferay documentation for details on the
configuration file.
Below is an example of a portal-ext.properties
file:
# Path under which the VAADIN directory is located. # (/html is the default so it is not needed.) # vaadin.resources.path=/html # Portal-wide widget set vaadin.widgetset=com.vaadin.portal.gwt.PortalDefaultWidgetSet # Theme to use vaadin.theme=reindeer
The allowed parameters are:
vaadin.resources.path
Specifies the resource root path under the portal context. This
is /html
by default. Its actual location depends
on the portal and the application server; in Liferay with Tomcat it
would be located at webapps/ROOT/html
under the
Tomcat installation directory.
vaadin.widgetset
The widget set class to use. Give the full path to the class name in the dot notation. If the parameter is not given, the default widget set is used.
vaadin.theme
Name of the theme to use. If the parameter is not given, the
default theme is used, which is reindeer
in Vaadin
6.
You will need to restart Liferay after creating or modifying the
portal-ext.properties
file.