|
|
|
@ -83,7 +83,7 @@ public abstract class DarkFilePaneUIBridge extends JPanel implements PropertyCha
|
|
|
|
|
Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR); |
|
|
|
|
protected static final int COLUMN_FILENAME = 0; |
|
|
|
|
protected static final int COLUMN_SIZE = 1; |
|
|
|
|
protected static FocusListener repaintListener = new FocusListener() { |
|
|
|
|
protected static final FocusListener repaintListener = new FocusListener() { |
|
|
|
|
public void focusGained(final FocusEvent fe) { |
|
|
|
|
repaintSelection(fe.getSource()); |
|
|
|
|
} |
|
|
|
@ -94,7 +94,7 @@ public abstract class DarkFilePaneUIBridge extends JPanel implements PropertyCha
|
|
|
|
|
|
|
|
|
|
protected void repaintSelection(final Object source) { |
|
|
|
|
if (source instanceof JList) { |
|
|
|
|
repaintListSelection((JList) source); |
|
|
|
|
repaintListSelection((JList<?>) source); |
|
|
|
|
} else if (source instanceof JTable) { |
|
|
|
|
repaintTableSelection((JTable) source); |
|
|
|
|
} |
|
|
|
@ -125,7 +125,7 @@ public abstract class DarkFilePaneUIBridge extends JPanel implements PropertyCha
|
|
|
|
|
}; |
|
|
|
|
protected Action[] actions; |
|
|
|
|
protected int viewType = -1; |
|
|
|
|
protected JPanel[] viewPanels = new JPanel[VIEWTYPE_COUNT]; |
|
|
|
|
protected final JPanel[] viewPanels = new JPanel[VIEWTYPE_COUNT]; |
|
|
|
|
protected JPanel currentViewPanel; |
|
|
|
|
protected String[] viewTypeActionNames; |
|
|
|
|
protected String filesListAccessibleName = null; |
|
|
|
@ -141,7 +141,7 @@ public abstract class DarkFilePaneUIBridge extends JPanel implements PropertyCha
|
|
|
|
|
protected String renameErrorTitleText; |
|
|
|
|
protected String renameErrorText; |
|
|
|
|
protected String renameErrorFileExistsText; |
|
|
|
|
protected boolean smallIconsView = false; |
|
|
|
|
protected final boolean smallIconsView = false; |
|
|
|
|
protected Border listViewBorder; |
|
|
|
|
protected Color listViewBackground; |
|
|
|
|
protected boolean listViewWindowsStyle; |
|
|
|
@ -155,7 +155,7 @@ public abstract class DarkFilePaneUIBridge extends JPanel implements PropertyCha
|
|
|
|
|
// be selected when it appears in the model.
|
|
|
|
|
protected File newFolderFile; |
|
|
|
|
// Used for accessing methods in the corresponding UI class
|
|
|
|
|
protected FileChooserUIAccessor fileChooserUIAccessor; |
|
|
|
|
protected final FileChooserUIAccessor fileChooserUIAccessor; |
|
|
|
|
protected DetailsTableModel detailsTableModel; |
|
|
|
|
protected DetailsTableRowSorter rowSorter; |
|
|
|
|
protected final KeyListener detailsKeyListener = new KeyAdapter() { |
|
|
|
@ -240,7 +240,9 @@ public abstract class DarkFilePaneUIBridge extends JPanel implements PropertyCha
|
|
|
|
|
if (index >= 0) { |
|
|
|
|
detailsTable.getSelectionModel().setSelectionInterval(index, index); |
|
|
|
|
|
|
|
|
|
Rectangle cellRect = detailsTable.getCellRect(index, detailsTable.convertColumnIndexToView(COLUMN_FILENAME), false); |
|
|
|
|
Rectangle cellRect = detailsTable.getCellRect(index, |
|
|
|
|
detailsTable.convertColumnIndexToView(COLUMN_FILENAME), |
|
|
|
|
false); |
|
|
|
|
detailsTable.scrollRectToVisible(cellRect); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -272,7 +274,7 @@ public abstract class DarkFilePaneUIBridge extends JPanel implements PropertyCha
|
|
|
|
|
int lastIndex = -1; |
|
|
|
|
File editFile = null; |
|
|
|
|
JTextField editCell = null; |
|
|
|
|
protected FocusListener editorFocusListener = new FocusAdapter() { |
|
|
|
|
protected final FocusListener editorFocusListener = new FocusAdapter() { |
|
|
|
|
public void focusLost(final FocusEvent e) { |
|
|
|
|
if (!e.isTemporary()) { |
|
|
|
|
applyEdit(); |
|
|
|
@ -348,7 +350,7 @@ public abstract class DarkFilePaneUIBridge extends JPanel implements PropertyCha
|
|
|
|
|
Boolean prop = (Boolean) chooser.getClientProperty("FileChooser.useShellFolder"); |
|
|
|
|
|
|
|
|
|
return prop == null ? chooser.getFileSystemView().equals(FileSystemView.getFileSystemView()) |
|
|
|
|
: prop.booleanValue(); |
|
|
|
|
: prop; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public void uninstallUI() { |
|
|
|
@ -926,23 +928,32 @@ public abstract class DarkFilePaneUIBridge extends JPanel implements PropertyCha
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
String s = e.getPropertyName(); |
|
|
|
|
if (s.equals(JFileChooser.SELECTED_FILE_CHANGED_PROPERTY)) { |
|
|
|
|
switch (s) { |
|
|
|
|
case JFileChooser.SELECTED_FILE_CHANGED_PROPERTY: |
|
|
|
|
doSelectedFileChanged(e); |
|
|
|
|
} else if (s.equals(JFileChooser.SELECTED_FILES_CHANGED_PROPERTY)) { |
|
|
|
|
break; |
|
|
|
|
case JFileChooser.SELECTED_FILES_CHANGED_PROPERTY: |
|
|
|
|
doSelectedFilesChanged(e); |
|
|
|
|
} else if (s.equals(JFileChooser.DIRECTORY_CHANGED_PROPERTY)) { |
|
|
|
|
break; |
|
|
|
|
case JFileChooser.DIRECTORY_CHANGED_PROPERTY: |
|
|
|
|
doDirectoryChanged(e); |
|
|
|
|
} else if (s.equals(JFileChooser.FILE_FILTER_CHANGED_PROPERTY)) { |
|
|
|
|
break; |
|
|
|
|
case JFileChooser.FILE_FILTER_CHANGED_PROPERTY: |
|
|
|
|
doFilterChanged(e); |
|
|
|
|
} else if (s.equals(JFileChooser.FILE_SELECTION_MODE_CHANGED_PROPERTY)) { |
|
|
|
|
break; |
|
|
|
|
case JFileChooser.FILE_SELECTION_MODE_CHANGED_PROPERTY: |
|
|
|
|
doFileSelectionModeChanged(e); |
|
|
|
|
} else if (s.equals(JFileChooser.MULTI_SELECTION_ENABLED_CHANGED_PROPERTY)) { |
|
|
|
|
break; |
|
|
|
|
case JFileChooser.MULTI_SELECTION_ENABLED_CHANGED_PROPERTY: |
|
|
|
|
doMultiSelectionChanged(e); |
|
|
|
|
} else if (s.equals(JFileChooser.CANCEL_SELECTION)) { |
|
|
|
|
break; |
|
|
|
|
case JFileChooser.CANCEL_SELECTION: |
|
|
|
|
applyEdit(); |
|
|
|
|
} else if (s.equals("busy")) { |
|
|
|
|
break; |
|
|
|
|
case "busy": |
|
|
|
|
setCursor((Boolean) e.getNewValue() ? waitCursor : null); |
|
|
|
|
} else if (s.equals(PropertyKey.COMPONENT_ORIENTATION)) { |
|
|
|
|
break; |
|
|
|
|
case PropertyKey.COMPONENT_ORIENTATION: |
|
|
|
|
ComponentOrientation o = (ComponentOrientation) e.getNewValue(); |
|
|
|
|
JFileChooser cc = (JFileChooser) e.getSource(); |
|
|
|
|
if (o != e.getOldValue()) { |
|
|
|
@ -952,6 +963,7 @@ public abstract class DarkFilePaneUIBridge extends JPanel implements PropertyCha
|
|
|
|
|
detailsTable.setComponentOrientation(o); |
|
|
|
|
detailsTable.getParent().getParent().setComponentOrientation(o); |
|
|
|
|
} |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -1076,7 +1088,7 @@ public abstract class DarkFilePaneUIBridge extends JPanel implements PropertyCha
|
|
|
|
|
@SuppressWarnings("serial") |
|
|
|
|
// JDK-implementation class
|
|
|
|
|
protected class ViewTypeAction extends AbstractAction { |
|
|
|
|
protected int viewType; |
|
|
|
|
protected final int viewType; |
|
|
|
|
|
|
|
|
|
ViewTypeAction(final int viewType) { |
|
|
|
|
super(viewTypeActionNames[viewType]); |
|
|
|
@ -1134,8 +1146,8 @@ public abstract class DarkFilePaneUIBridge extends JPanel implements PropertyCha
|
|
|
|
|
@SuppressWarnings("serial") |
|
|
|
|
// JDK-implementation class
|
|
|
|
|
class DetailsTableModel extends AbstractTableModel implements ListDataListener { |
|
|
|
|
JFileChooser chooser; |
|
|
|
|
BasicDirectoryModel directoryModel; |
|
|
|
|
final JFileChooser chooser; |
|
|
|
|
final BasicDirectoryModel directoryModel; |
|
|
|
|
|
|
|
|
|
ShellFolderColumnInfo[] columns; |
|
|
|
|
int[] columnMap; |
|
|
|
@ -1242,7 +1254,8 @@ public abstract class DarkFilePaneUIBridge extends JPanel implements PropertyCha
|
|
|
|
|
final File f2 = fsv.createFileObject(f.getParentFile(), newFileName); |
|
|
|
|
if (f2.exists()) { |
|
|
|
|
JOptionPane.showMessageDialog(chooser, MessageFormat.format(renameErrorFileExistsText, |
|
|
|
|
oldFileName), renameErrorTitleText, |
|
|
|
|
oldFileName), |
|
|
|
|
renameErrorTitleText, |
|
|
|
|
JOptionPane.ERROR_MESSAGE); |
|
|
|
|
} else { |
|
|
|
|
if (DarkFilePaneUIBridge.this.getModel().renameFile(f, f2)) { |
|
|
|
@ -1262,7 +1275,8 @@ public abstract class DarkFilePaneUIBridge extends JPanel implements PropertyCha
|
|
|
|
|
// chooser.setSelectedFile(null);
|
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
JOptionPane.showMessageDialog(chooser, MessageFormat.format(renameErrorText, oldFileName), |
|
|
|
|
JOptionPane.showMessageDialog(chooser, |
|
|
|
|
MessageFormat.format(renameErrorText, oldFileName), |
|
|
|
|
renameErrorTitleText, JOptionPane.ERROR_MESSAGE); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -1367,8 +1381,8 @@ public abstract class DarkFilePaneUIBridge extends JPanel implements PropertyCha
|
|
|
|
|
* comparator. |
|
|
|
|
*/ |
|
|
|
|
protected class DirectoriesFirstComparatorWrapper implements Comparator<File> { |
|
|
|
|
protected Comparator<Object> comparator; |
|
|
|
|
protected int column; |
|
|
|
|
protected final Comparator<Object> comparator; |
|
|
|
|
protected final int column; |
|
|
|
|
|
|
|
|
|
@SuppressWarnings("unchecked") |
|
|
|
|
public DirectoriesFirstComparatorWrapper(final int column, final Comparator<?> comparator) { |
|
|
|
@ -1427,8 +1441,8 @@ public abstract class DarkFilePaneUIBridge extends JPanel implements PropertyCha
|
|
|
|
|
@SuppressWarnings("serial") |
|
|
|
|
// JDK-implementation class
|
|
|
|
|
public class DetailsTableCellRenderer extends DarkTableCellRenderer { |
|
|
|
|
JFileChooser chooser; |
|
|
|
|
DateFormat df; |
|
|
|
|
final JFileChooser chooser; |
|
|
|
|
final DateFormat df; |
|
|
|
|
|
|
|
|
|
public DetailsTableCellRenderer(final JFileChooser chooser) { |
|
|
|
|
this.chooser = chooser; |
|
|
|
@ -1502,7 +1516,7 @@ public abstract class DarkFilePaneUIBridge extends JPanel implements PropertyCha
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
protected class AlignableTableHeaderRenderer implements TableCellRenderer { |
|
|
|
|
TableCellRenderer wrappedRenderer; |
|
|
|
|
final TableCellRenderer wrappedRenderer; |
|
|
|
|
|
|
|
|
|
public AlignableTableHeaderRenderer(final TableCellRenderer wrappedRenderer) { |
|
|
|
|
this.wrappedRenderer = wrappedRenderer; |
|
|
|
|