Interface HasWidgets

All Superinterfaces:
Serializable
All Known Implementing Classes:
Dashboard, DashboardSection

public interface HasWidgets extends Serializable
HasWidgets is an interface for components that can contain and manage multiple DashboardWidget instances. It defines methods for adding, removing, and accessing widgets within a component.
Author:
Vaadin Ltd
See Also:
  • Method Details

    • getWidgets

      List<DashboardWidget> getWidgets()
      Returns the widgets in this component.
      Returns:
      The widgets in this component
    • add

      default void add(DashboardWidget... widgets)
      Adds the given widgets to this component.
      Parameters:
      widgets - the widgets to add, not null
    • add

      void add(Collection<DashboardWidget> widgets)
      Adds the given widgets to this component.
      Parameters:
      widgets - the widgets to add, not null
    • addWidgetAtIndex

      void addWidgetAtIndex(int index, DashboardWidget widget)
      Adds the given widget as child of this component at the specific index.

      In case the specified widget has already been added to another parent, it will be removed from there and added to this one.

      Parameters:
      index - the index, where the widget will be added. The index must be non-negative and may not exceed the children count
      widget - the widget to add, not null
    • remove

      default void remove(DashboardWidget... widgets)
      Removes the given widgets from this component.
      Parameters:
      widgets - the widgets to remove, not null
      Throws:
      IllegalArgumentException - if there is a widget whose non null parent is not this component
    • remove

      void remove(Collection<DashboardWidget> widgets)
      Removes the given widgets from this component.
      Parameters:
      widgets - the widgets to remove, not null
      Throws:
      IllegalArgumentException - if there is a widget whose non null parent is not this component
    • removeAll

      void removeAll()
      Removes all widgets from this component.