mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-09-25 01:10:44 +00:00
expand swf nodes when the initial view was the dump view and the user changed it to resources view
This commit is contained in:
@@ -621,11 +621,8 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec
|
|||||||
tagTree.setSelectionPath(ttm.getTreePath(ttm.getRoot()));
|
tagTree.setSelectionPath(ttm.getTreePath(ttm.getRoot()));
|
||||||
}
|
}
|
||||||
ttm.updateSwfs(e);
|
ttm.updateSwfs(e);
|
||||||
TreeItem root = ttm.getRoot();
|
tagTree.expandRoot();
|
||||||
int childCount = ttm.getChildCount(root);
|
tagTree.expandFirstLevelNodes();
|
||||||
for (int i = 0; i < childCount; i++) {
|
|
||||||
tagTree.expandPath(new TreePath(new Object[]{root, ttm.getChild(root, i)}));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DumpTreeModel dtm = dumpTree.getModel();
|
DumpTreeModel dtm = dumpTree.getModel();
|
||||||
@@ -633,12 +630,8 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec
|
|||||||
List<List<String>> expandedNodes = View.getExpandedNodes(dumpTree);
|
List<List<String>> expandedNodes = View.getExpandedNodes(dumpTree);
|
||||||
dtm.updateSwfs();
|
dtm.updateSwfs();
|
||||||
View.expandTreeNodes(dumpTree, expandedNodes);
|
View.expandTreeNodes(dumpTree, expandedNodes);
|
||||||
DumpInfo root = dtm.getRoot();
|
dumpTree.expandRoot();
|
||||||
int childCount = dtm.getChildCount(root);
|
dumpTree.expandFirstLevelNodes();
|
||||||
for (int i = 0; i < childCount; i++) {
|
|
||||||
dumpTree.expandPath(new TreePath(new Object[]{root, dtm.getChild(root, i)}));
|
|
||||||
dumpTree.expandRow(i);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (swfs.isEmpty()) {
|
if (swfs.isEmpty()) {
|
||||||
@@ -2360,6 +2353,10 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec
|
|||||||
// show welcome panel after closing swfs
|
// show welcome panel after closing swfs
|
||||||
updateUi();
|
updateUi();
|
||||||
} else {
|
} else {
|
||||||
|
if (swf == null) {
|
||||||
|
swf = swfs.get(0).get(0);
|
||||||
|
}
|
||||||
|
|
||||||
updateUi(swf);
|
updateUi(swf);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -2405,12 +2402,16 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec
|
|||||||
switch (view) {
|
switch (view) {
|
||||||
case VIEW_DUMP:
|
case VIEW_DUMP:
|
||||||
if (dumpTree.getModel() == null) {
|
if (dumpTree.getModel() == null) {
|
||||||
dumpTree.setModel(new DumpTreeModel(swfs));
|
DumpTreeModel dtm = new DumpTreeModel(swfs);
|
||||||
|
dumpTree.setModel(dtm);
|
||||||
|
dumpTree.expandFirstLevelNodes();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case VIEW_RESOURCES:
|
case VIEW_RESOURCES:
|
||||||
if (tagTree.getModel() == null) {
|
if (tagTree.getModel() == null) {
|
||||||
tagTree.setModel(new TagTreeModel(swfs, Configuration.tagTreeShowEmptyFolders.get()));
|
TagTreeModel ttm = new TagTreeModel(swfs, Configuration.tagTreeShowEmptyFolders.get());
|
||||||
|
tagTree.setModel(ttm);
|
||||||
|
tagTree.expandFirstLevelNodes();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -290,16 +290,20 @@ public class DumpTree extends JTree implements ActionListener {
|
|||||||
public DumpTreeModel getModel() {
|
public DumpTreeModel getModel() {
|
||||||
return (DumpTreeModel) super.getModel();
|
return (DumpTreeModel) super.getModel();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
public void expandRoot() {
|
||||||
public void setModel(TreeModel tm) {
|
DumpTreeModel dtm = getModel();
|
||||||
super.setModel(tm);
|
DumpInfo root = dtm.getRoot();
|
||||||
|
expandPath(new TreePath(new Object[]{root}));
|
||||||
if (tm != null) {
|
}
|
||||||
int rowCount = tm.getChildCount(tm.getRoot());
|
|
||||||
for (int i = rowCount - 1; i >= 0; i--) {
|
public void expandFirstLevelNodes() {
|
||||||
expandRow(i);
|
DumpTreeModel dtm = getModel();
|
||||||
}
|
DumpInfo root = dtm.getRoot();
|
||||||
|
int childCount = dtm.getChildCount(root);
|
||||||
|
expandPath(new TreePath(new Object[]{root}));
|
||||||
|
for (int i = 0; i < childCount; i++) {
|
||||||
|
expandPath(new TreePath(new Object[]{root, dtm.getChild(root, i)}));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -574,4 +574,19 @@ public class TagTree extends JTree {
|
|||||||
public TagTreeModel getModel() {
|
public TagTreeModel getModel() {
|
||||||
return (TagTreeModel) super.getModel();
|
return (TagTreeModel) super.getModel();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void expandRoot() {
|
||||||
|
TagTreeModel ttm = getModel();
|
||||||
|
TreeItem root = ttm.getRoot();
|
||||||
|
expandPath(new TreePath(new Object[]{root}));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void expandFirstLevelNodes() {
|
||||||
|
TagTreeModel ttm = getModel();
|
||||||
|
TreeItem root = ttm.getRoot();
|
||||||
|
int childCount = ttm.getChildCount(root);
|
||||||
|
for (int i = 0; i < childCount; i++) {
|
||||||
|
expandPath(new TreePath(new Object[]{root, ttm.getChild(root, i)}));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user