com.vaadin.flow.component.dashboard.
Class Dashboard
All Implemented Interfaces:
AttachNotifier
, HasWidgets
, DetachNotifier
, HasElement
, HasSize
, HasStyle
, Serializable
Dashboard is a responsive layout component that allows users to organize widgets either directly within the dashboard or optionally group them into sections. The component supports customizable layout options like maximum column count.
Internationalization (i18n) is supported through Dashboard.DashboardI18n
,
allowing customization of accessible names for the dashboard controls. The
i18n object can be set using setI18n(DashboardI18n)
.
Author:
Vaadin Ltd
See Also:
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
add
(Collection<DashboardWidget> widgets) Adds the given widgets to this component.
Adds an item moved listener to this dashboard.
Adds an item move mode change listener to this dashboard.
Adds an item removed listener to this dashboard.
Adds an item resized listener to this dashboard.
addItemResizeModeChangedListener
(ComponentEventListener<DashboardItemResizeModeChangedEvent> listener) Adds an item resize mode change listener to this dashboard.
Adds an item selected change listener to this dashboard.
Adds an empty section to this dashboard.
void
addSection
(DashboardSection section) Adds the given section to this dashboard.
addSection
(String title) Adds an empty section to this dashboard.
void
addWidgetAtIndex
(int index, DashboardWidget widget) Adds the given widget as child of this dashboard at the specific index.
Gets the child components of this component.
getGap()
Returns the gap of the dashboard.
getI18n()
Gets the internationalization object previously set for this component.
Returns the maximum column count of the dashboard.
Returns the maximum column width of the dashboard.
Returns the minimum column width of the dashboard.
Returns the minimum row height of the dashboard.
Returns the padding of the dashboard.
Returns a flattened list of all the widgets in this dashboard.
boolean
Returns whether the dashboard layout is dense.
boolean
Returns whether the dashboard is editable.
boolean
Gets the component visibility value.
protected void
onAttach
(AttachEvent attachEvent) Called when the component is attached to a UI.
void
remove
(DashboardSection section) Removes the given section from this component.
void
remove
(Collection<DashboardWidget> widgets) Removes the given widgets from this component.
void
Removes all widgets and sections from this component.
void
setDenseLayout
(boolean dense) Sets the dashboard layout dense.
void
setEditable
(boolean editable) Sets the dashboard editable.
void
Sets the gap of the dashboard.
void
Sets the internationalization object for this component.
void
setMaximumColumnCount
(Integer maxColCount) Sets the maximum column count of the dashboard.
void
setMaximumColumnWidth
(String maxColWidth) Sets the maximum column width of the dashboard.
void
setMinimumColumnWidth
(String minColWidth) Sets the minimum column width of the dashboard.
void
setMinimumRowHeight
(String minRowHeight) Sets the minimum row height of the dashboard.
void
setPadding
(String padding) Sets the padding of the dashboard.
void
setVisible
(boolean visible) Sets the component visibility value.
Methods inherited from class com.vaadin.flow.component.Component
addListener, findAncestor, fireEvent, from, get, getElement, getEventBus, getId, getListeners, getLocale, getParent, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getUI, hasListener, isAttached, isTemplateMapped, 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.HasElement
getElement
Methods inherited from interface com.vaadin.flow.component.HasSize
getHeight, getHeightUnit, getMaxHeight, getMaxWidth, getMinHeight, getMinWidth, getWidth, getWidthUnit, setHeight, setHeight, setHeightFull, setMaxHeight, setMaxHeight, setMaxWidth, setMaxWidth, setMinHeight, setMinHeight, setMinWidth, setMinWidth, setSizeFull, setSizeUndefined, setWidth, setWidth, setWidthFull
Methods inherited from interface com.vaadin.flow.component.HasStyle
addClassName, addClassNames, getClassName, getClassNames, getStyle, hasClassName, removeClassName, removeClassNames, setClassName, setClassName
Methods inherited from interface com.vaadin.flow.component.dashboard.HasWidgets
add, remove
-
Constructor Details
-
Dashboard
public Dashboard()Creates an empty dashboard.
-
-
Method Details
-
addSection
Adds an empty section to this dashboard.
-
addSection
Adds an empty section to this dashboard.
Parameters:
title
- the title of the section -
addSection
Adds the given section to this dashboard.
Parameters:
section
- the widgets to add, notnull
-
getWidgets
Returns a flattened list of all the widgets in this dashboard. This includes the nested widgets in sections.
Specified by:
getWidgets
in interfaceHasWidgets
Returns:
The flattened list of all widgets in this dashboard
-
add
Description copied from interface:
HasWidgets
Adds the given widgets to this component.
Specified by:
add
in interfaceHasWidgets
Parameters:
widgets
- the widgets to add, notnull
-
addWidgetAtIndex
Adds the given widget as child of this dashboard at the specific index.
The index specifies the intended position within the root item list returned by
getChildren()
. It should not be used withgetWidgets()
since the position in the flattened widget list returned bygetWidgets()
might not match the intended position.In case the specified widget has already been added to another parent, it will be removed from there and added to this one.
Specified by:
addWidgetAtIndex
in interfaceHasWidgets
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
See Also:
-
remove
Description copied from interface:
HasWidgets
Removes the given widgets from this component.
Specified by:
remove
in interfaceHasWidgets
Parameters:
widgets
- the widgets to remove, notnull
-
remove
Removes the given section from this component.
Parameters:
section
- the section to remove, notnull
Throws:
IllegalArgumentException
- if the nonnull
parent of the section is not this component -
removeAll
public void removeAll()Removes all widgets and sections from this component.
Specified by:
removeAll
in interfaceHasWidgets
-
getMaximumColumnCount
Returns the maximum column count of the dashboard.
Returns:
the maximum column count of the dashboard
-
setMaximumColumnCount
Sets the maximum column count of the dashboard.
Parameters:
maxColCount
- the new maximum column count. Pass innull
to set the maximum column count back to the default value. -
getMinimumColumnWidth
Returns the minimum column width of the dashboard.
Returns:
the minimum column width of the dashboard
-
setMinimumColumnWidth
Sets the minimum column width of the dashboard.
Parameters:
minColWidth
- the new minimum column width. Pass innull
to set the minimum column width back to the default value. -
getMaximumColumnWidth
Returns the maximum column width of the dashboard.
Returns:
the maximum column width of the dashboard
-
setMaximumColumnWidth
Sets the maximum column width of the dashboard.
Parameters:
maxColWidth
- the new maximum column width. Pass innull
to set the maximum column width back to the default value. -
getMinimumRowHeight
Returns the minimum row height of the dashboard.
Returns:
the minimum row height of the dashboard
-
setMinimumRowHeight
Sets the minimum row height of the dashboard.
Parameters:
minRowHeight
- the new minimum row height. Pass innull
to set the minimum row height back to the default value. -
getGap
Returns the gap of the dashboard. This value adjusts the gap between elements within the dashboard.
Returns:
the gap of the dashboard
-
setGap
Sets the gap of the dashboard. This value adjusts the gap between elements within the dashboard.
Parameters:
gap
- the new gap. Pass innull
to set the gap back to the default value. -
getPadding
Returns the padding of the dashboard. This value adjusts the space around the outer edges of the dashboard.
Returns:
the padding of the dashboard
-
setPadding
Sets the padding of the dashboard. This value adjusts the space around the outer edges of the dashboard.
Parameters:
padding
- the new padding. Pass innull
to set the padding back to the default value. -
setEditable
public void setEditable(boolean editable) Sets the dashboard editable.
Parameters:
editable
- whether to set the dashboard editable -
isEditable
public boolean isEditable()Returns whether the dashboard is editable.
Returns:
whether the dashboard is editable
-
setDenseLayout
public void setDenseLayout(boolean dense) Sets the dashboard layout dense.
Parameters:
dense
- whether to set the dashboard layout dense -
isDenseLayout
public boolean isDenseLayout()Returns whether the dashboard layout is dense.
Returns:
whether the dashboard layout is dense
-
addItemMovedListener
Adds an item moved listener to this dashboard.
Parameters:
listener
- the listener to add, notnull
Returns:
a handle that can be used for removing the listener
-
addItemResizedListener
public Registration addItemResizedListener(ComponentEventListener<DashboardItemResizedEvent> listener) Adds an item resized listener to this dashboard.
Parameters:
listener
- the listener to add, notnull
Returns:
a handle that can be used for removing the listener
-
addItemRemovedListener
public Registration addItemRemovedListener(ComponentEventListener<DashboardItemRemovedEvent> listener) Adds an item removed listener to this dashboard.
Parameters:
listener
- the listener to add, notnull
Returns:
a handle that can be used for removing the listener
-
addItemSelectedChangedListener
public Registration addItemSelectedChangedListener(ComponentEventListener<DashboardItemSelectedChangedEvent> listener) Adds an item selected change listener to this dashboard.
Parameters:
listener
- the listener to add, notnull
Returns:
a handle that can be used for removing the listener
-
addItemMoveModeChangedListener
public Registration addItemMoveModeChangedListener(ComponentEventListener<DashboardItemMoveModeChangedEvent> listener) Adds an item move mode change listener to this dashboard.
Parameters:
listener
- the listener to add, notnull
Returns:
a handle that can be used for removing the listener
-
addItemResizeModeChangedListener
public Registration addItemResizeModeChangedListener(ComponentEventListener<DashboardItemResizeModeChangedEvent> listener) Adds an item resize mode change listener to this dashboard.
Parameters:
listener
- the listener to add, notnull
Returns:
a handle that can be used for removing the listener
-
getI18n
Gets the internationalization object previously set for this component.
NOTE: Updating the instance that is returned from this method will not update the component if not set again using
setI18n(DashboardI18n)
Returns:
the i18n object or
null
if no i18n object has been set -
setI18n
Sets the internationalization object for this component.
Parameters:
i18n
- the i18n object, notnull
-
getChildren
Description copied from class:
Component
Gets the child components of this component.
The default implementation finds child components by traversing each child
Element
tree.If the component is injected to a PolymerTemplate using the
@Id
annotation the getChildren method will only return children added from the server side and will not return any children declared in the template file.Overrides:
getChildren
in classComponent
Returns:
the child components of this component
See Also:
-
setVisible
public void setVisible(boolean visible) Description copied from class:
Component
Sets the component visibility value.
When a component is set as invisible, all the updates of the component from the server to the client are blocked until the component is set as visible again.
Invisible components don't receive any updates from the client-side. Unlike the server-side updates, client-side updates, if any, are discarded while the component is invisible, and are not transmitted to the server when the component is made visible.
Overrides:
setVisible
in classComponent
Parameters:
visible
- the component visibility valueThrows:
UnsupportedOperationException
- Dashboard does not support setting visibility -
isVisible
public boolean isVisible()Description copied from class:
Component
Gets the component visibility value.
-
onAttach
Description copied from class:
Component
Called when the component is attached to a UI.
This method is invoked before the
Make sure to callAttachEvent
is fired for the component.super.onAttach
when overriding this method.
-