src/macosx/classes/com/apple/laf/AquaFileChooserUI.java
Print this page
*** 1,7 ****
/*
! * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
--- 1,7 ----
/*
! * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
*** 855,864 ****
--- 855,865 ----
return (s != null && !s.equals(""));
}
// Action to attach to the file list so we can override the default action
// of the table for the return key, which is to select the next line.
+ @SuppressWarnings("serial") // Superclass is not serializable across versions
protected class DefaultButtonAction extends AbstractAction {
public void actionPerformed(final ActionEvent e) {
final JRootPane root = AquaFileChooserUI.this.getFileChooser().getRootPane();
final JFileChooser fc = AquaFileChooserUI.this.getFileChooser();
final JButton owner = root.getDefaultButton();
*** 881,890 ****
--- 882,892 ----
}
/**
* Creates a new folder.
*/
+ @SuppressWarnings("serial") // Superclass is not serializable across versions
protected class NewFolderAction extends AbstractAction {
protected NewFolderAction() {
super(newFolderAccessibleName);
}
*** 942,960 ****
--- 944,964 ----
}
/**
* Responds to an Open, Save, or Choose request
*/
+ @SuppressWarnings("serial") // Superclass is not serializable across versions
protected class ApproveSelectionAction extends AbstractAction {
public void actionPerformed(final ActionEvent e) {
fSubPanel.approveSelection(getFileChooser());
}
}
/**
* Responds to an OpenDirectory request
*/
+ @SuppressWarnings("serial") // Superclass is not serializable across versions
protected class OpenSelectionAction extends AbstractAction {
public void actionPerformed(final ActionEvent e) {
final int index = fFileList.getSelectedRow();
if (index >= 0) {
final File selectedFile = (File)((AquaFileSystemModel)fFileList.getModel()).getElementAt(index);
*** 964,973 ****
--- 968,978 ----
}
/**
* Responds to a cancel request.
*/
+ @SuppressWarnings("serial") // Superclass is not serializable across versions
protected class CancelSelectionAction extends AbstractAction {
public void actionPerformed(final ActionEvent e) {
getFileChooser().cancelSelection();
}
*** 977,986 ****
--- 982,992 ----
}
/**
* Rescans the files in the current directory
*/
+ @SuppressWarnings("serial") // Superclass is not serializable across versions
protected class UpdateAction extends AbstractAction {
public void actionPerformed(final ActionEvent e) {
final JFileChooser fc = getFileChooser();
fc.setCurrentDirectory(fc.getFileSystemView().createFileObject(getDirectoryName()));
fc.rescanCurrentDirectory();
*** 1002,1011 ****
--- 1008,1018 ----
return UIManager.getString("FileChooser.acceptAllFileFilterText");
}
}
// Penultimate superclass is JLabel
+ @SuppressWarnings("serial") // Superclass is not serializable across versions
protected class MacFCTableCellRenderer extends DefaultTableCellRenderer {
boolean fIsSelected = false;
public MacFCTableCellRenderer(final Font f) {
super();
*** 1082,1091 ****
--- 1089,1099 ----
}
}
}
+ @SuppressWarnings("serial") // Superclass is not serializable across versions
protected class FileRenderer extends MacFCTableCellRenderer {
public FileRenderer(final Font f) {
super(f);
}
*** 1098,1107 ****
--- 1106,1116 ----
setEnabled(isSelectableInList(file));
return this;
}
}
+ @SuppressWarnings("serial") // Superclass is not serializable across versions
protected class DateRenderer extends MacFCTableCellRenderer {
public DateRenderer(final Font f) {
super(f);
}
*** 1132,1141 ****
--- 1141,1151 ----
public Dimension getMaximumSize(final JComponent c) {
return new Dimension(Integer.MAX_VALUE, Integer.MAX_VALUE);
}
+ @SuppressWarnings("serial") // anonymous class
protected ListCellRenderer createDirectoryComboBoxRenderer(final JFileChooser fc) {
return new AquaComboBoxRendererInternal(directoryComboBox) {
public Component getListCellRendererComponent(final JList list, final Object value, final int index, final boolean isSelected, final boolean cellHasFocus) {
super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
final File directory = (File)value;
*** 1160,1169 ****
--- 1170,1180 ----
}
/**
* Data model for a type-face selection combo-box.
*/
+ @SuppressWarnings("serial") // Superclass is not serializable across versions
protected class DirectoryComboBoxModel extends AbstractListModel implements ComboBoxModel {
Vector<File> fDirectories = new Vector<File>();
int topIndex = -1;
int fPathCount = 0;
*** 1243,1252 ****
--- 1254,1264 ----
}
//
// Renderer for Types ComboBox
//
+ @SuppressWarnings("serial") // anonymous class
protected ListCellRenderer createFilterComboBoxRenderer() {
return new AquaComboBoxRendererInternal(filterComboBox) {
public Component getListCellRendererComponent(final JList list, final Object value, final int index, final boolean isSelected, final boolean cellHasFocus) {
super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
final FileFilter filter = (FileFilter)value;
*** 1264,1273 ****
--- 1276,1286 ----
}
/**
* Data model for a type-face selection combo-box.
*/
+ @SuppressWarnings("serial") // Superclass is not serializable across versions
protected class FilterComboBoxModel extends AbstractListModel<FileFilter> implements ComboBoxModel<FileFilter>,
PropertyChangeListener {
protected FileFilter[] filters;
protected FilterComboBoxModel() {
super();
*** 1334,1343 ****
--- 1347,1357 ----
}
/**
* Acts when FilterComboBox has changed the selected item.
*/
+ @SuppressWarnings("serial") // Superclass is not serializable across versions
protected class FilterComboBoxAction extends AbstractAction {
protected FilterComboBoxAction() {
super("FilterComboBoxAction");
}
*** 1347,1356 ****
--- 1361,1371 ----
}
/**
* Acts when DirectoryComboBox has changed the selected item.
*/
+ @SuppressWarnings("serial") // Superclass is not serializable across versions
protected class DirectoryComboBoxAction extends AbstractAction {
protected DirectoryComboBoxAction() {
super("DirectoryComboBoxAction");
}
*** 1358,1367 ****
--- 1373,1383 ----
getFileChooser().setCurrentDirectory((File)directoryComboBox.getSelectedItem());
}
}
// Sorting Table operations
+ @SuppressWarnings("serial") // Superclass is not serializable across versions
class JSortingTableHeader extends JTableHeader {
public JSortingTableHeader(final TableColumnModel cm) {
super(cm);
setReorderingAllowed(true); // This causes mousePress to call setDraggedColumn
}
*** 1394,1403 ****
--- 1410,1420 ----
final DefaultTableCellRenderer label = new AquaTableCellRenderer();
label.setHorizontalAlignment(SwingConstants.LEFT);
return label;
}
+ @SuppressWarnings("serial") // Superclass is not serializable across versions
class AquaTableCellRenderer extends DefaultTableCellRenderer implements UIResource {
public Component getTableCellRendererComponent(final JTable localTable, final Object value, final boolean isSelected, final boolean hasFocus, final int row, final int column) {
if (localTable != null) {
final JTableHeader header = localTable.getTableHeader();
if (header != null) {
*** 1472,1481 ****
--- 1489,1499 ----
setFileName(newFileDefaultName);
}
tPanel.add(labelArea);
// separator line
+ @SuppressWarnings("serial") // anonymous class
final JSeparator sep = new JSeparator(){
public Dimension getPreferredSize() {
return new Dimension(((JComponent)getParent()).getWidth(), 3);
}
};
*** 1759,1768 ****
--- 1777,1787 ----
scrollpane.setCorner(ScrollPaneConstants.UPPER_TRAILING_CORNER, new ScrollPaneCornerPanel());
p.add(scrollpane, BorderLayout.CENTER);
return p;
}
+ @SuppressWarnings("serial") // Superclass is not serializable across versions
protected class ScrollPaneCornerPanel extends JPanel {
final Border border = UIManager.getBorder("TableHeader.cellBorder");
protected void paintComponent(final Graphics g) {
border.paintBorder(this, g, 0, 0, getWidth() + 1, getHeight());
*** 2223,2232 ****
--- 2242,2252 ----
super.updateButtonState(fc, f);
}
}
// See FileRenderer - documents in Save dialogs draw disabled, so they shouldn't be selected
+ @SuppressWarnings("serial") // Superclass is not serializable across versions
class MacListSelectionModel extends DefaultListSelectionModel {
AquaFileSystemModel fModel;
MacListSelectionModel(final AquaFileSystemModel model) {
fModel = model;
*** 2313,2322 ****
--- 2333,2343 ----
}
}
// Convenience, to translate from the JList directory view to the Mac-style JTable
// & minimize diffs between this and BasicFileChooserUI
+ @SuppressWarnings("serial") // Superclass is not serializable across versions
class JTableExtension extends JTable {
public void setSelectedIndex(final int index) {
getSelectionModel().setSelectionInterval(index, index);
}