Changeset 2881


Ignore:
Timestamp:
06/18/07 12:36:04 (12 years ago)
Author:
curtis
Message:

Preview pane component for use with file chooser.

Location:
trunk/loci/formats/gui
Files:
1 added
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/loci/formats/gui/GUITools.java

    r2571 r2881  
    4545  // -- File chooser -- 
    4646 
     47  /** Constructs a list of file filters for the given file format handler. */ 
    4748  public static FileFilter[] buildFileFilters(IFormatHandler handler) { 
    4849    FileFilter[] ff = null; 
     
    102103  } 
    103104 
     105  /** Constructs a file chooser for the given file format handler. */ 
    104106  public static JFileChooser buildFileChooser(IFormatHandler handler) { 
    105     return buildFileChooser(buildFileFilters(handler)); 
     107    return buildFileChooser(handler, true); 
     108  } 
     109 
     110  /** 
     111   * Constructs a file chooser for the given file format handler. 
     112   * If preview flag is set, chooser has an preview pane showing 
     113   * a thumbnail and other information for the selected file. 
     114   */ 
     115  public static JFileChooser buildFileChooser(IFormatHandler handler, 
     116    boolean preview) 
     117  { 
     118    return buildFileChooser(buildFileFilters(handler), preview); 
    106119  } 
    107120 
     
    111124   */ 
    112125  public static JFileChooser buildFileChooser(final FileFilter[] filters) { 
     126    return buildFileChooser(filters, true); 
     127  } 
     128 
     129  /** 
     130   * Builds a file chooser with the given file filters, 
     131   * as well as an "All supported file types" combo filter. 
     132   * If preview flag is set, chooser has an preview pane showing 
     133   * a thumbnail and other information for the selected file. 
     134   */ 
     135  public static JFileChooser buildFileChooser(final FileFilter[] filters, 
     136    final boolean preview) 
     137  { 
    113138    // NB: must construct JFileChooser in the 
    114139    // AWT worker thread, to avoid deadlocks 
     
    125150        for (int i=0; i<ff.length; i++) fc.addChoosableFileFilter(ff[i]); 
    126151        if (combo != null) fc.setFileFilter(combo); 
     152        if (preview) new PreviewPane(fc); 
    127153        jfc[0] = fc; 
    128154      } 
Note: See TracChangeset for help on using the changeset viewer.