Class DashboardWidget
java.lang.Object
com.vaadin.flow.component.Component
com.vaadin.flow.component.dashboard.DashboardWidget
- All Implemented Interfaces:
com.vaadin.flow.component.AttachNotifier,com.vaadin.flow.component.DetachNotifier,com.vaadin.flow.component.HasElement,com.vaadin.flow.component.HasStyle,Serializable
@Tag("vaadin-dashboard-widget")
@JsModule("@vaadin/dashboard/src/vaadin-dashboard-widget.js")
@NpmPackage(value="@vaadin/dashboard",
version="25.0.0-alpha19")
public class DashboardWidget
extends com.vaadin.flow.component.Component
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(com.vaadin.flow.component.Component content) Creates a widget with the specified content.DashboardWidget(String title) Creates a widget with the specified title.DashboardWidget(String title, com.vaadin.flow.component.Component content) Creates a widget with the specified title and content. -
Method Summary
Modifier and TypeMethodDescriptionintReturns the colspan of the widget.com.vaadin.flow.component.ComponentReturns the content of the widget.com.vaadin.flow.component.ComponentGets the content in the header content slot of this widget.intReturns the rowspan of the widget.getTitle()Returns the title of the widget.booleanvoidsetColspan(int colspan) Sets the colspan of the widget.voidsetContent(com.vaadin.flow.component.Component content) Sets the content to the widget.voidsetHeaderContent(com.vaadin.flow.component.Component header) Sets the content in the header content slot of this widget, replacing any existing header content.voidsetRowspan(int rowspan) Sets the rowspan of the widget.voidSets the title of the widget.voidsetVisible(boolean visible) 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, onAttach, onDetach, onEnabledStateChanged, removeFromParent, scrollIntoView, scrollIntoView, set, setElement, setIdMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.vaadin.flow.component.AttachNotifier
addAttachListenerMethods inherited from interface com.vaadin.flow.component.DetachNotifier
addDetachListenerMethods 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
public DashboardWidget(com.vaadin.flow.component.Component content) 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
widgetTitleproperty 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
public com.vaadin.flow.component.Component getContent()Returns the content of the widget. Returnsnullif the widget has no content.- Returns:
- the content of the widget
-
setContent
public void setContent(com.vaadin.flow.component.Component content) Sets the content to the widget. Setnullto remove the current content.- Parameters:
content- the content to set
-
getHeaderContent
public com.vaadin.flow.component.Component getHeaderContent()Gets the content in the header content slot of this widget.- Returns:
- the header content of this widget, or
nullif no header content has been set
-
setHeaderContent
public void setHeaderContent(com.vaadin.flow.component.Component header) Sets the content in the header content slot of this widget, replacing any existing header content.- Parameters:
header- the content to set, can benullto remove existing header content
-
setVisible
public void setVisible(boolean visible) - Overrides:
setVisiblein classcom.vaadin.flow.component.Component- Throws:
UnsupportedOperationException- Dashboard widget does not support setting visibility
-
isVisible
public boolean isVisible()- Overrides:
isVisiblein classcom.vaadin.flow.component.Component
-