Foren
Vaadin Image Showing
mehmet tasar, geändert vor 11 Jahren.
Vaadin Image Showing
Junior Member Beiträge: 49 Beitrittsdatum: 06.03.11 Neueste Beiträge
Hi All,
In Vaadin, How can I put an Image to Panel? The image is in document library.
Thanks.
In Vaadin, How can I put an Image to Panel? The image is in document library.
Thanks.
David H Nebinger, geändert vor 11 Jahren.
RE: Vaadin Image Showing
Liferay Legend Beiträge: 14915 Beitrittsdatum: 02.09.06 Neueste 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.
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, geändert vor 9 Jahren.
RE: Vaadin Image Showing
New Member Beiträge: 17 Beitrittsdatum: 05.11.14 Neueste 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
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, geändert vor 9 Jahren.
RE: Vaadin Image Showing
Liferay Legend Beiträge: 14915 Beitrittsdatum: 02.09.06 Neueste Beiträge
"/" as the first character is the norm for a classpath-based resource, it is not specific to Vaadin.