com.vaadin.flow.component.dashboard.
Class DashboardWidget
All Implemented Interfaces:
AttachNotifier
, DetachNotifier
, HasElement
, HasStyle
, Serializable
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 Summary
ConstructorsConstructorDescriptionCreates an empty widget.
DashboardWidget
(Component content) Creates a widget with the specified content.
DashboardWidget
(String title) Creates a widget with the specified title.
DashboardWidget
(String title, Component content) Creates a widget with the specified title and content.
-
Method Summary
Modifier and TypeMethodDescriptionint
Returns the colspan of the widget.
Returns the content of the widget.
Gets the content in the header content slot of this widget.
int
Returns the rowspan of the widget.
getTitle()
Returns the title of the widget.
boolean
Gets the component visibility value.
protected void
onAttach
(AttachEvent attachEvent) Called when the component is attached to a UI.
void
setColspan
(int colspan) Sets the colspan of the widget.
void
setContent
(Component content) Sets the content to the widget.
void
setHeaderContent
(Component header) Sets the content in the header content slot of this widget, replacing any existing header content.
void
setRowspan
(int rowspan) Sets the rowspan of the widget.
void
Sets the title of the widget.
void
setVisible
(boolean visible) Sets the component visibility value.
Methods inherited from class com.vaadin.flow.component.Component
addListener, findAncestor, fireEvent, from, get, getChildren, 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.HasStyle
addClassName, addClassNames, getClassName, getClassNames, getStyle, hasClassName, removeClassName, removeClassNames, setClassName, setClassName
-
Constructor Details
-
DashboardWidget
public DashboardWidget()Creates an empty widget.
-
DashboardWidget
Creates a widget with the specified title.
Parameters:
title
- the title to set -
DashboardWidget
Creates a widget with the specified content.
Parameters:
content
- the content to set -
DashboardWidget
Creates a widget with the specified title and content.
Parameters:
title
- the title to setcontent
- the content to set
-
-
Method Details
-
getTitle
Returns the title of the widget.
Returns:
the
widgetTitle
property from the web component -
setTitle
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
Returns the content of the widget. Returns
null
if the widget has no content.Returns:
the content of the widget
-
setContent
Sets the content to the widget. Set
null
to remove the current content.Parameters:
content
- the content to set -
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
Sets the content in the header content slot of this widget, replacing any existing header content.
Parameters:
header
- the content to set, can benull
to remove existing header content -
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 widget 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.
-