Skip to content

Commit b3467cc

Browse files
committed
Expand stream tree node after filter manipulation
This seems less unexpected, than what was happening before. Still a bit hacky though...
1 parent 1838896 commit b3467cc

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/main/java/com/itextpdf/rups/view/contextmenu/AbstractPdfStreamAction.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ This file is part of the iText (R) project.
4646
import com.itextpdf.rups.view.itext.PdfTree;
4747
import com.itextpdf.rups.view.itext.treenodes.PdfObjectTreeNode;
4848

49+
import javax.swing.tree.TreePath;
50+
4951
public abstract class AbstractPdfStreamAction extends AbstractRupsAction {
5052
protected final transient PdfReaderController controller;
5153

@@ -72,8 +74,15 @@ protected void forceTreeRebuild(PdfObjectTreeNode root) {
7274
// be regenerated after the update. Presumably there should be a
7375
// better way to do this, but this works fine for now
7476
if (controller != null) {
77+
final TreePath path = new TreePath(root.getPath());
78+
boolean wasExpanded = controller.getPdfTree().isExpanded(path);
7579
controller.deleteAllTreeChildren(root);
7680
controller.selectNode(root);
81+
if (wasExpanded) {
82+
controller.getPdfTree().expandPath(path);
83+
} else {
84+
controller.getPdfTree().collapsePath(path);
85+
}
7786
}
7887
}
7988
}

0 commit comments

Comments
 (0)