Class ChooserHelper


  • public class ChooserHelper
    extends Object
    Helper class for file choosers.
    Author:
    fracpete (fracpete at waikato dot ac dot nz)
    • Constructor Detail

      • ChooserHelper

        public ChooserHelper()
    • Method Detail

      • getInstance

        protected static Object getInstance​(Class superclass,
                                            String subclass)
        Returns an instance of the specified subclass. Checks whether it is a subclass of the specified superclass.
        Parameters:
        superclass - the super class to check
        subclass - the class name of the sub class
        Returns:
        the instance or null in case of an instantiation or sub-class error
      • getDataContainerReadersForFile

        public static String[] getDataContainerReadersForFile​(Class cls,
                                                              File file)
        Returns all the classnames of data container readers that could handle the given file, based on the file extensions that they handle.
        Parameters:
        cls - the superclass of readers to use
        file - the file to retrieve reader(s) for
        Returns:
        the classnames of potential readers
      • getDataContainerWritersForFile

        public static String[] getDataContainerWritersForFile​(Class cls,
                                                              File file)
        Returns all the classnames of data container writers that could handle the given file, based on the file extensions that they handle.
        Parameters:
        cls - the superclass of writers to use
        file - the file to retrieve writer(s) for
        Returns:
        the classnames of potential writers
      • getReportReadersForFile

        public static String[] getReportReadersForFile​(Class cls,
                                                       File file)
        Returns all the classnames of report readers that could handle the given file, based on the file extensions that they handle.
        Parameters:
        cls - the superclass of readers to use
        file - the file to retrieve reader(s) for
        Returns:
        the classnames of potential readers
      • getReportWritersForFile

        public static String[] getReportWritersForFile​(Class cls,
                                                       File file)
        Returns all the classnames of report writers that could handle the given file, based on the file extensions that they handle.
        Parameters:
        cls - the superclass of writers to use
        file - the file to retrieve writer(s) for
        Returns:
        the classnames of potential writers