Class WekaFileChooser

  • All Implemented Interfaces:
    adams.gui.chooser.FileChooser, adams.gui.chooser.FileTypeDeterminingFileChooser<weka.core.converters.AbstractFileLoader,​weka.core.converters.AbstractFileSaver>, ImageObserver, MenuContainer, Serializable, Accessible

    public class WekaFileChooser
    extends adams.gui.chooser.AbstractConfigurableExtensionFileFilterFileChooser<weka.core.converters.AbstractFileLoader,​weka.core.converters.AbstractFileSaver>
    implements adams.gui.chooser.FileTypeDeterminingFileChooser<weka.core.converters.AbstractFileLoader,​weka.core.converters.AbstractFileSaver>
    A specialized JFileChooser that lists all available file Readers and Writers for Weka file formats.
    Author:
    fracpete (fracpete at waikato dot ac dot nz)
    See Also:
    Serialized Form
    • Field Detail

      • m_ReaderFileFilters

        protected static List<adams.gui.chooser.ExtensionFileFilterWithClass> m_ReaderFileFilters
        the file filters for the readers.
      • m_WriterFileFilters

        protected static List<adams.gui.chooser.ExtensionFileFilterWithClass> m_WriterFileFilters
        the file filters for the writers.
    • Constructor Detail

      • WekaFileChooser

        public WekaFileChooser()
        Constructs a FileChooser pointing to the user's default directory.
      • WekaFileChooser

        public WekaFileChooser​(File currentDirectory)
        Constructs a FileChooser using the given File as the path.
        Parameters:
        currentDirectory - the path to start in
      • WekaFileChooser

        public WekaFileChooser​(String currentDirectory)
        Constructs a FileChooser using the given path.
        Parameters:
        currentDirectory - the path to start in
    • Method Detail

      • getFiltersInitialized

        protected boolean getFiltersInitialized()
        Returns whether the filters have already been initialized.
        Specified by:
        getFiltersInitialized in class adams.gui.chooser.AbstractConfigurableExtensionFileFilterFileChooser<weka.core.converters.AbstractFileLoader,​weka.core.converters.AbstractFileSaver>
        Returns:
        true if the filters have been initialized
      • doInitializeFilters

        protected void doInitializeFilters()
        Performs the actual initialization of the filters.
        Specified by:
        doInitializeFilters in class adams.gui.chooser.AbstractConfigurableExtensionFileFilterFileChooser<weka.core.converters.AbstractFileLoader,​weka.core.converters.AbstractFileSaver>
      • initFilters

        protected static void initFilters​(boolean reader,
                                          Class[] classes)
        initializes the SpreadSheetFileExtensionFilters.
        Parameters:
        reader - if true then the reader filters are initialized
        classnames - the classnames of the converters
      • getOpenFileFilters

        protected List<adams.gui.chooser.ExtensionFileFilterWithClass> getOpenFileFilters()
        Returns the file filters for opening files.
        Specified by:
        getOpenFileFilters in class adams.gui.chooser.AbstractConfigurableExtensionFileFilterFileChooser<weka.core.converters.AbstractFileLoader,​weka.core.converters.AbstractFileSaver>
        Returns:
        the file filters
      • getSaveFileFilters

        protected List<adams.gui.chooser.ExtensionFileFilterWithClass> getSaveFileFilters()
        Returns the file filters for writing files.
        Specified by:
        getSaveFileFilters in class adams.gui.chooser.AbstractConfigurableExtensionFileFilterFileChooser<weka.core.converters.AbstractFileLoader,​weka.core.converters.AbstractFileSaver>
        Returns:
        the file filters
      • getReaderClass

        protected Class getReaderClass()
        Returns the reader superclass for the GOE.
        Specified by:
        getReaderClass in class adams.gui.chooser.AbstractConfigurableExtensionFileFilterFileChooser<weka.core.converters.AbstractFileLoader,​weka.core.converters.AbstractFileSaver>
        Returns:
        the reader class
      • getWriterClass

        protected Class getWriterClass()
        Returns the writer superclass for the GOE.
        Specified by:
        getWriterClass in class adams.gui.chooser.AbstractConfigurableExtensionFileFilterFileChooser<weka.core.converters.AbstractFileLoader,​weka.core.converters.AbstractFileSaver>
        Returns:
        the writer class
      • getDefaultReader

        protected weka.core.converters.AbstractFileLoader getDefaultReader()
        Returns the default reader.
        Specified by:
        getDefaultReader in class adams.gui.chooser.AbstractConfigurableExtensionFileFilterFileChooser<weka.core.converters.AbstractFileLoader,​weka.core.converters.AbstractFileSaver>
        Returns:
        the default reader
      • getDefaultWriter

        protected weka.core.converters.AbstractFileSaver getDefaultWriter()
        Returns the default writer.
        Specified by:
        getDefaultWriter in class adams.gui.chooser.AbstractConfigurableExtensionFileFilterFileChooser<weka.core.converters.AbstractFileLoader,​weka.core.converters.AbstractFileSaver>
        Returns:
        the default writer
      • getReaderForFile

        public weka.core.converters.AbstractFileLoader getReaderForFile​(File file)
        Returns the reader for the specified file.
        Specified by:
        getReaderForFile in interface adams.gui.chooser.FileTypeDeterminingFileChooser<weka.core.converters.AbstractFileLoader,​weka.core.converters.AbstractFileSaver>
        Parameters:
        file - the file to determine a reader for
        Returns:
        the reader, null if none found
      • getWriterForFile

        public weka.core.converters.AbstractFileSaver getWriterForFile​(File file)
        Returns the writer for the specified file.
        Specified by:
        getWriterForFile in interface adams.gui.chooser.FileTypeDeterminingFileChooser<weka.core.converters.AbstractFileLoader,​weka.core.converters.AbstractFileSaver>
        Parameters:
        file - the file to determine a reader for
        Returns:
        the writer, null if none found
      • readerForFile

        public static weka.core.converters.AbstractFileLoader readerForFile​(File file)
        Returns the reader for the specified file.
        Parameters:
        file - the file to determine a reader for
        Returns:
        the reader, null if none found
      • writerForFile

        public static weka.core.converters.AbstractFileSaver writerForFile​(File file)
        Returns the writer for the specified file.
        Parameters:
        file - the file to determine a reader for
        Returns:
        the writer, null if none found