40 * 41 * Some of it came from BasicDirectoryModel 42 */ 43 @SuppressWarnings("serial") // Superclass is not serializable across versions 44 class AquaFileSystemModel extends AbstractTableModel implements PropertyChangeListener { 45 private final JTable fFileList; 46 private FilesLoader filesLoader = null; 47 private Vector<File> files = null; 48 49 JFileChooser filechooser = null; 50 Vector<SortableFile> fileCache = null; 51 Object fileCacheLock; 52 53 Vector<File> directories = null; 54 int fetchID = 0; 55 56 private final boolean fSortAscending[] = {true, true}; 57 // private boolean fSortAscending = true; 58 private boolean fSortNames = true; 59 private final String[] fColumnNames; 60 public final static String SORT_BY_CHANGED = "sortByChanged"; 61 public final static String SORT_ASCENDING_CHANGED = "sortAscendingChanged"; 62 63 public AquaFileSystemModel(final JFileChooser filechooser, final JTable filelist, final String[] colNames) { 64 fileCacheLock = new Object(); 65 this.filechooser = filechooser; 66 fFileList = filelist; 67 fColumnNames = colNames; 68 validateFileCache(); 69 updateSelectionMode(); 70 } 71 72 void updateSelectionMode() { 73 // Save dialog lists can't be multi select, because all we're selecting is the next folder to open 74 final boolean b = filechooser.isMultiSelectionEnabled() && filechooser.getDialogType() != JFileChooser.SAVE_DIALOG; 75 fFileList.setSelectionMode(b ? ListSelectionModel.MULTIPLE_INTERVAL_SELECTION : ListSelectionModel.SINGLE_SELECTION); 76 } 77 78 public void propertyChange(final PropertyChangeEvent e) { 79 final String prop = e.getPropertyName(); 80 if (prop == JFileChooser.DIRECTORY_CHANGED_PROPERTY || prop == JFileChooser.FILE_VIEW_CHANGED_PROPERTY || prop == JFileChooser.FILE_FILTER_CHANGED_PROPERTY || prop == JFileChooser.FILE_HIDING_CHANGED_PROPERTY) { 81 invalidateFileCache(); | 40 * 41 * Some of it came from BasicDirectoryModel 42 */ 43 @SuppressWarnings("serial") // Superclass is not serializable across versions 44 class AquaFileSystemModel extends AbstractTableModel implements PropertyChangeListener { 45 private final JTable fFileList; 46 private FilesLoader filesLoader = null; 47 private Vector<File> files = null; 48 49 JFileChooser filechooser = null; 50 Vector<SortableFile> fileCache = null; 51 Object fileCacheLock; 52 53 Vector<File> directories = null; 54 int fetchID = 0; 55 56 private final boolean fSortAscending[] = {true, true}; 57 // private boolean fSortAscending = true; 58 private boolean fSortNames = true; 59 private final String[] fColumnNames; 60 public static final String SORT_BY_CHANGED = "sortByChanged"; 61 public static final String SORT_ASCENDING_CHANGED = "sortAscendingChanged"; 62 63 public AquaFileSystemModel(final JFileChooser filechooser, final JTable filelist, final String[] colNames) { 64 fileCacheLock = new Object(); 65 this.filechooser = filechooser; 66 fFileList = filelist; 67 fColumnNames = colNames; 68 validateFileCache(); 69 updateSelectionMode(); 70 } 71 72 void updateSelectionMode() { 73 // Save dialog lists can't be multi select, because all we're selecting is the next folder to open 74 final boolean b = filechooser.isMultiSelectionEnabled() && filechooser.getDialogType() != JFileChooser.SAVE_DIALOG; 75 fFileList.setSelectionMode(b ? ListSelectionModel.MULTIPLE_INTERVAL_SELECTION : ListSelectionModel.SINGLE_SELECTION); 76 } 77 78 public void propertyChange(final PropertyChangeEvent e) { 79 final String prop = e.getPropertyName(); 80 if (prop == JFileChooser.DIRECTORY_CHANGED_PROPERTY || prop == JFileChooser.FILE_VIEW_CHANGED_PROPERTY || prop == JFileChooser.FILE_FILTER_CHANGED_PROPERTY || prop == JFileChooser.FILE_HIDING_CHANGED_PROPERTY) { 81 invalidateFileCache(); |