Class IFrame

java.lang.Object
com.vaadin.flow.component.Component
com.vaadin.flow.component.HtmlComponent
com.vaadin.flow.component.html.IFrame
All Implemented Interfaces:
com.vaadin.flow.component.AttachNotifier, com.vaadin.flow.component.DetachNotifier, com.vaadin.flow.component.HasAriaLabel, com.vaadin.flow.component.HasElement, com.vaadin.flow.component.HasSize, com.vaadin.flow.component.HasStyle, Serializable

@Tag("iframe") public class IFrame extends com.vaadin.flow.component.HtmlComponent implements com.vaadin.flow.component.HasAriaLabel
Component representing a <iframe> element.
Since:
1.3
Author:
Vaadin Ltd
See Also:
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static enum 
    Importance types.
    static enum 
    Sandbox types.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates a new iframe.
    IFrame(com.vaadin.flow.server.streams.DownloadHandler downloadHandler)
    Creates a new iframe with download handler callback that provides a resource from server.
    Creates a new iframe with a source URL.
  • Method Summary

    Modifier and Type
    Method
    Description
    Gets the value of allow attribute.
    Gets the importance attribute value.
    Gets the name attribute.
    Gets the list of sandbox attribute values.
    Gets the source of the iframe.
    Gets the srcdoc of the iframe.
    void
    Reloads the IFrame.
    void
    Sets the allow property to specify a feature policy.
    void
    Sets the importance attribute to the specified IFrame.ImportanceType value.
    void
    Sets the name attribute.
    void
    Sets the sandbox attribute to the given IFrame.SandboxTypes.
    void
    setSrc(com.vaadin.flow.server.AbstractStreamResource src)
    Deprecated, for removal: This API element is subject to removal in a future version.
    void
    setSrc(com.vaadin.flow.server.streams.DownloadHandler downloadHandler)
    Sets the source of the iframe with a source URL with the URL of the given DownloadHandler callback.
    void
    Sets the source of the iframe.
    void
    setSrcdoc(String srcdoc)
    Sets the srcdoc of the iframe.

    Methods inherited from class com.vaadin.flow.component.HtmlComponent

    getTitle, setTitle

    Methods inherited from class com.vaadin.flow.component.Component

    addListener, findAncestor, fireEvent, from, get, getChildren, getElement, getEventBus, getId, getListeners, getLocale, getParent, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getUI, hasListener, isAttached, isTemplateMapped, isVisible, onAttach, onDetach, onEnabledStateChanged, removeFromParent, scrollIntoView, scrollIntoView, set, setElement, setId, setVisible

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface com.vaadin.flow.component.AttachNotifier

    addAttachListener

    Methods inherited from interface com.vaadin.flow.component.DetachNotifier

    addDetachListener

    Methods inherited from interface com.vaadin.flow.component.HasAriaLabel

    getAriaLabel, getAriaLabelledBy, setAriaLabel, setAriaLabelledBy

    Methods inherited from interface com.vaadin.flow.component.HasElement

    getElement

    Methods inherited from interface com.vaadin.flow.component.HasSize

    getHeight, getHeightUnit, getMaxHeight, getMaxWidth, getMinHeight, getMinWidth, getWidth, getWidthUnit, setHeight, setHeight, setHeightFull, setMaxHeight, setMaxHeight, setMaxWidth, setMaxWidth, setMinHeight, setMinHeight, setMinWidth, setMinWidth, setSizeFull, setSizeUndefined, setWidth, setWidth, setWidthFull

    Methods inherited from interface com.vaadin.flow.component.HasStyle

    addClassName, addClassNames, getClassName, getClassNames, getStyle, hasClassName, removeClassName, removeClassNames, setClassName, setClassName
  • Constructor Details

    • IFrame

      public IFrame()
      Creates a new iframe.
    • IFrame

      public IFrame(String src)
      Creates a new iframe with a source URL.
      Parameters:
      src - Source URL
    • IFrame

      public IFrame(com.vaadin.flow.server.streams.DownloadHandler downloadHandler)
      Creates a new iframe with download handler callback that provides a resource from server. Sets the Content-Disposition header to inline for pre-defined download handlers, created by factory methods in DownloadHandler, as well as for other AbstractDownloadHandler implementations.
      Parameters:
      downloadHandler - the download handler callback that provides a resource from server, not null
  • Method Details

    • setSrc

      public void setSrc(String src)
      Sets the source of the iframe. If the contents at the src of the IFrame has changed and you want to refresh it in the user's browser, the src does not to be reset. In this case use the #reload() method.
      Parameters:
      src - Source URL.
    • setSrc

      @Deprecated(since="24.8", forRemoval=true) public void setSrc(com.vaadin.flow.server.AbstractStreamResource src)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Sets the source of the iframe with a source URL with the URL of the given StreamResource.
      Parameters:
      src - the resource value, not null
      See Also:
    • setSrc

      public void setSrc(com.vaadin.flow.server.streams.DownloadHandler downloadHandler)
      Sets the source of the iframe with a source URL with the URL of the given DownloadHandler callback. Sets the Content-Disposition header to inline for pre-defined download handlers, created by factory methods in DownloadHandler, as well as for other AbstractDownloadHandler implementations.
      Parameters:
      downloadHandler - the download handler resource, not null
      See Also:
    • getSrc

      public String getSrc()
      Gets the source of the iframe.
      Returns:
      the source of the iframe.
    • setSrcdoc

      public void setSrcdoc(String srcdoc)
      Sets the srcdoc of the iframe.
      Parameters:
      srcdoc - srcdoc URL.
    • getSrcdoc

      public Optional<String> getSrcdoc()
      Gets the srcdoc of the iframe.
      Returns:
      the srcdoc of the iframe.
    • setAllow

      public void setAllow(String allow)
      Sets the allow property to specify a feature policy.
      Parameters:
      allow - the allow attribute value.
      See Also:
    • getAllow

      public Optional<String> getAllow()
      Gets the value of allow attribute.
      Returns:
      the currently applied allow value.
    • setName

      public void setName(String name)
      Sets the name attribute.
      Parameters:
      name - the value for the name attribute.
    • getName

      public Optional<String> getName()
      Gets the name attribute.
      Returns:
      the name attribute.
    • setImportance

      public void setImportance(IFrame.ImportanceType importance)
      Sets the importance attribute to the specified IFrame.ImportanceType value.
      Parameters:
      importance - IFrame.ImportanceType value.
      See Also:
    • getImportance

      public Optional<IFrame.ImportanceType> getImportance()
      Gets the importance attribute value.
      Returns:
      the importance value.
      See Also:
    • setSandbox

      public void setSandbox(IFrame.SandboxType... types)
      Sets the sandbox attribute to the given IFrame.SandboxTypes.
      Parameters:
      types - IFrame.SandboxTypes.
    • getSandbox

      public Optional<IFrame.SandboxType[]> getSandbox()
      Gets the list of sandbox attribute values.
      Returns:
      the current IFrame.SandboxTypes.
    • reload

      public void reload()
      Reloads the IFrame.