Class DashboardWidget

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

@Tag("vaadin-dashboard-widget") @JsModule("@vaadin/dashboard/src/vaadin-dashboard-widget.js") @NpmPackage(value="@vaadin/dashboard", version="25.1.2") public class DashboardWidget extends 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 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(Component content)
      Creates a widget with the specified content.
      Parameters:
      content - the content to set
    • DashboardWidget

      public DashboardWidget(String title, 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 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(Component content)
      Sets the content to the widget. Set null to remove the current content.
      Parameters:
      content - the content to set
    • getHeaderContent

      public 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(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

      @Deprecated public void setVisible(boolean visible)
      Deprecated.
      This method is not supported and will throw an exception when called.
      DashboardWidget does not support setting visibility.

      This method is inherited from Component and is marked as deprecated to indicate that it is not supported. This method will throw an UnsupportedOperationException when called.

      Overrides:
      setVisible in class Component
      Parameters:
      visible - the visibility value
    • bindVisible

      @Deprecated public SignalBinding<Boolean> bindVisible(Signal<Boolean> visibleSignal)
      Deprecated.
      This method is not supported and will throw an exception when called.
      DashboardWidget does not support binding the visible state to a signal.

      This method is inherited from Component and is marked as deprecated to indicate that it is not supported. This method will throw an UnsupportedOperationException when called.

      Overrides:
      bindVisible in class Component
      Parameters:
      visibleSignal - the signal to bind, not null
      Returns:
      a SignalBinding that can be used to register onChange callbacks
      See Also:
    • isVisible

      public boolean isVisible()
      Description copied from class: Component
      Gets the component visibility value.
      Overrides:
      isVisible in class Component
      Returns:
      true if the component is visible, false otherwise