Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
mehmet tasar
Vaadin Image Showing
December 27, 2012 3:25 AM
Answer

mehmet tasar

Rank: Junior Member

Posts: 49

Join Date: March 6, 2011

Recent Posts

Hi All,

In Vaadin, How can I put an Image to Panel? The image is in document library.
Thanks.
David H Nebinger
RE: Vaadin Image Showing
December 27, 2012 7:58 AM
Answer

David H Nebinger

Community Moderator

Rank: Liferay Legend

Posts: 11770

Join Date: September 1, 2006

Recent Posts

Vaadin uses resources to serve up static content. For example, there's the ClasspathResource which will stream a resource from an image in the classpath.

But in the end it's a simple interface that you need to support to create an input stream from your object. So you'd fetch the object from the doc library, wrap the object w/ the interface (I think it's a StreamResource interface) and feed the stream back to the Vaadin component.
Montej Shah
RE: Vaadin Image Showing
April 7, 2015 10:11 PM
Answer

Montej Shah

Rank: New Member

Posts: 15

Join Date: November 4, 2014

Recent Posts

This information helpul to me,
I add my image file in src folder of liferay plugin portlet and use it as below

verticalLayout2.addComponent(new Embedded("", new ClassResource(
"/chart.png", this)));

and it works.
Make sure to use "/" as first character of path of image
David H Nebinger
RE: Vaadin Image Showing
April 7, 2015 10:47 PM
Answer

David H Nebinger

Community Moderator

Rank: Liferay Legend

Posts: 11770

Join Date: September 1, 2006

Recent Posts

"/" as the first character is the norm for a classpath-based resource, it is not specific to Vaadin.