Package com.storedobject.ui
Class ObjectCardDashboard<T extends StoredObject>
java.lang.Object
com.vaadin.flow.component.Component
com.vaadin.flow.component.HtmlComponent
com.vaadin.flow.component.HtmlContainer
com.vaadin.flow.component.html.Div
com.storedobject.ui.ScrollingContent
com.storedobject.ui.CardDashboard
com.storedobject.ui.ObjectCardDashboard<T>
- Type Parameters:
T- The type of objects managed by this dashboard. It must extendStoredObject.
- All Implemented Interfaces:
FilterMethods<T>,ObjectLoader<T>,ObjectLoader<T>,ClickHandler,CloseableView,ExecutableView,ValueChangeHandler,com.vaadin.flow.component.AttachNotifier,com.vaadin.flow.component.ClickNotifier<com.vaadin.flow.component.html.Div>,com.vaadin.flow.component.ComponentEventListener<com.vaadin.flow.component.ClickEvent<? extends com.vaadin.flow.component.Component>>,com.vaadin.flow.component.DetachNotifier,com.vaadin.flow.component.HasComponents,com.vaadin.flow.component.HasElement,com.vaadin.flow.component.HasEnabled,com.vaadin.flow.component.HasOrderedComponents,com.vaadin.flow.component.HasSize,com.vaadin.flow.component.HasStyle,com.vaadin.flow.component.HasText,com.vaadin.flow.component.HasValue.ValueChangeListener,Serializable,Runnable,EventListener
public class ObjectCardDashboard<T extends StoredObject>
extends CardDashboard
implements ObjectLoader<T>
A specialized dashboard for managing and displaying cards representing objects of a specific type.
This class extends the functionality of
CardDashboard and integrates with an ObjectLoader
for loading and managing lists of objects of type T.- Author:
- Syam
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.storedobject.vaadin.ClickHandler
ClickHandler.ModifiedClickEvent<C extends com.vaadin.flow.component.Component>Nested classes/interfaces inherited from interface com.vaadin.flow.component.HasText
com.vaadin.flow.component.HasText.WhiteSpace -
Constructor Summary
ConstructorsConstructorDescriptionObjectCardDashboard(Class<T> objectClass) Constructs an ObjectCardDashboard instance to manage and display object cards.ObjectCardDashboard(Class<T> objectClass, boolean allowAny) Constructs a newObjectCardDashboardinstance for managing object-specific cards within the dashboard.ObjectCardDashboard(String className) Constructs an instance of ObjectCardDashboard using the class name provided. -
Method Summary
Modifier and TypeMethodDescriptionvoidcardLoaded(T object) Notifies the dashboard that a single object card has been successfully loaded.voidIndicates that all the cards have been successfully loaded into the dashboard.voidclear()Clear - remove all entries.protected ObjectCard<T> createCard(T object) Creates anObjectCardinstance for the specified object, adds a visual representation of the object to the card, and returns the created card.final ObjectLoader<T> getGrid()Retrieves theObjectCardGridassociated with this dashboard.getList()Retrieves the list of objects managed by the loader.The class of the instances.voidrefresh()Refresh the dashboardvoidRefreshes the state of the specified object in the dashboard.voidreload()Refresh the dashboard by reloading all objects and updating cards.voidRefreshes the state of the specified object in the dashboard.voidsetCardCreator(Function<T, ObjectCard<T>> cardCreator) Sets the card creator function for dynamically generatingObjectCardinstances based on objects of typeT.Methods inherited from class com.storedobject.ui.CardDashboard
execute, getCaption, getView, setCaptionMethods inherited from class com.storedobject.ui.ScrollingContent
getContent, getHeader, getMargin, setContent, setHeader, setHeaderHeight, setMarginMethods inherited from class com.vaadin.flow.component.HtmlComponent
getTitle, setTitleMethods 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, isVisible, onAttach, onDetach, onEnabledStateChanged, removeFromParent, scrollIntoView, scrollIntoView, set, setElement, setId, setVisibleMethods 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.storedobject.vaadin.ClickHandler
clicked, doubleClicked, onComponentEvent, rightClickedMethods inherited from interface com.vaadin.flow.component.ClickNotifier
addClickListener, addClickShortcut, addDoubleClickListener, addSingleClickListenerMethods inherited from interface com.vaadin.flow.component.DetachNotifier
addDetachListenerMethods inherited from interface com.storedobject.vaadin.ExecutableView
abort, clean, clearAlerts, clicked, close, createMenuItem, error, execute, getApplication, getMenuIconName, getMenuItem, getView, invoke, isCloseable, isFullScreen, isHomeView, log, log, message, returnedFrom, run, setClickable, speak, trackValueChange, tray, valueChanged, warningMethods inherited from interface com.storedobject.core.FilterMethods
getFilterCondition, setFilter, setFilter, setFilter, setFilter, setFilter, setFilter, setLoadFilter, setLoadFilter, setViewFilter, setViewFilterMethods inherited from interface com.vaadin.flow.component.HasComponents
add, add, add, addComponentAsFirst, addComponentAtIndex, remove, remove, removeAllMethods inherited from interface com.vaadin.flow.component.HasElement
getElementMethods inherited from interface com.vaadin.flow.component.HasEnabled
isEnabled, setEnabledMethods inherited from interface com.vaadin.flow.component.HasOrderedComponents
getChildren, getComponentAt, getComponentCount, indexOf, replaceMethods 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, setWidthFullMethods inherited from interface com.vaadin.flow.component.HasStyle
addClassName, addClassNames, getClassName, getClassNames, getStyle, hasClassName, removeClassName, removeClassNames, setClassName, setClassNameMethods inherited from interface com.vaadin.flow.component.HasText
getText, getWhiteSpace, setText, setWhiteSpaceMethods inherited from interface com.storedobject.core.ObjectLoader
applyFilter, canContain, getAllowAny, getLinkType, getMaster, getOrderBy, isAllowAny, load, load, load, load, load, load, load, load, load, load, load, load, load, load, load, load, load, load, load, load, load, load, setLinkType, setLinkType, setMaster, setMaster, setOrderBy, setOrderByMethods inherited from interface com.storedobject.ui.ObjectLoader
addDataLoadedListener, applyFilterPredicate, clear, get, getCacheLevel, getEffectiveCondition, getFixedFilter, getLoadFilter, getObjectCount, indexOf, load, setExtraFilter, setExtraFilter, setFilter, setFilter, setFixedFilter, setFixedFilter, setFixedFilter, setFixedFilter, size, streamAll, streamFilteredMethods inherited from interface com.storedobject.vaadin.ValueChangeHandler
valueChanged
-
Constructor Details
-
ObjectCardDashboard
-
ObjectCardDashboard
Constructs a newObjectCardDashboardinstance for managing object-specific cards within the dashboard. This constructor initializes the dashboard based on the provided object class by dynamically creating card instances and managing their lifecycle using an associated loader.- Parameters:
objectClass- The class of the objects this dashboard will manage. Used for dynamically resolving the object type and creating corresponding cards.allowAny- Determines if the dashboard should allow managing any inherited object of the specified type.
-
ObjectCardDashboard
Constructs an instance of ObjectCardDashboard using the class name provided. The constructor initializes the dashboard by determining the class type from the given name, sets up the object loader, and loads the necessary data.- Parameters:
className- The name of the class to be used for creating the object cards. The class name may end with "/any" to allow additional flexibility for specifying the inherited object type.- Throws:
Exception- If an error occurs during class loading or initialization.
-
-
Method Details
-
cardsLoaded
public void cardsLoaded()Indicates that all the cards have been successfully loaded into the dashboard. This method is typically called once the card-loading process is complete, ensuring that the dashboard and its associated components are properly updated to reflect the current state of the loaded data. It can be used to perform any post-loading operations required for maintaining the integrity of the dashboard's structure and visual presentation. -
cardLoaded
Notifies the dashboard that a single object card has been successfully loaded. This method handles actions related to the loading of an individual object card and may trigger other lifecycle updates in the dashboard.- Parameters:
object- The object whose card has been loaded and is ready to be added or displayed in the dashboard.
-
setCardCreator
Sets the card creator function for dynamically generatingObjectCardinstances based on objects of typeT. The dashboard uses the provided function internally to create and manage object-specific cards.- Parameters:
cardCreator- AFunctionthat takes an object of typeTas input and returns anObjectCard<T>instance. This function facilitates the custom generation of cards for objects managed in the dashboard.
-
createCard
Creates anObjectCardinstance for the specified object, adds a visual representation of the object to the card, and returns the created card.- Parameters:
object- the object of typeTfor which the card is to be created. The object is used to generate a displayable representation within the card.- Returns:
- an instance of
ObjectCard<T>containing the visual representation of the provided object.
-
getObjectClass
Description copied from interface:ObjectLoaderThe class of the instances.- Specified by:
getObjectClassin interfaceObjectLoader<T extends StoredObject>- Returns:
- The class of the instances to load.
-
getList
-
clear
public void clear()Description copied from interface:ObjectLoaderClear - remove all entries.- Specified by:
clearin interfaceObjectLoader<T extends StoredObject>
-
reload
public void reload()Refresh the dashboard by reloading all objects and updating cards.- Specified by:
reloadin interfaceObjectLoader<T extends StoredObject>
-
reload
Refreshes the state of the specified object in the dashboard. The associated object is reloaded in the internal list, and its corresponding card in the grid is updated.- Parameters:
object- The object to be refreshed in the dashboard.
-
refresh
public void refresh()Refresh the dashboard -
refresh
Refreshes the state of the specified object in the dashboard. If the object exists in the internal list, its corresponding card is updated in the grid.- Parameters:
object- The object to be refreshed in the dashboard.
-
getGrid
Retrieves theObjectCardGridassociated with this dashboard. TheObjectCardGridis a specialized version of aCardGrid, designed to manage and display cards representing objects of typeT.- Overrides:
getGridin classCardDashboard- Returns:
- the
ObjectCardGrid<T>instance linked to this dashboard, allowing interaction and management of object-specific cards.
-
getDelegatedLoader
- Specified by:
getDelegatedLoaderin interfaceObjectLoader<T extends StoredObject>
-