Compare commits
No commits in common. "6ee3bc8201bc6200b2777bd799eff3d37fad3b23" and "bc42c8986f409cbaf01d941c63cbb2d93298d61d" have entirely different histories.
6ee3bc8201
...
bc42c8986f
@ -18,7 +18,6 @@ public class FileItem {
|
|||||||
private final boolean isDirectory;
|
private final boolean isDirectory;
|
||||||
private final Icon icon;
|
private final Icon icon;
|
||||||
private boolean marked;
|
private boolean marked;
|
||||||
private boolean recentlyChanged;
|
|
||||||
private String displayPath;
|
private String displayPath;
|
||||||
|
|
||||||
public FileItem(File file) {
|
public FileItem(File file) {
|
||||||
@ -103,14 +102,6 @@ public class FileItem {
|
|||||||
this.marked = !this.marked;
|
this.marked = !this.marked;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isRecentlyChanged() {
|
|
||||||
return recentlyChanged;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setRecentlyChanged(boolean recentlyChanged) {
|
|
||||||
this.recentlyChanged = recentlyChanged;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Format file size into a human-readable string
|
* Format file size into a human-readable string
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -19,9 +19,7 @@ import java.io.IOException;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
|
||||||
import java.util.zip.ZipEntry;
|
import java.util.zip.ZipEntry;
|
||||||
import java.util.zip.ZipInputStream;
|
import java.util.zip.ZipInputStream;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
@ -526,7 +524,6 @@ public class FilePanelTab extends JPanel {
|
|||||||
lastValidRow = row;
|
lastValidRow = row;
|
||||||
lastValidBriefColumn = briefCurrentColumn;
|
lastValidBriefColumn = briefCurrentColumn;
|
||||||
}
|
}
|
||||||
updateStatus();
|
|
||||||
} else {
|
} else {
|
||||||
// Selection became empty. Attempt to restore it.
|
// Selection became empty. Attempt to restore it.
|
||||||
// We do this even if e.getValueIsAdjusting() is true to prevent temporary selection loss.
|
// We do this even if e.getValueIsAdjusting() is true to prevent temporary selection loss.
|
||||||
@ -546,7 +543,6 @@ public class FilePanelTab extends JPanel {
|
|||||||
try {
|
try {
|
||||||
fileTable.scrollRectToVisible(fileTable.getCellRect(finalRow, finalCol, true));
|
fileTable.scrollRectToVisible(fileTable.getCellRect(finalRow, finalCol, true));
|
||||||
} catch (Exception ignore) {}
|
} catch (Exception ignore) {}
|
||||||
updateStatus();
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -927,7 +923,6 @@ public class FilePanelTab extends JPanel {
|
|||||||
if (requestFocus) {
|
if (requestFocus) {
|
||||||
fileTable.requestFocusInWindow();
|
fileTable.requestFocusInWindow();
|
||||||
}
|
}
|
||||||
updateStatus();
|
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
if (autoSelectFirst && fileTable.getRowCount() > 0) {
|
if (autoSelectFirst && fileTable.getRowCount() > 0) {
|
||||||
@ -951,9 +946,10 @@ public class FilePanelTab extends JPanel {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
updateStatus();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
updateStatus();
|
||||||
|
|
||||||
// Notify directory change
|
// Notify directory change
|
||||||
if (onDirectoryChanged != null) {
|
if (onDirectoryChanged != null) {
|
||||||
onDirectoryChanged.run();
|
onDirectoryChanged.run();
|
||||||
@ -969,20 +965,6 @@ public class FilePanelTab extends JPanel {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Identify which items are new or have changed metadata (size/date)
|
|
||||||
final List<String> changedNames = new ArrayList<>();
|
|
||||||
Map<String, FileItem> oldItemsMap = new HashMap<>();
|
|
||||||
for (FileItem item : tableModel.items) {
|
|
||||||
oldItemsMap.put(item.getName(), item);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (FileItem newItem : newItems) {
|
|
||||||
FileItem oldItem = oldItemsMap.get(newItem.getName());
|
|
||||||
if (oldItem == null || !newItem.isSameAs(oldItem)) {
|
|
||||||
changedNames.add(newItem.getName());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
FileItem focused = getFocusedItem();
|
FileItem focused = getFocusedItem();
|
||||||
final String focusedName = (focused != null) ? focused.getName() : null;
|
final String focusedName = (focused != null) ? focused.getName() : null;
|
||||||
|
|
||||||
@ -994,14 +976,11 @@ public class FilePanelTab extends JPanel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
loadDirectory(currentDirectory, false, requestFocus, () -> {
|
loadDirectory(currentDirectory, false, requestFocus, () -> {
|
||||||
// Restore marks and set recentlyChanged flag
|
// Restore marks
|
||||||
for (FileItem item : tableModel.items) {
|
for (FileItem item : tableModel.items) {
|
||||||
if (markedNames.contains(item.getName())) {
|
if (markedNames.contains(item.getName())) {
|
||||||
item.setMarked(true);
|
item.setMarked(true);
|
||||||
}
|
}
|
||||||
if (changedNames.contains(item.getName())) {
|
|
||||||
item.setRecentlyChanged(true);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Restore focus
|
// Restore focus
|
||||||
@ -1025,24 +1004,7 @@ public class FilePanelTab extends JPanel {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
fileTable.repaint();
|
fileTable.repaint();
|
||||||
|
updateStatus();
|
||||||
if (!changedNames.isEmpty()) {
|
|
||||||
// Clear the recentlyChanged flag after 2 seconds
|
|
||||||
javax.swing.Timer timer = new javax.swing.Timer(2000, e -> {
|
|
||||||
boolean found = false;
|
|
||||||
for (FileItem item : tableModel.items) {
|
|
||||||
if (item.isRecentlyChanged()) {
|
|
||||||
item.setRecentlyChanged(false);
|
|
||||||
found = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (found) {
|
|
||||||
fileTable.repaint();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
timer.setRepeats(false);
|
|
||||||
timer.start();
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2214,10 +2176,6 @@ public class FilePanelTab extends JPanel {
|
|||||||
int newStyle = baseStyle | Font.BOLD;
|
int newStyle = baseStyle | Font.BOLD;
|
||||||
setFont(baseFont.deriveFont(newStyle));
|
setFont(baseFont.deriveFont(newStyle));
|
||||||
setForeground(markedColor);
|
setForeground(markedColor);
|
||||||
} else if (item.isRecentlyChanged()) {
|
|
||||||
// Highlight recently changed items with bold and a different color
|
|
||||||
setFont(baseFont.deriveFont(baseStyle | Font.BOLD));
|
|
||||||
setForeground(new Color(0, 128, 255)); // Bright blue
|
|
||||||
} else {
|
} else {
|
||||||
// Preserve whatever style the base font has (do not force plain)
|
// Preserve whatever style the base font has (do not force plain)
|
||||||
setFont(baseFont.deriveFont(baseStyle));
|
setFont(baseFont.deriveFont(baseStyle));
|
||||||
@ -2360,10 +2318,9 @@ public class FilePanelTab extends JPanel {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
String newStatus;
|
|
||||||
if (markedCount > 0) {
|
if (markedCount > 0) {
|
||||||
newStatus = String.format(" Selected: %d files, %d directories (%s)",
|
statusLabel.setText(String.format(" Selected: %d files, %d directories (%s)",
|
||||||
fileCount, dirCount, FileItem.formatSize(totalSize));
|
fileCount, dirCount, FileItem.formatSize(totalSize)));
|
||||||
} else {
|
} else {
|
||||||
int selectedRow = fileTable.getSelectedRow();
|
int selectedRow = fileTable.getSelectedRow();
|
||||||
if (selectedRow >= 0) {
|
if (selectedRow >= 0) {
|
||||||
@ -2377,26 +2334,22 @@ public class FilePanelTab extends JPanel {
|
|||||||
if (item != null && !item.getName().equals("..")) {
|
if (item != null && !item.getName().equals("..")) {
|
||||||
if (item.isDirectory()) {
|
if (item.isDirectory()) {
|
||||||
// Always display directory names in square brackets
|
// Always display directory names in square brackets
|
||||||
newStatus = String.format(" [%s] | %s",
|
statusLabel.setText(String.format(" [%s] | %s",
|
||||||
item.getName(),
|
item.getName(),
|
||||||
item.getFormattedDate());
|
item.getFormattedDate()));
|
||||||
} else {
|
} else {
|
||||||
newStatus = String.format(" %s | %s | %s",
|
statusLabel.setText(String.format(" %s | %s | %s",
|
||||||
item.getName(),
|
item.getName(),
|
||||||
FileItem.formatSize(item.getSize()),
|
FileItem.formatSize(item.getSize()),
|
||||||
item.getFormattedDate());
|
item.getFormattedDate()));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
newStatus = String.format(" Items: %d", tableModel.items.size());
|
statusLabel.setText(String.format(" Items: %d", tableModel.items.size()));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
newStatus = String.format(" Items: %d", tableModel.items.size());
|
statusLabel.setText(String.format(" Items: %d", tableModel.items.size()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (statusLabel != null && !newStatus.equals(statusLabel.getText())) {
|
|
||||||
statusLabel.setText(newStatus);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user