Class Window

java.lang.Object
com.vaadin.flow.component.Component
com.vaadin.flow.component.dialog.Dialog
com.vaadin.featurepack.desktop.Window
All Implemented Interfaces:
HasLayout, HasLocation, com.vaadin.flow.component.AttachNotifier, com.vaadin.flow.component.DetachNotifier, com.vaadin.flow.component.HasAriaDescription, com.vaadin.flow.component.HasAriaRole, com.vaadin.flow.component.HasComponents, com.vaadin.flow.component.HasComponentsOfType<com.vaadin.flow.component.Component>, com.vaadin.flow.component.HasElement, com.vaadin.flow.component.HasEnabled, com.vaadin.flow.component.HasSize, com.vaadin.flow.component.HasStyle, com.vaadin.flow.component.HasTheme, com.vaadin.flow.component.shared.HasThemeVariant<com.vaadin.flow.component.dialog.DialogVariant>, Serializable

public class Window extends com.vaadin.flow.component.dialog.Dialog implements HasLayout, HasLocation
Window is a component that mimics the behavior of an operating system window. It provides space for content and a menu bar (optional).

By default, windows can be resized, moved, and have buttons to minimize, maximize and close.

Author:
Vaadin Ltd
See Also:
  • Nested Class Summary

    Nested classes/interfaces inherited from class com.vaadin.flow.component.dialog.Dialog

    com.vaadin.flow.component.dialog.Dialog.ClosedEvent, com.vaadin.flow.component.dialog.Dialog.DialogCloseActionEvent, com.vaadin.flow.component.dialog.Dialog.DialogDraggedEvent, com.vaadin.flow.component.dialog.Dialog.DialogFooter, com.vaadin.flow.component.dialog.Dialog.DialogHeader, com.vaadin.flow.component.dialog.Dialog.DialogResizeEvent, com.vaadin.flow.component.dialog.Dialog.OpenedChangeEvent
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates a new window.
    Window(String title)
    Creates a new window with the given title.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    add(com.vaadin.flow.component.Component... components)
     
    com.vaadin.flow.component.Component
    Gets the content container for this window.
    Gets the layout for the content container of this window.
    Gets the location for the window.
    com.vaadin.flow.component.Component
    Gets the menu bar for this window.
    Gets the root container for this window.
    boolean
    Gets whether the window can be closed.
    boolean
    Gets whether the window can be maximized.
    boolean
    Gets whether the window can be minimized.
    boolean
    Returns whether the window is opened or not.
    void
    remove(com.vaadin.flow.component.Component... components)
     
    void
     
    void
    setClosable(boolean closable)
    Sets whether the window can be closed.
    void
    setContentContainer(com.vaadin.flow.component.Component contentContainer)
    Sets the content container for this window.
    void
    Sets the layout for the content container of this window.
    void
    setLocation(Point location)
    Sets the location for the window.
    void
    setMaximizable(boolean maximizable)
    Sets whether the window can be maximized.
    void
    setMenuBar(com.vaadin.flow.component.Component menuBar)
    Sets the menu bar for this window.
    void
    setMinimizable(boolean minimizable)
    Sets whether the window can be minimized.
    void
    Sets the root container for this window.
    void
    setVisible(boolean visible)
    Opens or closes the window depending on the flag.

    Methods inherited from class com.vaadin.flow.component.dialog.Dialog

    addAttachListener, addClosedListener, addComponentAtIndex, addDetachListener, addDialogCloseActionListener, addDraggedListener, addOpenedChangeListener, addResizeListener, bindChildren, bindHeight, bindVisible, bindWidth, close, getAriaLabel, getChildren, getFooter, getHeader, getHeaderTitle, getHeadingLevel, getHeight, getLeft, getMaxHeight, getMaxWidth, getMinHeight, getMinWidth, getModality, getOverlayRole, getRole, getStyle, getTop, getWidth, isAutofocus, isCloseOnEsc, isCloseOnOutsideClick, isDraggable, isFocusTrap, isKeepInViewport, isModal, isOpened, isResizable, onAttach, open, setAriaLabel, setAutofocus, setCloseOnEsc, setCloseOnOutsideClick, setDraggable, setFocusTrap, setHeaderTitle, setHeadingLevel, setHeight, setKeepInViewport, setLeft, setMaxHeight, setMaxWidth, setMinHeight, setMinWidth, setModal, setModality, setOpened, setOverlayRole, setResizable, setRole, setTop, setWidth

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

    addListener, findAncestor, findAncestor, fireEvent, from, get, getElement, getEventBus, getId, getListeners, getLocale, getParent, getTestId, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getUI, getUIOrThrow, hasListener, isAttached, isTemplateMapped, onDetach, onEnabledStateChanged, removeFromParent, scrollIntoView, scrollIntoView, set, setElement, setId, setTestId, whenAttached

    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.HasAriaDescription

    getAriaDescribedBy, setAriaDescribedBy, setAriaDescribedBy

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

    getAriaRole, setAriaRole

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

    add

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

    add, addComponentAsFirst, getComponentAt, getComponentCount, indexOf, remove, replace

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

    getElement

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

    bindEnabled, isEnabled, setEnabled

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

    getHeightUnit, getWidthUnit, setHeight, setHeightFull, setMaxHeight, setMaxWidth, setMinHeight, setMinWidth, setSizeFull, setSizeUndefined, setWidth, setWidthFull

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

    addClassName, addClassNames, bindClassName, bindClassNames, getClassName, getClassNames, hasClassName, removeClassName, removeClassNames, setClassName, setClassName

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

    addThemeName, addThemeNames, bindThemeName, bindThemeNames, getThemeName, getThemeNames, hasThemeName, removeThemeName, removeThemeNames, setThemeName, setThemeName

    Methods inherited from interface com.vaadin.flow.component.shared.HasThemeVariant

    addThemeVariants, bindThemeVariant, bindThemeVariants, removeThemeVariants, setThemeVariant, setThemeVariants, setThemeVariants
  • Constructor Details

    • Window

      public Window()
      Creates a new window.
    • Window

      public Window(String title)
      Creates a new window with the given title.
      Parameters:
      title - the title for the window
  • Method Details

    • setRootContainer

      public void setRootContainer(RootContainer rootContainer)
      Sets the root container for this window.
      Parameters:
      rootContainer - the root container, not null
    • getRootContainer

      public RootContainer getRootContainer()
      Gets the root container for this window.
      Returns:
      the root container, not null
    • setMenuBar

      public void setMenuBar(com.vaadin.flow.component.Component menuBar)
      Sets the menu bar for this window.
      Parameters:
      menuBar - the menu bar, or null to unset the previous menu bar
    • getMenuBar

      public com.vaadin.flow.component.Component getMenuBar()
      Gets the menu bar for this window.
      Returns:
      the menu bar, or null if no menu bar is set
    • setContentContainer

      public void setContentContainer(com.vaadin.flow.component.Component contentContainer)
      Sets the content container for this window.
      Parameters:
      contentContainer - the content container, not null
    • getContentContainer

      public com.vaadin.flow.component.Component getContentContainer()
      Gets the content container for this window.
      Returns:
      the content container, not null
    • setLayout

      public void setLayout(AbstractLayout layout)
      Sets the layout for the content container of this window.
      Specified by:
      setLayout in interface HasLayout
      Parameters:
      layout - the layout instance or null to unset the previous layout.
    • getLayout

      public AbstractLayout getLayout()
      Gets the layout for the content container of this window.
      Specified by:
      getLayout in interface HasLayout
      Returns:
      the layout instance or null if no layout is set
    • setVisible

      public void setVisible(boolean visible)
      Opens or closes the window depending on the flag.
      Overrides:
      setVisible in class com.vaadin.flow.component.dialog.Dialog
      Parameters:
      visible - whether the window should be opened or closed
    • isVisible

      public boolean isVisible()
      Returns whether the window is opened or not.
      Overrides:
      isVisible in class com.vaadin.flow.component.Component
      Returns:
      true if the window is opened, false otherwise.
    • add

      public void add(com.vaadin.flow.component.Component... components)
      Specified by:
      add in interface com.vaadin.flow.component.HasComponentsOfType<com.vaadin.flow.component.Component>
    • remove

      public void remove(com.vaadin.flow.component.Component... components)
      Specified by:
      remove in interface com.vaadin.flow.component.HasComponentsOfType<com.vaadin.flow.component.Component>
    • removeAll

      public void removeAll()
      Specified by:
      removeAll in interface com.vaadin.flow.component.HasComponentsOfType<com.vaadin.flow.component.Component>
      Overrides:
      removeAll in class com.vaadin.flow.component.dialog.Dialog
    • isClosable

      public boolean isClosable()
      Gets whether the window can be closed.
      Returns:
      true if the window can be closed, false otherwise.
    • setClosable

      public void setClosable(boolean closable)
      Sets whether the window can be closed.
      Parameters:
      closable - whether the window can be closed
    • isMinimizable

      public boolean isMinimizable()
      Gets whether the window can be minimized.
      Returns:
      true if the window can be minimized, false otherwise.
    • setMinimizable

      public void setMinimizable(boolean minimizable)
      Sets whether the window can be minimized.
      Parameters:
      minimizable - whether the window can be minimized
    • isMaximizable

      public boolean isMaximizable()
      Gets whether the window can be maximized.
      Returns:
      true if the window can be maximized, false otherwise.
    • setMaximizable

      public void setMaximizable(boolean maximizable)
      Sets whether the window can be maximized.
      Parameters:
      maximizable - whether the window can be maximized
    • setLocation

      public void setLocation(Point location)
      Sets the location for the window.
      Specified by:
      setLocation in interface HasLocation
      Parameters:
      location - the location to set
    • getLocation

      public Point getLocation()
      Gets the location for the window.
      Specified by:
      getLocation in interface HasLocation
      Returns:
      the location of the window