Class FileChooser

java.lang.Object
thinletcommons.FileChooser

public class FileChooser extends Object
A Thinlet file chooser dialog.

The dialog is modal and blocks the calling frame/dialog. It is therefore displayed in a separate window.

TODO:

  • For mode OPEN: multiple selection
  • Button "Create directory"

Implementation note: This implementation uses javax.swing.filechooser.FileSystemView, because it provides directory information that looks more "native". This introduces a dependency on Swing, but since ThinG requires JDK 1.4, Swing should be there anyway. Only a minimal set of Swing classes is loaded while using javax.swing.filechooser.FileSystemView; alas, the loading of javax.swing.UIManager and javax.swing.LookAndFeel can not be avoided, although no Swing beans are actually used.

Author:
Dirk Moebius
  • Field Details

  • Constructor Details

    • FileChooser

      public FileChooser(Frame owner, String title, int mode)
    • FileChooser

      public FileChooser(Dialog owner, String title, int mode)
  • Method Details

    • show

      public void show()
      Show the modal dialog. This halts the application until the user dismisses the dialog.
    • setSelectedFile

      public void setSelectedFile(File file)
    • getSelectedFile

      public File getSelectedFile()
    • setShowHiddenFiles

      public void setShowHiddenFiles(boolean showHiddenFiles)
    • getShowHiddenFiles

      public boolean getShowHiddenFiles()
    • setFileFilters

      public void setFileFilters(FileFilter[] filters)
      Set the list of choosable file filters.

      This replaces the default filter "All files", so care must be taken to include an all file filter in the list, if you don't want the "All files" filter to be removed.

      To restore the "All files" filter and remove all custom filter, call this method with argument null.

      Parameters:
      filters - the list of choosable file filters, or null.
    • getSelectedFileFilter

      public FileFilter getSelectedFileFilter()
    • ok

      public void ok()
      Thinlet callback.
    • close

      public void close()
      Thinlet callback.
    • goUp

      public void goUp()
      Thinlet callback.
    • goHome

      public void goHome()
      Thinlet callback.
    • toggleShowHiddenFiles

      public void toggleShowHiddenFiles(boolean showHidden)
      Thinlet callback.
    • tableRowDoubleClicked

      public void tableRowDoubleClicked()
      Thinlet callback.
    • tableRowSelected

      public void tableRowSelected()
      Thinlet callback.
    • tableHeaderChanged

      public void tableHeaderChanged(Object colName, Object colType, Object colSize, Object colMod)
      Thinlet callback.
    • cbPathChanged

      public void cbPathChanged()
      Thinlet callback.
    • cbFilterChanged

      public void cbFilterChanged(int index)
      Thinlet callback.
    • main

      public static void main(String[] args)
      Test method.