Package com.storedobject.ui
Class ObjectTemplate<T>
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>
- Type Parameters:
T- The type of data this template can manage.
- All Implemented Interfaces:
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
- Direct Known Subclasses:
Dashboard,ObjectCardTemplate
A template-based component for displaying and managing an object and its associated objects in a UI.
- 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
FieldsModifier and TypeFieldDescriptionprotected TCurrent value of the object.The type of data this template is managing. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected com.vaadin.flow.component.ComponentcreateComponentForId(String id, String tag) Creates aComponentfor the given identifier and tag.final TRetrieves the stored object of type T.Retrieves the class type of the object managed by this template.voidThis method is called whenever the object is set.final voidSets the object and paint the component according to the object's attributes.Methods 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, setClassName
-
Field Details
-
objectClass
-
object
Current value of the object.
-
-
Constructor Details
-
ObjectTemplate
-
-
Method Details
-
setObject
Sets the object and paint the component according to the object's attributes.- Parameters:
object- the object to be stored may be null.
-
paint
This method is called whenever the object is set. Typically, this method is overridden by subclasses to provide custom painting logic.- Parameters:
object- Object to be painted.
-
getObject
Retrieves the stored object of type T.- Returns:
- the object of type T contained in this instance, or null if no object is set.
-
getObjectClass
-
createComponentForId
Description copied from class:HtmlTemplateCreates aComponentfor the given identifier and tag. If aComponentCreatoris available, it delegates the creation process. If no component is created by theComponentCreatoror if the result isnullor anISpan, additional logic is applied to create an appropriate component.- Overrides:
createComponentForIdin classHtmlTemplate- Parameters:
id- The identifier for which theComponentis to be created.tag- The HTML tag used to infer the type ofComponentto create.- Returns:
- The created
Component. If no specific component can be created, anHtmlobject based on the given tag and identifier is returned.
-