Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Ivano Carrara
Liferay ServiceBuilder and Vaadin
November 10, 2011 9:56 AM
Answer

Ivano Carrara

Rank: Regular Member

Posts: 228

Join Date: July 2, 2005

Recent Posts

Hi all!

Please, I'm looking for a basic example to use Liferay ServiceBuilder entities as datasources for Vaadin widgets...

A basic example can be how to populate a Vaadin Table with a List of records returned by Liferay SearchContainer.

Anyone can help me?

Thank you in advance!

Ivano C.
Jack Bakker
RE: Liferay ServiceBuilder and Vaadin
November 10, 2011 10:28 AM
Answer

Jack Bakker

Rank: Liferay Master

Posts: 614

Join Date: January 3, 2010

Recent Posts

with introduction of Vaadin I am seeing questions raised wrt how to shift from habitual use of that available ... (an architectural adjustment...)

context of my above comment is that with Vaadin, developers concern themselves with almost 99% pure java coding : *LocalServiceUtil can be called just like it is from any portlet (VaadinApplication or MVCPortlet or...)

so building from servicebuilder generated util easy enough from Vaadin portlet (this addresses your first question without example)

--

as for your second: leveraging already in place searchContainer from pure server-side (not via aui/etc.) needs a better review (a.k.a. I don't know.. currently)
GERALD ROMERO
RE: Liferay ServiceBuilder and Vaadin
November 29, 2011 8:51 AM
Answer

GERALD ROMERO

Rank: New Member

Posts: 4

Join Date: October 4, 2011

Recent Posts

I am able to effectively use LocalServiceUtil to do basic CRUD programmatically from Vaadin based solutions. However, it would be great to see examples of how to bind data to Vaadin containers and use the Vaadin UI components to do CRUD. Ideally, I would love to see the Vaadin tutorial adapted to a Liferay portlet using Service Builder for persistence.
Ivano Carrara
RE: Liferay ServiceBuilder and Vaadin
November 29, 2011 9:05 AM
Answer

Ivano Carrara

Rank: Regular Member

Posts: 228

Join Date: July 2, 2005

Recent Posts

Hi Gerald,

You centered and best explained my initial post....

Liferay released a complete and complex portlet (Mail portlet) using Vaadin and Service Builder classes...
In some books people speaks very well about the two frameworks togheter but after some sentences they wrote "... ignore details... ignore details..." and so on...

So, actually, no one in the world wrote two simple pages to describe a simple CRUD portlet using Vaadin....

In 30 minute I wrote a portlet to view the records from a table... but from here to a complete CRUD portlet the way is so long....
So I'm continuing to use the MVC portlet way from Liferay and the dream of a shorter way with Vaadin is far from here.

I can imagine that is very simple to use the two frameworks togheter but ... why no one made an example???

I hope some people from Vaadin and/or Liferay, after they illustrated the beautiful of the two framework togheter, help us!

Thank you for any help!
Ivano C.
Tomek Lipski
RE: Liferay ServiceBuilder and Vaadin
November 30, 2011 3:52 AM
Answer

Tomek Lipski

Rank: Junior Member

Posts: 33

Join Date: November 17, 2010

Recent Posts

Jack Bakker
RE: Liferay ServiceBuilder and Vaadin
December 3, 2011 9:31 AM
Answer

Jack Bakker

Rank: Liferay Master

Posts: 614

Join Date: January 3, 2010

Recent Posts

easy enough to do CRUD using *LocalServiceUtil methods called from Vaadin Application (in event listeners perhaps where on double click of table row or click of 'edit' button in table a new form page comes up for edit (perhaps in a tab), on delete a confirm prompt shows, etc.)

along the lines of Gerald's data binding scenario: right now I am considering:

say a million rows are involved via a *LocalServiceUtil get everything ; not good to select such into a list (server-side) nor deliver to a Vaadin table.... so given a Vaadin table might just show first 100 ; and given yes there are *LocalServiceUtil to get only first 100 but then as user scrolls down through the table, are there listener methods/approaches that afford getting the 'next' 100 (paging-like) ?
Jack Bakker
RE: Liferay ServiceBuilder and Vaadin
December 3, 2011 10:40 AM
Answer

Jack Bakker

Rank: Liferay Master

Posts: 614

Join Date: January 3, 2010

Recent Posts

perhaps this on lazy loading tables is interesting

https://vaadin.com/forum/-/message_boards/view_message/169908

but still not sure how such can be bound to *Util selects like *Util.get*(start, end)
Jack Bakker
RE: Liferay ServiceBuilder and Vaadin
December 4, 2011 4:22 PM
Answer

Jack Bakker

Rank: Liferay Master

Posts: 614

Join Date: January 3, 2010

Recent Posts

and on the so-called bind data to/from Vaadin (or better said mapping backend ORM/Service to Vaadin presentation via table/list or add/edit/delete CRUD from etc., I still currently see need for developer a) adding get/set? methods to *.model.impl.*Impl.java in the service to cater to Vaadin presentation CRUD OR b) doing that transform from/to in the Vaadin portlet Application itself (hidden columns in Vaadin is attractive, sort on hidden via comparator, etc.)

