< prev index next >

src/java.desktop/macosx/classes/com/apple/laf/AquaFileChooserUI.java

Print this page


   1 /*
   2  * Copyright (c) 2011, 2015, 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


1403     @SuppressWarnings("serial") // Superclass is not serializable across versions
1404     protected class DirectoryComboBoxAction extends AbstractAction {
1405         protected DirectoryComboBoxAction() {
1406             super("DirectoryComboBoxAction");
1407         }
1408 
1409         public void actionPerformed(final ActionEvent e) {
1410             getFileChooser().setCurrentDirectory((File)directoryComboBox.getSelectedItem());
1411         }
1412     }
1413 
1414     // Sorting Table operations
1415     @SuppressWarnings("serial") // Superclass is not serializable across versions
1416     class JSortingTableHeader extends JTableHeader {
1417         public JSortingTableHeader(final TableColumnModel cm) {
1418             super(cm);
1419             setReorderingAllowed(true); // This causes mousePress to call setDraggedColumn
1420         }
1421 
1422         // One sort state for each column.  Both are ascending by default
1423         final boolean fSortAscending[] = {true, true};
1424 
1425         // Instead of dragging, it selects which one to sort by
1426         public void setDraggedColumn(final TableColumn aColumn) {
1427             if (aColumn != null) {
1428                 final int colIndex = aColumn.getModelIndex();
1429                 if (colIndex != fSortColumn) {
1430                     filechooser.firePropertyChange(AquaFileSystemModel.SORT_BY_CHANGED, fSortColumn, colIndex);
1431                     fSortColumn = colIndex;
1432                 } else {
1433                     fSortAscending[colIndex] = !fSortAscending[colIndex];
1434                     filechooser.firePropertyChange(AquaFileSystemModel.SORT_ASCENDING_CHANGED, !fSortAscending[colIndex], fSortAscending[colIndex]);
1435                 }
1436                 // Need to repaint the highlighted column.
1437                 repaint();
1438             }
1439         }
1440 
1441         // This stops mouseDrags from moving the column
1442         public TableColumn getDraggedColumn() {
1443             return null;


   1 /*
   2  * Copyright (c) 2011, 2018, 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


1403     @SuppressWarnings("serial") // Superclass is not serializable across versions
1404     protected class DirectoryComboBoxAction extends AbstractAction {
1405         protected DirectoryComboBoxAction() {
1406             super("DirectoryComboBoxAction");
1407         }
1408 
1409         public void actionPerformed(final ActionEvent e) {
1410             getFileChooser().setCurrentDirectory((File)directoryComboBox.getSelectedItem());
1411         }
1412     }
1413 
1414     // Sorting Table operations
1415     @SuppressWarnings("serial") // Superclass is not serializable across versions
1416     class JSortingTableHeader extends JTableHeader {
1417         public JSortingTableHeader(final TableColumnModel cm) {
1418             super(cm);
1419             setReorderingAllowed(true); // This causes mousePress to call setDraggedColumn
1420         }
1421 
1422         // One sort state for each column.  Both are ascending by default
1423         final boolean[] fSortAscending = {true, true};
1424 
1425         // Instead of dragging, it selects which one to sort by
1426         public void setDraggedColumn(final TableColumn aColumn) {
1427             if (aColumn != null) {
1428                 final int colIndex = aColumn.getModelIndex();
1429                 if (colIndex != fSortColumn) {
1430                     filechooser.firePropertyChange(AquaFileSystemModel.SORT_BY_CHANGED, fSortColumn, colIndex);
1431                     fSortColumn = colIndex;
1432                 } else {
1433                     fSortAscending[colIndex] = !fSortAscending[colIndex];
1434                     filechooser.firePropertyChange(AquaFileSystemModel.SORT_ASCENDING_CHANGED, !fSortAscending[colIndex], fSortAscending[colIndex]);
1435                 }
1436                 // Need to repaint the highlighted column.
1437                 repaint();
1438             }
1439         }
1440 
1441         // This stops mouseDrags from moving the column
1442         public TableColumn getDraggedColumn() {
1443             return null;


< prev index next >