Foren

Home » Liferay Portal » English » 3. Development

Kombinierte Ansicht Flache Ansicht Baumansicht
Threads [ Zurück | Nächste ]
toggle
mehmet tasar
Vaadin Image Showing
27. Dezember 2012 03:25
Antwort

mehmet tasar

Rang: Junior Member

Nachrichten: 49

Eintrittsdatum: 6. März 2011

Neue Beiträge

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
27. Dezember 2012 07:58
Antwort

David H Nebinger

Community Moderator

Rang: Liferay Legend

Nachrichten: 11304

Eintrittsdatum: 1. September 2006

Neue Beiträge

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
7. April 2015 22:11
Antwort

Montej Shah

Rang: New Member

Nachrichten: 15

Eintrittsdatum: 4. November 2014

Neue Beiträge

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
7. April 2015 22:47
Antwort

David H Nebinger

Community Moderator

Rang: Liferay Legend

Nachrichten: 11304

Eintrittsdatum: 1. September 2006

Neue Beiträge

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