Class PrintButton
- All Implemented Interfaces:
com.vaadin.flow.component.AttachNotifier,com.vaadin.flow.component.DetachNotifier,com.vaadin.flow.component.HasElement,com.vaadin.flow.component.HasStyle,Serializable
ObjectEditors and
ObjectBrowsers if one or more PrintLogicDefinitions exist for the StoredObject class. The
"print button" may be a single button if there is only one PrintLogicDefinition defined, or it can contain
multiple buttons.
The most common use-case of PrintButton is to define logic for printing. For defining such logic, either
the PDFObjectReport or the ODTObjectReport may be
extended. If the ODTObjectReport is extended, the ODT template may be specified
in the PrintLogicDefinition.
The "printing logic" that is defined in the PrintLogicDefinition should have a constructor that
takes a Device and a StoredObject instance as its parameters. (Have a look at
the constructors - PDFObjectReport(Device, StoredObject) and
ODTObjectReport(Device, StoredObject)
Usage as a generic button: PrintButton may be used to invoke non-printing logic too by defining
any generic logic in the PrintLogicDefinition. The logic must implement
Runnable and must have a constructor that takes a
Device and a StoredObject instance as its parameters.
In ObjectEditor, by default, the PrintButton will be hidden if the object instance is null.
However, you can control this behaviour and control the visibility of it or its individual buttons by overriding
the ObjectEditor.enablePrintButtons(boolean) method.
- Author:
- Syam
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionstatic PrintButtoncreate(ObjectEditor<?> objectEditor) Create a "print button" for object editor.static PrintButtoncreate(ObjectGrid<?> objectGrid) Create a "print button" for object grid.static PrintButtoncreate(Class<? extends StoredObject> objectClass, Supplier<StoredObject> objectSupplier) Create a "print button" for object supplier.Get the button corresponding to the label passed.protected ButtonMethods 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, 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.HasStyle
addClassName, addClassNames, getClassName, getClassNames, getStyle, hasClassName, removeClassName, removeClassNames, setClassName, setClassName
-
Method Details
-
initContent
-
create
Create a "print button" for object editor.- Parameters:
objectEditor- Object editor for which the button to be created.- Returns:
- Print button.
-
create
Create a "print button" for object grid.- Parameters:
objectGrid- Object grid for which the button to be created.- Returns:
- Print button.
-
create
public static PrintButton create(Class<? extends StoredObject> objectClass, Supplier<StoredObject> objectSupplier) Create a "print button" for object supplier.- Parameters:
objectClass- Object class of the object supplier.objectSupplier- Object supplier for which the button to be created.- Returns:
- Print button.
-
getButton
Get the button corresponding to the label passed. (This could be used fromObjectEditor.enablePrintButtons(boolean)to selectively hide buttons.- Parameters:
label- Label of the button.- Returns:
- Button.
-
definitions
-