Package com.storedobject.ui
Class ObjectCardTemplate<T extends StoredObject>
java.lang.Object
com.vaadin.flow.component.Component
com.storedobject.ui.util.HtmlTemplate
com.storedobject.ui.TemplateLayout
com.storedobject.ui.TemplateComponent
com.storedobject.ui.ObjectTemplate<T>
com.storedobject.ui.ObjectCardTemplate<T>
- Type Parameters:
T- The type ofStoredObjectthis template can manage.
- All Implemented Interfaces:
ObjectSetter<T>,CardContent<T>,SupportsConcurrentClick,com.vaadin.flow.component.AttachNotifier,com.vaadin.flow.component.DetachNotifier,com.vaadin.flow.component.HasElement,com.vaadin.flow.component.HasSize,com.vaadin.flow.component.HasStyle,Serializable,Consumer<T>
public class ObjectCardTemplate<T extends StoredObject>
extends ObjectTemplate<T>
implements SupportsConcurrentClick, CardContent<T>, ObjectSetter<T>
A template-based component for displaying and managing object cards in a UI.
This class provides functionality to manage a card's object, set menu anchors,
and handle concurrent click events. It extends
TemplateComponent for
HTML and CSS-based templated designs and implements ObjectSetter,
SupportsConcurrentClick, and CardContent for integration with object data,
thread-safe click handling, and card management, respectively.- Author:
- Syam
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class com.storedobject.ui.util.HtmlTemplate
HtmlTemplate.ComponentCreator, HtmlTemplate.StreamSupplier, HtmlTemplate.StyleSupplier -
Field Summary
Fields inherited from class com.storedobject.ui.ObjectTemplate
object, objectClass -
Constructor Summary
ConstructorsConstructorDescriptionObjectCardTemplate(Class<T> objectClass) Constructor.ObjectCardTemplate(Class<T> objectClass, String templateCode) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionstatic <O extends StoredObject>
Supplier<ObjectCardTemplate<O>> createSupplier(Class<O> objectClass) Creates a supplier for anObjectCardTemplateinstance of the specified type.final ConcurrentClickfinal voidSets the card that this content is associated with.final voidsetMenuAnchor(com.vaadin.flow.component.Component menuAnchor) Sets the anchor component for the menu associated with the ObjectCard.Methods inherited from class com.storedobject.ui.ObjectTemplate
createComponentForId, getObject, getObjectClass, paint, setObjectMethods inherited from class com.storedobject.ui.TemplateLayout
centerMethods inherited from class com.storedobject.ui.util.HtmlTemplate
build, clearCache, createComponentForId, createSvgForId, isCreated, onAttach, setComponentCreator, setViewMethods 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, 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.vaadin.flow.component.DetachNotifier
addDetachListenerMethods inherited from interface com.vaadin.flow.component.HasElement
getElementMethods 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.storedobject.core.ObjectSetter
accept, getObjectClass, isAllowAny, setObject, setObjectMethods inherited from interface com.storedobject.ui.SupportsConcurrentClick
registerClick
-
Constructor Details
-
ObjectCardTemplate
-
ObjectCardTemplate
-
-
Method Details
-
createSupplier
public static <O extends StoredObject> Supplier<ObjectCardTemplate<O>> createSupplier(Class<O> objectClass) Creates a supplier for anObjectCardTemplateinstance of the specified type. This method determines the template class dynamically based on the provided object type and generates the appropriateObjectCardTemplatewith an associated template code or error message if the instantiation fails.- Type Parameters:
O- The type of the objects managed by theObjectCardTemplate.- Parameters:
objectClass- The class object representing the type that theObjectCardTemplatewill manage and represent.- Returns:
- A supplier that provides instances of
ObjectCardTemplatefor the given type. The supplier may return an instance containing an error message in case of an invalid template class or instantiation error.
-
getConcurrentClick
- Specified by:
getConcurrentClickin interfaceSupportsConcurrentClick
-
setMenuAnchor
public final void setMenuAnchor(com.vaadin.flow.component.Component menuAnchor) Sets the anchor component for the menu associated with the ObjectCard. The menu will use this component as its reference point for positioning. If the provided menuAnchor is null, the current ObjectCard instance will be used as the default anchor.- Parameters:
menuAnchor- the component to be used as the menu anchor. If null, the ObjectCard itself will be set as the anchor.
-
setCard
Description copied from interface:CardContentSets the card that this content is associated with.Sets the card that this content is associated with. This method is typically called by the card itself when the content is set to the card.
- Specified by:
setCardin interfaceCardContent<T extends StoredObject>- Parameters:
card- Card to be set
-