Class WorkDirChooser

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible

public class WorkDirChooser extends JFileChooser
A custom JFileChooser, for a user to choose a work directory.
See Also:
  • Field Details

    • NEW

      public static final int NEW
      A constant to indicate that a new work directory is to be created.
      See Also:
    • OPEN_FOR_ANY_TESTSUITE

      public static final int OPEN_FOR_ANY_TESTSUITE
      A constant to indicate that an existing work directory is to be opened.
      See Also:
    • OPEN_FOR_GIVEN_TESTSUITE

      public static final int OPEN_FOR_GIVEN_TESTSUITE
      A constant to indicate that an existing work directory that is to be opened in conjunction with a specific test suite.
      See Also:
  • Constructor Details

    • WorkDirChooser

      public WorkDirChooser(boolean usePrefs)
      Create a WorkDirChooser, initially showing the user's current directory.
    • WorkDirChooser

      public WorkDirChooser(File initialDir)
      Create a WorkDirChooser, initially showing a given directory.
      Parameters:
      initialDir - the initial directory to be shown
  • Method Details

    • setMode

      public void setMode(int mode)
      Set whether the chooser is to be used to create a new work directory or to open an existing work directory.
      Parameters:
      mode - a constant to indicate how the chooser is to operate
      See Also:
    • setTestSuite

      public void setTestSuite(TestSuite ts)
      Set the test suite for this chooser.
      Parameters:
      ts - The test suite to be used when opening or creating a work directory.
    • setTestSuiteChooser

      public void setTestSuiteChooser(TestSuiteChooser tsc)
      Set a test suite chooser to be used during error handling, if the test suite referenced by an existing work directory cannot be opened.
      Parameters:
      tsc - the test suite chooser to be used
    • getSelectedWorkDirectory

      public WorkDirectory getSelectedWorkDirectory()
      Get the work directory that was most recently selected by the user.
      Returns:
      the work directorythat was most recently selected by the user
      See Also:
    • setSelectedWorkDirectory

      public void setSelectedWorkDirectory(WorkDirectory wd)
      Set the work directory selected by the user.
      Parameters:
      wd - the work directory
      See Also:
    • showDialog

      public int showDialog(Component parent)
      Show a dialog to allow the user to select a work directory. If a work directory is selected, it can be accessed via getSelectedWorkDirectory.
      Parameters:
      parent - the component to be used at the parent of this dialog
      Returns:
      an integer signifying how the dialog was dismissed (APPROVE_OPTION or CANCEL_OPTION).
      See Also:
    • approveSelection

      public void approveSelection()
      Overrides:
      approveSelection in class JFileChooser
    • getName

      public String getName(File f)
      Overrides:
      getName in class JFileChooser
    • setAllowNoTemplate

      public void setAllowNoTemplate(boolean allowNoTemplate)