Class BasicDesignerDataModel

  • All Implemented Interfaces:
    DesignerDataModel

    public class BasicDesignerDataModel
    extends AbstractDesignerDataModel
    The default implementation which is used by the i-net Designer in standalone mode. This model loads and stores reports in the local file system an lets the user choose freely among all files (except for operating system restrictions). The methods getOpenFileChooser() and getSaveFileChooser(File) allows you to change the file chooser used to restrict the accessible files.
    • Field Detail

      • FILE_CHOOSER

        public static javax.swing.JFileChooser FILE_CHOOSER
        This variable is used to assure the same filechooser is used again. This way you may modify the configuration but keep the current working directory or other properties. There is no restriction you really have to use this, you may create a new chooser every time in getOpenFileChooser() or getSaveFileChooser(File).
    • Constructor Detail

      • BasicDesignerDataModel

        public BasicDesignerDataModel()
        FOR INTERNAL USE ONLY
    • Method Detail

      • createNewReportWithWizard

        public Engine createNewReportWithWizard​(java.awt.Component parent)
                                         throws ReportException
        Opens the report wizard to create a new report and returns the created Engine object.
        Parameters:
        parent - A parental Component to be used in conjunction with a Dialog.
        Returns:
        The Engine object of the created report or null
        Throws:
        ReportException - Creation of a new report failed.
        Since:
        7.0
      • createNewReport

        public Engine createNewReport​(java.awt.Component parent)
                               throws ReportException
        Create a new report. Please note that this will be called only if isReportWizardEnabled() returns false. Otherwise createNewReportWithWizard(Component) will be called to create a new report.
        Parameters:
        parent - A parent window to use for your own dialog.
        Returns:
        null to indicate nothing was created or the engine of the new report
        Throws:
        ReportException - to indicate nothing was created as the result of a Report problem
        Since:
        7.0
      • loadReport

        public Engine loadReport​(java.awt.Component parent)
                          throws java.io.IOException,
                                 ReportException
        Load a report. Choosing a location is the task of the programmer who may use any Swing component.
        Parameters:
        parent - the parent component which should be used in dialogs.
        Returns:
        null to indicate nothing was loaded (choice of the user) or the engine of the loaded report
        Throws:
        java.io.IOException - to indicate nothing was loaded as the result of an IO problem
        ReportException - to indicate nothing was loaded as the result of a Report problem
        See Also:
        DesignerDataModel.loadReport(Component)
      • loadReportFrom

        public Engine loadReportFrom​(java.awt.Component parent,
                                     java.io.File dir)
                              throws java.io.IOException,
                                     ReportException
        Load a report. Choosing a location is the task of the programmer who may use any Swing component.
        Parameters:
        parent - the parent component which should be used in dialogs.
        dir - the Directory for the FileChooser.
        Returns:
        null to indicate nothing was loaded (choice of the user) or the engine of the loaded report
        Throws:
        java.io.IOException - to indicate nothing was loaded as the result of an IO problem
        ReportException - to indicate nothing was loaded as the result of a Report problem
        See Also:
        DesignerDataModel.loadReportFrom(Component, File)
      • saveReport

        public boolean saveReport​(java.awt.Component parent,
                                  Engine e,
                                  boolean saveAs)
                           throws java.io.IOException,
                                  ReportException
        Save a report Choosing a location is the task of the programmer who may use any Swing component.
        Parameters:
        parent - the parent component which should be used in dialogs.
        e - the engine which should be saved
        saveAs - if true the user wants to choose a new name for the report, otherwise the old name should be used (if possible)
        Returns:
        true to indicate the report was successfully saved.
        Throws:
        java.io.IOException - to indicate nothing was saved as the result of an IO problem
        ReportException - to indicate nothing was saved as the result of a Report problem
        See Also:
        DesignerDataModel.saveReport(Component, Engine, boolean)
      • getOpenFileChooser

        public javax.swing.JFileChooser getOpenFileChooser()
        Returns a file chooser which will be used when a report template should be opened. This will return a file chooser with the possible extensions rpt and dataview.
        You may override this method to return a modified file chooser (e.g. with an additional file filter).
        Returns:
        A preconfigured file chooser.
        Since:
        7.0
      • getSaveFileChooser

        public javax.swing.JFileChooser getSaveFileChooser​(java.io.File file)
        Returns a file chooser which will be used when a report template should be saved. This will return a file chooser with the possible extensions rpt and xml.
        You may override this method to return a modified file chooser (e.g. with an own file filter).
        Parameters:
        file - The default file which should be used for saving.
        Returns:
        A preconfigured file chooser
        Since:
        7.0
      • loadReportsFrom

        public Engine[] loadReportsFrom​(java.awt.Component parent,
                                        java.net.URL initialURL)
                                 throws java.io.IOException,
                                        ReportException
        Loads one or more report. Choosing a location is the task of the programmer who may use any Swing component.
        Specified by:
        loadReportsFrom in interface DesignerDataModel
        Overrides:
        loadReportsFrom in class AbstractDesignerDataModel
        Parameters:
        parent - the parent component which should be used in dialogs.
        initialURL - the initial URL for the FileChooser. This could a a location file URL or a HTTP URL of a repository.
        Returns:
        null to indicate nothing was loaded (choice of the user) or an array of engines of the loaded report
        Throws:
        java.io.IOException - to indicate nothing was loaded as the result of an IO problem
        ReportException - to indicate nothing was loaded as the result of a Report problem
        See Also:
        DesignerDataModel.loadReportsFrom(Component, URL)
      • create

        public static DesignerDataModel create()
        Create a new BasicDesignerDataModel.
        Returns:
        New BasicDesignerDataModel
        Since:
        7.0