Class SaveReportUtilities


  • public final class SaveReportUtilities
    extends Object
    Utilitiy methods used in the process of saving reports
    • Method Detail

      • promptReportFilename

        public static File promptReportFilename​(Component parent,
                                                File defaultFile)
        Prompts the user for the name of the report file which should be created
        Parameters:
        parent - the parent component of which the file chooser dialog will be a child
        defaultFile - the initially selected file.
        Returns:
        The File which the report should be saved into, or null if the user does not want to continue with the save operation
      • validateFileExtension

        public static File validateFileExtension​(File proposedFile,
                                                 Component parent)
        Validates that the extension of the filename is prpt, and prompts the user if it is not.
        Parameters:
        proposedFile - the target file to validate
        parent - the parent component in case we need to display a dialog
        Returns:
        the filename based on the validation and optional prompting, or null if the user decided to cancel the operaion
      • saveReport

        public static boolean saveReport​(ReportDesignerContext context,
                                         ReportDocumentContext activeContext,
                                         File target)
        Performs the action of saving the report to the specified target file
        Parameters:
        context - the report designer context
        activeContext - the active render context
        target - the target file to which the report will be saved
        Returns:
        true, if saving was successful, false otherwise.
      • getCurrentFile

        public static File getCurrentFile​(org.pentaho.reporting.libraries.resourceloader.ResourceKey definitionSource)
        Extracts the current definition source (if any) from the current report
        Parameters:
        definitionSource - the resource key used to determine the current filename
        Returns:
        the current definition souurce, or null if there is none set