Class ReportSpreadsheetView
java.lang.Object
com.vaadin.flow.component.Component
com.vaadin.flow.component.Composite<ViewLayout>
io.jmix.flowui.view.View<ViewLayout>
io.jmix.flowui.view.StandardView
io.jmix.reportsspreadsheetflowui.view.ReportSpreadsheetView
- All Implemented Interfaces:
com.vaadin.flow.component.AttachNotifier,com.vaadin.flow.component.DetachNotifier,com.vaadin.flow.component.HasElement,com.vaadin.flow.component.HasStyle,com.vaadin.flow.router.AfterNavigationObserver,com.vaadin.flow.router.BeforeEnterObserver,com.vaadin.flow.router.BeforeLeaveObserver,com.vaadin.flow.router.HasDynamicTitle,com.vaadin.flow.router.internal.AfterNavigationHandler,com.vaadin.flow.router.internal.BeforeEnterHandler,com.vaadin.flow.router.internal.BeforeLeaveHandler,FacetOwner,FragmentOwner,Serializable
@Route(value="report/spreadsheets",
layout=DefaultMainViewParent.class)
@ViewController("report_ReportSpreadsheetView")
@ViewDescriptor("report-spreadsheet-view.xml")
@DialogMode(width="80em",
height="65em",
resizable=true)
public class ReportSpreadsheetView
extends StandardView
View that renders a generated spreadsheet report and allows downloading the current workbook state.
Can be opened either as a dialog or via navigation to its route.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class io.jmix.flowui.view.View
View.AfterCloseEvent, View.BeforeCloseEvent, View.BeforeShowEvent, View.InitEvent, View.PostReadyEvent, View.QueryParametersChangeEvent, View.ReadyEvent, View.RestoreComponentsStateEvent -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected booleanprotected byte[]protected Stringprotected FileRefprotected FileStorageLocatorprotected MessageBundleprotected Notificationsprotected OpenedDialogWindowsprotected JmixButtonprotected ReportDownloaderprotected com.vaadin.flow.component.spreadsheet.Spreadsheetprotected ViewNavigators -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected StringbuildDownloadFileName(String extension) protected voidcloseOtherDialogs(@Nullable com.vaadin.flow.component.UI ui) Closes any other dialog views that remained open (e.g.protected byte[]Returns the current content of theSpreadsheetcomponent, including unsaved user edits, to be handed over to another instance of this view.voidReads the configured spreadsheet content into theSpreadsheetcomponent.protected voidonBeforeShow(View.BeforeShowEvent event) protected voidonCloseBtnClick(com.vaadin.flow.component.ClickEvent<JmixButton> event) protected voidonDownloadBtnClick(com.vaadin.flow.component.ClickEvent<JmixButton> event) protected voidonOpenInViewBtnClick(com.vaadin.flow.component.ClickEvent<JmixButton> event) protected voidonReady(View.ReadyEvent event) protected InputStreamprotected StringvoidsetContent(ReportSpreadsheetContent content) Sets the generated report content to be opened by this view.voidsetDocumentContent(byte[] documentContent) Sets generated report content to be opened by this view.voidsetDocumentName(@Nullable String documentName) Sets the report document name shown by the view and used for download.voidsetFileRef(FileRef fileRef) Sets a stored report document reference to be opened by this view.static voidsetPendingContent(@Nullable com.vaadin.flow.component.UI ui, ReportSpreadsheetContent content) Hands the report content over to theReportSpreadsheetViewinstance the specified UI navigates to next.protected voidApplies the content handed over bysetPendingContent(UI, ReportSpreadsheetContent), if any.Methods inherited from class io.jmix.flowui.view.View
addAfterCloseListener, addApplicationListeners, addBeforeCloseListener, addBeforeShowListener, addInitListener, addQueryParametersChangeListener, addReadyListener, addRestoreComponentsStateEventListener, afterNavigation, beforeEnter, beforeLeave, close, close, closeWithDefaultAction, configureDialogWindowFooter, configureDialogWindowHeader, getApplicationContext, getEventBus, getId, getReturnParameters, getViewActions, getViewAttributes, getViewData, getViewFacets, getViewSupport, isPreventBrowserTabClosing, onAttach, onAttachInternal, onDetach, onDetachInternal, processBeforeEnterInternal, removeApplicationListeners, removeViewAttributes, setAfterNavigationHandler, setApplicationContext, setId, setPageTitle, setPreventBrowserTabClosing, setViewActions, setViewData, setViewFacets, unregisterBackNavigationMethods inherited from class com.vaadin.flow.component.Composite
getChildren, getContent, getElement, initContentMethods inherited from class com.vaadin.flow.component.Component
addListener, bindVisible, findAncestor, fireEvent, from, get, getListeners, getLocale, getParent, getTestId, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getUI, hasListener, isAttached, isTemplateMapped, isVisible, onEnabledStateChanged, removeFromParent, scrollIntoView, scrollIntoView, set, setElement, setTestId, setVisible, whenAttachedMethods 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, bindClassName, bindClassNames, getClassName, getClassNames, getStyle, hasClassName, removeClassName, removeClassNames, setClassName, setClassName
-
Field Details
-
spreadsheet
-
messageBundle
-
openInViewBtn
-
fileStorageLocator
-
notifications
-
reportDownloader
-
openedDialogWindows
-
documentContent
protected byte[] documentContent -
fileRef
-
documentName
-
contentLoaded
protected boolean contentLoaded
-
-
Constructor Details
-
ReportSpreadsheetView
public ReportSpreadsheetView()
-
-
Method Details
-
setDocumentContent
public void setDocumentContent(byte[] documentContent) Sets generated report content to be opened by this view. -
setDocumentName
Sets the report document name shown by the view and used for download. -
setFileRef
Sets a stored report document reference to be opened by this view. -
setContent
Sets the generated report content to be opened by this view. -
setPendingContent
public static void setPendingContent(@Nullable com.vaadin.flow.component.UI ui, ReportSpreadsheetContent content) Hands the report content over to theReportSpreadsheetViewinstance the specified UI navigates to next.The content is stored in the UI instead of being passed by a navigation callback, because such a callback is delivered on detaching the origin view: for a dialog that has already been closed it arrives after the target view has been rendered, or does not arrive at all. The target view takes the stored content itself on
View.BeforeShowEvent, so theSpreadsheetis filled before it is rendered for the first time. -
getPageTitle
- Specified by:
getPageTitlein interfacecom.vaadin.flow.router.HasDynamicTitle- Overrides:
getPageTitlein classView<ViewLayout>
-
onBeforeShow
-
onReady
-
takePendingContent
protected void takePendingContent()Applies the content handed over bysetPendingContent(UI, ReportSpreadsheetContent), if any. The pending content is always removed from the UI, but is applied only when this view has no content of its own, so that a view configured directly, e.g. opened as a dialog, is not overwritten. -
loadContent
public void loadContent()Reads the configured spreadsheet content into theSpreadsheetcomponent. Idempotent: subsequent invocations (e.g. on a repeated lifecycle event) are no-ops, and the method does nothing untilsetDocumentContent(byte[])orsetFileRef(FileRef)has been called. -
onOpenInViewBtnClick
@Subscribe("openInViewBtn") protected void onOpenInViewBtnClick(com.vaadin.flow.component.ClickEvent<JmixButton> event) -
getCurrentContent
protected byte[] getCurrentContent()Returns the current content of theSpreadsheetcomponent, including unsaved user edits, to be handed over to another instance of this view. Returnsnullif no content has been loaded yet or the current workbook cannot be written, so the caller falls back to the originally provided content. -
closeOtherDialogs
protected void closeOtherDialogs(@Nullable com.vaadin.flow.component.UI ui) Closes any other dialog views that remained open (e.g. the input parameters dialog stacked behind this view), so that the navigation target is shown without leftover modal layers. -
onDownloadBtnClick
@Subscribe("downloadBtn") protected void onDownloadBtnClick(com.vaadin.flow.component.ClickEvent<JmixButton> event) -
onCloseBtnClick
@Subscribe("closeBtn") protected void onCloseBtnClick(com.vaadin.flow.component.ClickEvent<JmixButton> event) -
openInputStream
- Throws:
IOException
-
resolveWorkbookExtension
-
buildDownloadFileName
-