Fórum

Vaadin Image Showing

mehmet tasar, modificado 11 Anos atrás.

Vaadin Image Showing

Junior Member Postagens: 49 Data de Entrada: 06/03/11 Postagens Recentes
Hi All,

In Vaadin, How can I put an Image to Panel? The image is in document library.
Thanks.
thumbnail
David H Nebinger, modificado 11 Anos atrás.

RE: Vaadin Image Showing

Liferay Legend Postagens: 14915 Data de Entrada: 02/09/06 Postagens Recentes
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 9 Anos atrás.

RE: Vaadin Image Showing

New Member Postagens: 17 Data de Entrada: 05/11/14 Postagens Recentes
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 9 Anos atrás.

RE: Vaadin Image Showing

Liferay Legend Postagens: 14915 Data de Entrada: 02/09/06 Postagens Recentes
"/" as the first character is the norm for a classpath-based resource, it is not specific to Vaadin.