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