Skip to content

Latest commit

 

History

History
92 lines (66 loc) · 2.8 KB

File metadata and controls

92 lines (66 loc) · 2.8 KB
Embedded (Deprecated)
Warning

Starting from the version 6.8 of the Platform the Embedded component is deprecated. Use the Image component for displaying images or the BrowserFrame component for embedded web pages.

Embedded component is intended for displaying images and embedding arbitrary web pages into the application screens.

XML name of the component: embedded

The component is implemented for Web Client and Desktop Client. Desktop Client supports image display only.

Below is an example of using the component to display an image from a file located in FileStorage.

  • Declare the component in an XML screen descriptor:

    link:../../../../../../source/gui_vcl/embedded_1.xml[role=include]
  • In a screen controller, inject the component itself and the FileStorageService interface. In init() method, get the FileDescriptor passed from the calling code, load the corresponding file in a byte array, create a ByteArrayInputStream for it, and pass the stream to the setSource() method of the component:

    link:../../../../../../source/gui_vcl/embedded_2.java[role=include]

The Embedded component supports several different content types, which are rendered differently in HTML. You can set the content type with the setType() method. Supported types:

  • OBJECT - allows embedding certain file types inside HTML <object> and <embed> elements.

  • IMAGE - embeds an image inside a HTML <img> element.

  • BROWSER - embeds a browser frame inside a HTML <iframe> element.

In Web Client, the component enables displaying of files located inside VAADIN folder. You can set the resource path relative to the application root, for example:

link:../../../../../../source/gui_vcl/embedded_6.xml[role=include]

or

link:../../../../../../source/gui_vcl/embedded_5.java[role=include]

You can also define a resource files directory in the cuba.web.resourcesRoot application property and specify the name of a file inside this directory with the prefix for the value: file:// , url:// , or theme://:

link:../../../../../../source/gui_vcl/embedded_7.xml[role=include]

or

link:../../../../../../source/gui_vcl/embedded_3.java[role=include]

In order to display an external web page, pass its URL to the component:

link:../../../../../../source/gui_vcl/embedded_4.java[role=include]

Attributes of embedded

align - height - id - relativeSrc - src - stylename - visible - width