java.lang.Object
jku.se.Controller.BaseStatisticController
- Direct Known Subclasses:
StatisticReimbursementPerMonthController
,StatisticSupermarketRestaurantController
Abstract base controller class for exporting statistical data in various formats (PDF, CSV, JSON).
Provides common export functionality and standardized feedback messages via JavaFX
Text
.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void
exportData
(Map<String, ?> data, String fileNamePrefix, String format, javafx.scene.text.Text statusText) Exports a generic data map to the specified format (JSON, PDF, or CSV).protected void
exportReimbursementJson
(javafx.scene.text.Text statusText, String fileName, Map<String, Object> userDetails, double total) Exports user reimbursement data to JSON format with additional metadata (month, total).protected void
exportSingleFormat
(javafx.scene.text.Text statusText, String fileName, Map<String, ?> data, String title, String format) Exports a single data map to either PDF or CSV format.protected void
Updates thestatusText
with an error message in red.protected void
showSuccess
(javafx.scene.text.Text statusText, String message) Updates thestatusText
with a success message in green.
-
Constructor Details
-
BaseStatisticController
public BaseStatisticController()
-
-
Method Details
-
exportSingleFormat
protected void exportSingleFormat(javafx.scene.text.Text statusText, String fileName, Map<String, ?> data, String title, String format) Exports a single data map to either PDF or CSV format.- Parameters:
statusText
- the Text element used to display success or error messagesfileName
- the base name of the exported filedata
- the data to export (e.g., key-value pairs)title
- the title to use in the export file (used in PDF)format
- the export format ("PDF" or "CSV")
-
exportReimbursementJson
protected void exportReimbursementJson(javafx.scene.text.Text statusText, String fileName, Map<String, Object> userDetails, double total) Exports user reimbursement data to JSON format with additional metadata (month, total).- Parameters:
statusText
- the Text element used to display messagesfileName
- the name of the exported file (without extension)userDetails
- the reimbursement data per usertotal
- the total reimbursement value
-
exportData
protected void exportData(Map<String, ?> data, String fileNamePrefix, String format, javafx.scene.text.Text statusText) Exports a generic data map to the specified format (JSON, PDF, or CSV).- Parameters:
data
- the data to exportfileNamePrefix
- the prefix for the exported file nameformat
- the export format ("JSON", "PDF", or "CSV")statusText
- the Text element to display result messages
-
showSuccess
Updates thestatusText
with a success message in green.- Parameters:
statusText
- the Text element to updatemessage
- the message to display
-
showError
Updates thestatusText
with an error message in red.- Parameters:
statusText
- the Text element to updatemessage
- the message to display
-