Interface HasWidgets
- All Superinterfaces:
Serializable
- All Known Implementing Classes:
Dashboard,DashboardSection
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 Summary
Modifier and TypeMethodDescriptiondefault voidadd(DashboardWidget... widgets) Adds the given widgets to this component.voidadd(Collection<DashboardWidget> widgets) Adds the given widgets to this component.voidaddWidgetAfter(DashboardWidget referenceWidget, DashboardWidget newWidget) Adds the given widget immediately after the reference widget.voidaddWidgetAtIndex(int index, DashboardWidget widget) Adds the given widget as child of this component at the specific index.Returns the widgets in this component.default voidremove(DashboardWidget... widgets) Removes the given widgets from this component.voidremove(Collection<DashboardWidget> widgets) Removes the given widgets from this component.voidRemoves all widgets from this component.
-
Method Details
-
getWidgets
List<DashboardWidget> getWidgets()Returns the widgets in this component.- Returns:
- The widgets in this component
-
add
Adds the given widgets to this component.- Parameters:
widgets- the widgets to add, notnull
-
add
Adds the given widgets to this component.- Parameters:
widgets- the widgets to add, notnull
-
addWidgetAtIndex
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 countwidget- the widget to add, notnull
-
addWidgetAfter
Adds the given widget immediately after the reference widget.If the reference widget is located within a section, the new widget will be added to the same section, positioned after the reference widget. If the reference widget is at the root level of the dashboard, the new widget will be added at the root level, positioned after the reference widget.
In case the new widget has already been added to another parent, it will be removed from there and added to the appropriate location.
- Parameters:
referenceWidget- the widget after which the new widget will be added, notnullnewWidget- the widget to add, notnull- Throws:
IllegalArgumentException- if the reference widget is not found in this component or any of its sections
-
remove
Removes the given widgets from this component.- Parameters:
widgets- the widgets to remove, notnull- Throws:
IllegalArgumentException- if there is a widget whose nonnullparent is not this component
-
remove
Removes the given widgets from this component.- Parameters:
widgets- the widgets to remove, notnull- Throws:
IllegalArgumentException- if there is a widget whose nonnullparent is not this component
-
removeAll
void removeAll()Removes all widgets from this component.
-