com.vaadin.flow.component.dashboard.

Class Dashboard

java.lang.Object
com.vaadin.flow.component.Component
com.vaadin.flow.component.dashboard.Dashboard

All Implemented Interfaces:

AttachNotifier, HasWidgets, DetachNotifier, HasElement, HasSize, HasStyle, Serializable

@Tag("vaadin-dashboard") @NpmPackage(value="@vaadin/polymer-legacy-adapter",version="24.7.0-alpha7") @NpmPackage(value="@vaadin/dashboard",version="24.7.0-alpha7") @JsModule("@vaadin/polymer-legacy-adapter/style-modules.js") @JsModule("@vaadin/dashboard/src/vaadin-dashboard.js") @JsModule("./flow-component-renderer.js") public class Dashboard extends Component implements HasWidgets, HasSize

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:

  • Constructor Details

    • Dashboard

      public Dashboard()

      Creates an empty dashboard.

  • Method Details

    • addSection

      public DashboardSection addSection()

      Adds an empty section to this dashboard.

    • addSection

      public DashboardSection addSection(String title)

      Adds an empty section to this dashboard.

      Parameters:

      title - the title of the section

    • addSection

      public void addSection(DashboardSection section)

      Adds the given section to this dashboard.

      Parameters:

      section - the widgets to add, not null

    • getWidgets

      public List<DashboardWidget> getWidgets()

      Returns a flattened list of all the widgets in this dashboard. This includes the nested widgets in sections.

      Specified by:

      getWidgets in interface HasWidgets

      Returns:

      The flattened list of all widgets in this dashboard

    • add

      public void add(Collection<DashboardWidget> widgets)

      Description copied from interface: HasWidgets

      Adds the given widgets to this component.

      Specified by:

      add in interface HasWidgets

      Parameters:

      widgets - the widgets to add, not null

    • addWidgetAtIndex

      public void addWidgetAtIndex(int index, DashboardWidget widget)

      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 with getWidgets() since the position in the flattened widget list returned by getWidgets() 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 interface HasWidgets

      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

      See Also:

    • remove

      public void remove(Collection<DashboardWidget> widgets)

      Description copied from interface: HasWidgets

      Removes the given widgets from this component.

      Specified by:

      remove in interface HasWidgets

      Parameters:

      widgets - the widgets to remove, not null

    • remove

      public void remove(DashboardSection section)

      Removes the given section from this component.

      Parameters:

      section - the section to remove, not null

      Throws:

      IllegalArgumentException - if the non null parent of the section is not this component

    • removeAll

      public void removeAll()

      Removes all widgets and sections from this component.

      Specified by:

      removeAll in interface HasWidgets

    • getMaximumColumnCount

      public Integer getMaximumColumnCount()

      Returns the maximum column count of the dashboard.

      Returns:

      the maximum column count of the dashboard

    • setMaximumColumnCount

      public void setMaximumColumnCount(Integer maxColCount)

      Sets the maximum column count of the dashboard.

      Parameters:

      maxColCount - the new maximum column count. Pass in null to set the maximum column count back to the default value.

    • getMinimumColumnWidth

      public String getMinimumColumnWidth()

      Returns the minimum column width of the dashboard.

      Returns:

      the minimum column width of the dashboard

    • setMinimumColumnWidth

      public void setMinimumColumnWidth(String minColWidth)

      Sets the minimum column width of the dashboard.

      Parameters:

      minColWidth - the new minimum column width. Pass in null to set the minimum column width back to the default value.

    • getMaximumColumnWidth

      public String getMaximumColumnWidth()

      Returns the maximum column width of the dashboard.

      Returns:

      the maximum column width of the dashboard

    • setMaximumColumnWidth

      public void setMaximumColumnWidth(String maxColWidth)

      Sets the maximum column width of the dashboard.

      Parameters:

      maxColWidth - the new maximum column width. Pass in null to set the maximum column width back to the default value.

    • getMinimumRowHeight

      public String getMinimumRowHeight()

      Returns the minimum row height of the dashboard.

      Returns:

      the minimum row height of the dashboard

    • setMinimumRowHeight

      public void setMinimumRowHeight(String minRowHeight)

      Sets the minimum row height of the dashboard.

      Parameters:

      minRowHeight - the new minimum row height. Pass in null to set the minimum row height back to the default value.

    • getGap

      public String getGap()

      Returns the gap of the dashboard. This value adjusts the gap between elements within the dashboard.

      Returns:

      the gap of the dashboard

    • setGap

      public void setGap(String gap)

      Sets the gap of the dashboard. This value adjusts the gap between elements within the dashboard.

      Parameters:

      gap - the new gap. Pass in null to set the gap back to the default value.

    • getPadding

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

      public void setPadding(String padding)

      Sets the padding of the dashboard. This value adjusts the space around the outer edges of the dashboard.

      Parameters:

      padding - the new padding. Pass in null 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

      public Registration addItemMovedListener(ComponentEventListener<DashboardItemMovedEvent> listener)

      Adds an item moved listener to this dashboard.

      Parameters:

      listener - the listener to add, not null

      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, not null

      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, not null

      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, not null

      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, not null

      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, not null

      Returns:

      a handle that can be used for removing the listener

    • getI18n

      public Dashboard.DashboardI18n 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

      public void setI18n(Dashboard.DashboardI18n i18n)

      Sets the internationalization object for this component.

      Parameters:

      i18n - the i18n object, not null

    • getChildren

      public Stream<Component> 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 class Component

      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 class Component

      Parameters:

      visible - the component visibility value

      Throws:

      UnsupportedOperationException - Dashboard does not support setting visibility

    • 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

    • onAttach

      protected void onAttach(AttachEvent attachEvent)

      Description copied from class: Component

      Called when the component is attached to a UI.

      This method is invoked before the AttachEvent is fired for the component.

      Make sure to call super.onAttach when overriding this method.

      Overrides:

      onAttach in class Component

      Parameters:

      attachEvent - the attach event