Class SaveReportUtilities
- java.lang.Object
-
- org.pentaho.reporting.designer.core.actions.report.SaveReportUtilities
-
public final class SaveReportUtilities extends Object
Utilitiy methods used in the process of saving reports
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static File
getCurrentFile(org.pentaho.reporting.libraries.resourceloader.ResourceKey definitionSource)
Extracts the current definition source (if any) from the current reportstatic File
promptReportFilename(Component parent, File defaultFile)
Prompts the user for the name of the report file which should be createdstatic boolean
saveReport(ReportDesignerContext context, ReportDocumentContext activeContext, File target)
Performs the action of saving the report to the specified target filestatic File
validateFileExtension(File proposedFile, Component parent)
Validates that the extension of the filename is prpt, and prompts the user if it is not.
-
-
-
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 childdefaultFile
- the initially selected file.- Returns:
- The
File
which the report should be saved into, ornull
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 validateparent
- 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 contextactiveContext
- the active render contexttarget
- 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
-
-