Class DashboardWidget

java.lang.Object
com.vaadin.flow.component.Component
com.vaadin.flow.component.dashboard.DashboardWidget
All Implemented Interfaces:
com.vaadin.flow.component.AttachNotifier, com.vaadin.flow.component.DetachNotifier, com.vaadin.flow.component.HasElement, com.vaadin.flow.component.HasStyle, Serializable

@Tag("vaadin-dashboard-widget") @JsModule("@vaadin/dashboard/src/vaadin-dashboard-widget.js") @NpmPackage(value="@vaadin/dashboard", version="25.0.0-alpha16") public class DashboardWidget extends com.vaadin.flow.component.Component
DashboardWidget represents a customizable widget that can be placed within a Dashboard. It supports layout options such as colspan and rowspan, and allows setting content and header content.
Author:
Vaadin Ltd
See Also:
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates an empty widget.
    DashboardWidget(com.vaadin.flow.component.Component content)
    Creates a widget with the specified content.
    Creates a widget with the specified title.
    DashboardWidget(String title, com.vaadin.flow.component.Component content)
    Creates a widget with the specified title and content.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Returns the colspan of the widget.
    com.vaadin.flow.component.Component
    Returns the content of the widget.
    com.vaadin.flow.component.Component
    Gets the content in the header content slot of this widget.
    int
    Returns the rowspan of the widget.
    Returns the title of the widget.
    boolean
     
    void
    setColspan(int colspan)
    Sets the colspan of the widget.
    void
    setContent(com.vaadin.flow.component.Component content)
    Sets the content to the widget.
    void
    setHeaderContent(com.vaadin.flow.component.Component header)
    Sets the content in the header content slot of this widget, replacing any existing header content.
    void
    setRowspan(int rowspan)
    Sets the rowspan of the widget.
    void
    Sets the title of the widget.
    void
    setVisible(boolean visible)
     

    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, onAttach, onDetach, onEnabledStateChanged, removeFromParent, scrollIntoView, scrollIntoView, set, setElement, setId

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

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

    • DashboardWidget

      public DashboardWidget()
      Creates an empty widget.
    • DashboardWidget

      public DashboardWidget(String title)
      Creates a widget with the specified title.
      Parameters:
      title - the title to set
    • DashboardWidget

      public DashboardWidget(com.vaadin.flow.component.Component content)
      Creates a widget with the specified content.
      Parameters:
      content - the content to set
    • DashboardWidget

      public DashboardWidget(String title, com.vaadin.flow.component.Component content)
      Creates a widget with the specified title and content.
      Parameters:
      title - the title to set
      content - the content to set
  • Method Details

    • getTitle

      public String getTitle()
      Returns the title of the widget.
      Returns:
      the widgetTitle property from the web component
    • setTitle

      public void setTitle(String title)
      Sets the title of the widget.
      Parameters:
      title - the title to set
    • getColspan

      public int getColspan()
      Returns the colspan of the widget. The default is 1.
      Returns:
      the colspan of the widget
    • setColspan

      public void setColspan(int colspan)
      Sets the colspan of the widget. Cannot be lower than 1.
      Parameters:
      colspan - the colspan to set
    • getRowspan

      public int getRowspan()
      Returns the rowspan of the widget. The default is 1.
      Returns:
      the rowspan of the widget
    • setRowspan

      public void setRowspan(int rowspan)
      Sets the rowspan of the widget. Cannot be lower than 1.
      Parameters:
      rowspan - the rowspan to set
    • getContent

      public com.vaadin.flow.component.Component getContent()
      Returns the content of the widget. Returns null if the widget has no content.
      Returns:
      the content of the widget
    • setContent

      public void setContent(com.vaadin.flow.component.Component content)
      Sets the content to the widget. Set null to remove the current content.
      Parameters:
      content - the content to set
    • getHeaderContent

      public com.vaadin.flow.component.Component getHeaderContent()
      Gets the content in the header content slot of this widget.
      Returns:
      the header content of this widget, or null if no header content has been set
    • setHeaderContent

      public void setHeaderContent(com.vaadin.flow.component.Component header)
      Sets the content in the header content slot of this widget, replacing any existing header content.
      Parameters:
      header - the content to set, can be null to remove existing header content
    • setVisible

      public void setVisible(boolean visible)
      Overrides:
      setVisible in class com.vaadin.flow.component.Component
      Throws:
      UnsupportedOperationException - Dashboard widget does not support setting visibility
    • isVisible

      public boolean isVisible()
      Overrides:
      isVisible in class com.vaadin.flow.component.Component