Package com.storedobject.ui
Class ObjectCard<T extends StoredObject>
java.lang.Object
com.vaadin.flow.component.Component
com.vaadin.flow.component.Composite<com.vaadin.flow.component.Component>
com.storedobject.ui.Card<T>
com.storedobject.ui.ObjectCard<T>
- Type Parameters:
T- the type of the object stored in the card, which must extend the StoredObject class
- All Implemented Interfaces:
PrintButton.HasPrintButton,SupportsConcurrentClick,com.vaadin.flow.component.AttachNotifier,com.vaadin.flow.component.DetachNotifier,com.vaadin.flow.component.HasComponents,com.vaadin.flow.component.HasElement,com.vaadin.flow.component.HasEnabled,com.vaadin.flow.component.HasStyle,Serializable
public class ObjectCard<T extends StoredObject>
extends Card<T>
implements PrintButton.HasPrintButton
Represents a generic card that holds a reference to an object of type T, where T is a subclass
of StoredObject. This class extends the functionality of the Card class.
- Author:
- Syam
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class com.storedobject.ui.Card
Card.Cell, Card.Column, Card.Line, Card.Row -
Constructor Summary
ConstructorsConstructorDescriptionConstructs an instance of ObjectCard with no initial configuration or root component.ObjectCard(com.vaadin.flow.component.Component root) Constructs an ObjectCard with the specified root component. -
Method Summary
Modifier and TypeMethodDescriptionList<com.vaadin.flow.component.Component> voidrefresh()Refreshes the content of the card.voidreload()Reloads the object and refreshes the card with updated data.voidsetMenuAnchor(com.vaadin.flow.component.Component menuAnchor) Sets the anchor component for the menu associated with the ObjectCard.voidSets the object of type T for this card.voidsetShowMenu(boolean showMenu) Sets whether the object-menu should be displayed for the ObjectCard.voidsetViewDetailsOnClick(boolean viewDetailsOnClick) Sets whether detailed information should be displayed when the ObjectCard is clicked.final voidshowMenu()Displays the menu associated with the Object currently set on the card.voidInvokes the dashboard to display the object associated with this ObjectCard.Methods inherited from class com.storedobject.ui.Card
alignBottom, alignCenter, alignTop, getConcurrentClick, getObject, getView, ignoreSelection, initContent, isIgnoreSelection, isSelected, justifyCenter, justifyLeft, justifyRight, onDetach, setColumnSpan, setRowSpan, setSelected, toggleSelectionMethods inherited from class com.vaadin.flow.component.Composite
getChildren, getContent, getElementMethods inherited from class com.vaadin.flow.component.Component
addListener, findAncestor, fireEvent, from, get, getEventBus, getId, getListeners, getLocale, getParent, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getUI, hasListener, isAttached, isTemplateMapped, isVisible, onAttach, 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.HasComponents
add, add, add, addComponentAsFirst, addComponentAtIndex, getChildren, getComponentAt, getComponentCount, indexOf, remove, remove, removeAll, replaceMethods 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.HasStyle
addClassName, addClassNames, getClassName, getClassNames, getStyle, hasClassName, removeClassName, removeClassNames, setClassName, setClassNameMethods inherited from interface com.storedobject.ui.SupportsConcurrentClick
registerClick
-
Constructor Details
-
ObjectCard
public ObjectCard()Constructs an instance of ObjectCard with no initial configuration or root component. This constructor initializes the ObjectCard using the default behavior of its parent class. -
ObjectCard
public ObjectCard(com.vaadin.flow.component.Component root) Constructs an ObjectCard with the specified root component. The root component represents the content to be displayed within the card. This constructor initializes the ObjectCard by invoking the parent Card class's constructor, applying default styles and layout settings.- Parameters:
root- the content component to be displayed within the ObjectCard. It is passed to the parent Card class as its content.
-
-
Method Details
-
refresh
public void refresh()Refreshes the content of the card. -
reload
public void reload()Reloads the object and refreshes the card with updated data. -
setObject
Description copied from class:CardSets the object of type T for this card. Display attributes of the card should be set based on the object's property values. If this method is overridden, the object must be set by invoking the superclass implementation.- Overrides:
setObjectin classCard<T extends StoredObject>- Parameters:
object- the object to be associated with this card must be of type T where T is a subclass of StoredObject
-
setShowMenu
public void setShowMenu(boolean showMenu) Sets whether the object-menu should be displayed for the ObjectCard.- Parameters:
showMenu- a boolean indicating whether to show the menu. If true, the menu will be displayed; if false, it will be hidden.
-
showMenu
public final void showMenu()Displays the menu associated with the Object currently set on the card. -
setViewDetailsOnClick
public void setViewDetailsOnClick(boolean viewDetailsOnClick) Sets whether detailed information should be displayed when the ObjectCard is clicked.- Parameters:
viewDetailsOnClick- a boolean indicating whether to enable the display of detailed information on click. If true, the detail view will be displayed when the card is clicked; if false, this behavior is disabled.
-
listMorePrintButtons
- Specified by:
listMorePrintButtonsin interfacePrintButton.HasPrintButton
-
setMenuAnchor
public 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.
-
viewObject
public void viewObject()Invokes the dashboard to display the object associated with this ObjectCard. If the dashboard is not null, the object retrieved fromgetObject()is passed to the dashboard'sviewObjectmethod for viewing.
-