I think architecturally better to put in service model impl for resuse across multiple client portlets but then as enterprise installs get bigger, reuse requires an OSGi which is still forthcoming for LR

I add that it is nice to dream of ideals, but like with wanting a WIKI on certain things, such takes time...
Dieter Engelhardt
RE: Liferay ServiceBuilder and Vaadin
March 20, 2012 1:15 PM
Answer

Dieter Engelhardt

Rank: New Member

Posts: 18

Join Date: October 30, 2011

Recent Posts

Hi there,
I working on the same problem and found this greate example. Furthermore this is exactly what i try to achive. I#m about to create a Mailinglist-Portlet.

But I'm new to both: Liferay and Vaadin.

Are there any new approaches to this problem?

I agree with Jack to extend the servicelayer.

Regards,
Dieter
Dieter Engelhardt
RE: Liferay ServiceBuilder and Vaadin
April 20, 2012 4:49 PM
Answer

Dieter Engelhardt

Rank: New Member

Posts: 18

Join Date: October 30, 2011

Recent Posts

If this is still not solved.
Just give me a message. I have found how it works.
Albert R. Timashev
RE: Liferay ServiceBuilder and Vaadin
April 22, 2012 11:05 PM
Answer

Albert R. Timashev

Rank: New Member

Posts: 3

Join Date: June 11, 2010

Recent Posts

Hi Dieter,

I think many developers are interested by this subject, so if you found something, please, share your experience and findings!

Regards,
Albert
Dieter Engelhardt
RE: Liferay ServiceBuilder and Vaadin
April 24, 2012 5:00 PM
Answer

Dieter Engelhardt

Rank: New Member

Posts: 18

Join Date: October 30, 2011

Recent Posts

I've found that Vaadin can handle Liferay Data simply by wrapping it in org.vaadin.data.collectioncontainer.CollectionContainer

EXAMPLE
1
2        List<CalEvent> tempResults = CalEventLocalServiceUtil.
3        getCompanyEvents(companyId, 0, CalEventLocalServiceUtil.getCompanyEventsCount(companyId));
4        event_tab.setContainerDataSource(CollectionContainer.fromBeans(tempResults, "eventId"));
David H Nebinger
RE: Liferay ServiceBuilder and Vaadin
April 24, 2012 7:30 PM
Answer

David H Nebinger

Rank: Liferay Legend

Posts: 7153

Join Date: September 1, 2006

Recent Posts

Dieter Engelhardt:
I've found that Vaadin can handle Liferay Data simply by wrapping it in org.vaadin.data.collectioncontainer.CollectionContainer

EXAMPLE
1
2        List<CalEvent> tempResults = CalEventLocalServiceUtil.
3        getCompanyEvents(companyId, 0, CalEventLocalServiceUtil.getCompanyEventsCount(companyId));
4        event_tab.setContainerDataSource(CollectionContainer.fromBeans(tempResults, "eventId"));



Well first of all you should be using getCompanyEvents(companyId, QueryUtil.ALL_POS, QueryUtil.ALL_POS); rather than what you just did - you have an extra call to the database to retrieve the count unnecessarily.

Secondly, anyone can retrieve all of the rows and provide them via a CollectionContainer. The issue here is integrating the Vaadin paging over the entire result set w/o actually having to retrieve all of the data initially.

That is certainly not supported through the simple CollectionContainer...