|
The The following example displays an image from the same Java package as the class itself using the class loader. Embedded image = new Embedded("Yes, logo:",
new ClassResource("vaadin-logo.png", this));
main.addComponent(image);
The
The Currently, only Shockwave Flash animations are supported (MIME type // Create a Shockware Flash resource
final ClassResource flashResource =
new ClassResource("itmill_spin.swf", getApplication());
// Display the resource in a Embedded compoant
final Embedded embedded =
new Embedded("Embedded Caption", flashResource);
// This is the default type, but we set it anyway.
embedded.setType(Embedded.TYPE_OBJECT);
// This is recorgnized automatically, but set it anyway.
embedded.setMimeType("application/x-shockwave-flash"); You can set object parameters with Images are embedded with the type You can find another example of displaying an image from If you have a dynamically generated image, for example with a // Create the stream resource with some initial filename.
StreamResource imageResource =
new StreamResource(imageSource, "initial-filename.png",
getApplication());
// Instruct browser not to cache the image.
imageResource.setCacheTime(0);
// Display the image in an Embedded component.
Embedded embedded = new Embedded("", imageResource); When refreshing, you also need to call // This needs to be done, but is not sufficient.
embedded.requestRepaint();
// Generate a filename with a timestamp.
SimpleDateFormat df = new SimpleDateFormat("yyyyMMddHHmmssSSS");
String filename = "myfilename-" + df.format(new Date()) + ".png";
// Replace the filename in the resource.
imageResource.setFilename(makeImageFilename()); You can find more detailed information about the The browser frame type allows you to embed external content inside an HTML URL url = new URL("http://dev.itmill.com/");
Embedded browser = new Embedded("", new ExternalResource(url));
browser.setType(Embedded.TYPE_BROWSER);
main.addComponent(browser); |
Table of Contents
|