git://git.nikiroo.be
/
fanfix.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
beta option: download url
[fanfix.git]
/
src
/
be
/
nikiroo
/
fanfix_swing
/
gui
/
utils
/
TreeSnapshot.java
diff --git
a/src/be/nikiroo/fanfix_swing/gui/utils/TreeSnapshot.java
b/src/be/nikiroo/fanfix_swing/gui/utils/TreeSnapshot.java
index e202544d7627f0c30cdce2844e22a458ce8de820..ad734a1448f3e2de3c678a2b462e76b71a8dca86 100644
(file)
--- a/
src/be/nikiroo/fanfix_swing/gui/utils/TreeSnapshot.java
+++ b/
src/be/nikiroo/fanfix_swing/gui/utils/TreeSnapshot.java
@@
-54,7
+54,7
@@
public class TreeSnapshot {
TreePath newPath = nodeToPath(newNode);
if (newPath != null) {
for (TreePath path : selectionPaths) {
TreePath newPath = nodeToPath(newNode);
if (newPath != null) {
for (TreePath path : selectionPaths) {
- if (
newPath.toString().equals(path.toString()
)) {
+ if (
isSamePath(path, newPath
)) {
newSlectionPaths.add(newPath);
if (expanded.contains(path)) {
newExpanded.add(newPath);
newSlectionPaths.add(newPath);
if (expanded.contains(path)) {
newExpanded.add(newPath);
@@
-72,6
+72,11
@@
public class TreeSnapshot {
tree.setSelectionPaths(newSlectionPaths.toArray(new TreePath[0]));
}
tree.setSelectionPaths(newSlectionPaths.toArray(new TreePath[0]));
}
+ // You can override this
+ protected boolean isSamePath(TreePath oldPath, TreePath newPath) {
+ return newPath.toString().equals(oldPath.toString());
+ }
+
private void forEach(JTree tree, NodeAction action) {
forEach(tree.getModel(), tree.getModel().getRoot(), action);
}
private void forEach(JTree tree, NodeAction action) {
forEach(tree.getModel(), tree.getModel().getRoot(), action);
}