src/macosx/classes/com/apple/laf/AquaFileSystemModel.java

Print this page


   1 /*
   2  * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package com.apple.laf;
  27 
  28 import java.beans.*;
  29 import java.io.File;
  30 import java.util.*;
  31 
  32 import javax.swing.*;
  33 import javax.swing.event.ListDataEvent;
  34 import javax.swing.filechooser.FileSystemView;
  35 import javax.swing.table.AbstractTableModel;
  36 
  37 /**
  38  * NavServices-like implementation of a file Table
  39  *
  40  * Some of it came from BasicDirectoryModel
  41  */

  42 class AquaFileSystemModel extends AbstractTableModel implements PropertyChangeListener {
  43     private final JTable fFileList;
  44     private LoadFilesThread loadThread = null;
  45     private Vector<File> files = null;
  46 
  47     JFileChooser filechooser = null;
  48     Vector<SortableFile> fileCache = null;
  49     Object fileCacheLock;
  50 
  51     Vector<File> directories = null;
  52     int fetchID = 0;
  53 
  54     private final boolean fSortAscending[] = {true, true};
  55     // private boolean fSortAscending = true;
  56     private boolean fSortNames = true;
  57     private final String[] fColumnNames;
  58     public final static String SORT_BY_CHANGED = "sortByChanged";
  59     public final static String SORT_ASCENDING_CHANGED = "sortAscendingChanged";
  60 
  61     public AquaFileSystemModel(final JFileChooser filechooser, final JTable filelist, final String[] colNames) {


   1 /*
   2  * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package com.apple.laf;
  27 
  28 import java.beans.*;
  29 import java.io.File;
  30 import java.util.*;
  31 
  32 import javax.swing.*;
  33 import javax.swing.event.ListDataEvent;
  34 import javax.swing.filechooser.FileSystemView;
  35 import javax.swing.table.AbstractTableModel;
  36 
  37 /**
  38  * NavServices-like implementation of a file Table
  39  *
  40  * Some of it came from BasicDirectoryModel
  41  */
  42 @SuppressWarnings("serial") // Superclass is not serializable across versions
  43 class AquaFileSystemModel extends AbstractTableModel implements PropertyChangeListener {
  44     private final JTable fFileList;
  45     private LoadFilesThread loadThread = null;
  46     private Vector<File> files = null;
  47 
  48     JFileChooser filechooser = null;
  49     Vector<SortableFile> fileCache = null;
  50     Object fileCacheLock;
  51 
  52     Vector<File> directories = null;
  53     int fetchID = 0;
  54 
  55     private final boolean fSortAscending[] = {true, true};
  56     // private boolean fSortAscending = true;
  57     private boolean fSortNames = true;
  58     private final String[] fColumnNames;
  59     public final static String SORT_BY_CHANGED = "sortByChanged";
  60     public final static String SORT_ASCENDING_CHANGED = "sortAscendingChanged";
  61 
  62     public AquaFileSystemModel(final JFileChooser filechooser, final JTable filelist, final String[] colNames) {