Vaadin

Join Vaadin Log In

Vaadin applications in Liferay

Here are my experiences using Vaadin and Liferay together. In the upcoming Liferay 5.3 version there is new stuff coming up. Life of a web application developer will become easier.

Liferay Europe Symposium 2009

Upate 2009-10-16: Presentation slides are now available at liferay.com. Also, you don't need to use the experimental plugin anymore. The Vaadin 6.1.2 and Eclipse plugin 1.0 support all the same stuff (even slightly more easily).  Teemu compiled the getting started guide in Liferay.com wiki: 'Developing Vaadin Applications as Liferay Portlets'.

 

I gave a short live demo of how to write a simple Vaadin application and run that in Liferay as a portlet.

Here is a screencast of that demo. It has been shortened a bit to fit into YouTube limitations. What I made for before starting was:

  • Installed Liferay 5.2.3 (tomcat bundle)
  • Installed Eclipse IDE (JEE version)
  • Installed Vaadin Plugin for Eclipse from http://vaadin.com/eclipse/experimental
  • Installed Standalone Tomcat 6.0
  • Started Liferay

Here is the source code for that sample application:

 package com.example.docbrowser;

import java.io.File;

import com.vaadin.Application;
import com.vaadin.data.util.FilesystemContainer;
import com.vaadin.event.ItemClickEvent;
import com.vaadin.event.ItemClickEvent.ItemClickListener;
import com.vaadin.terminal.FileResource;
import com.vaadin.ui.*;

public class DocbrowserApplication extends Application implements
		ItemClickListener {
	private Table table;

	@Override
	public void init() {
		Window mainWindow = new Window("Docbrowser Application");

		table = new Table("Documents", new FilesystemContainer(
				new File("/book")));
		table.setWidth("100%");
		table.addListener(this);
		mainWindow.addComponent(table);

		setMainWindow(mainWindow);
	}

	public void itemClick(ItemClickEvent event) {
		File f = (File) event.getItemId();

		Embedded e = new Embedded("", new FileResource(f,
				DocbrowserApplication.this));
		e.setType(Embedded.TYPE_BROWSER);
		e.setSizeFull();

		VerticalLayout l = new VerticalLayout();
		l.setSizeFull();
		l.addComponent(e);

		Window w = new Window(f.getName(), l);
		w.center();
		w.setWidth("90%");
		w.setHeight("90%");

		getMainWindow().addWindow(w);

	}
}
 

Vaadin Mail Portlet

Also take a look at the screencast of the Mail Portlet for Liferay 5.3:

To make your 5.2.x Liferay to run Vaadin applications please consult this wiki article about running the Mail Portlet in Liferay. 

 

 

Add Comment Add Comment

Hi, I try that code using liferay 5-2.3, eclipse galileo and vaadin 6.2.7 and wouldn't work. Any sugesstion?

regard's
-d0n0-

Posted on 4/12/10 5:04 AM.

Post Reply Post Reply Top Top
Any more details? Tested with Liferay 5.2.3 and Vaadin 6.3.0 and everything seems to work ok.

Posted on 4/30/10 12:27 PM in reply to Ch. Dono.

Post Reply Post Reply Top Top
Hi, I've tried with Liferay 5.2.3, Vaadin 6.3.4, eclipse galileo but it's unsuccessful.
Portlet is deployed OK, I can add it to portal, but it show nothing inside.
When running standalone, it runs just fine.

Posted on 6/17/10 3:27 PM in reply to Sami Ekblad.

Post Reply Post Reply Top Top
Problem solved after reading this:
http://vaadin.com/wiki/-/wiki/Main/Running%20Vaadin%20Mail%20Portlet%20in%20Liferay%205.2.x

Posted on 6/17/10 3:44 PM in reply to Phu Anh Nguyen.

Post Reply Post Reply Top Top