Module Lunchify

Class BaseStatisticController

java.lang.Object
jku.se.Controller.BaseStatisticController
Direct Known Subclasses:
StatisticReimbursementPerMonthController, StatisticSupermarketRestaurantController

public abstract class BaseStatisticController extends Object
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 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 messages
      fileName - the base name of the exported file
      data - 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 messages
      fileName - the name of the exported file (without extension)
      userDetails - the reimbursement data per user
      total - 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 export
      fileNamePrefix - the prefix for the exported file name
      format - the export format ("JSON", "PDF", or "CSV")
      statusText - the Text element to display result messages
    • showSuccess

      protected void showSuccess(javafx.scene.text.Text statusText, String message)
      Updates the statusText with a success message in green.
      Parameters:
      statusText - the Text element to update
      message - the message to display
    • showError

      protected void showError(javafx.scene.text.Text statusText, String message)
      Updates the statusText with an error message in red.
      Parameters:
      statusText - the Text element to update
      message - the message to display