Foros de discusión

Vaadin Image Showing

mehmet tasar, modificado hace 11 años.

Vaadin Image Showing

Junior Member Mensajes: 49 Fecha de incorporación: 6/03/11 Mensajes recientes
Hi All,

In Vaadin, How can I put an Image to Panel? The image is in document library.
Thanks.
thumbnail
David H Nebinger, modificado hace 11 años.

RE: Vaadin Image Showing

Liferay Legend Mensajes: 14914 Fecha de incorporación: 2/09/06 Mensajes recientes
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, modificado hace 8 años.

RE: Vaadin Image Showing

New Member Mensajes: 17 Fecha de incorporación: 5/11/14 Mensajes recientes
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
thumbnail
David H Nebinger, modificado hace 8 años.

RE: Vaadin Image Showing

Liferay Legend Mensajes: 14914 Fecha de incorporación: 2/09/06 Mensajes recientes
"/" as the first character is the norm for a classpath-based resource, it is not specific to Vaadin.