Fixed auto expansion of books at startup
This commit is contained in:
@@ -1090,14 +1090,18 @@ public class AudiobookRecorder extends JFrame implements DocumentListener {
|
|||||||
try {
|
try {
|
||||||
Book b = new Book(f);
|
Book b = new Book(f);
|
||||||
rootNode.add(b);
|
rootNode.add(b);
|
||||||
bookTreeModel.reload(rootNode);
|
|
||||||
bookTree.expandPath(new TreePath(b.getPath()));
|
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
ex.printStackTrace();
|
ex.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
SwingUtilities.invokeLater(new Runnable() {
|
||||||
|
public void run() {
|
||||||
|
bookTreeModel.reload(rootNode);
|
||||||
|
expandAllBooks();
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
queueJob(new VersionChecker());
|
queueJob(new VersionChecker());
|
||||||
@@ -2216,6 +2220,16 @@ public class AudiobookRecorder extends JFrame implements DocumentListener {
|
|||||||
bookTree.scrollPathToVisible(new TreePath(c.getPath()));
|
bookTree.scrollPathToVisible(new TreePath(c.getPath()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void expandAllBooks() {
|
||||||
|
for (Enumeration s = rootNode.children(); s.hasMoreElements();) {
|
||||||
|
TreeNode n = (TreeNode)s.nextElement();
|
||||||
|
if (n instanceof Book) {
|
||||||
|
Book b = (Book)n;
|
||||||
|
bookTree.expandPath(new TreePath(b.getPath()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void saveAllBooks() {
|
public void saveAllBooks() {
|
||||||
for (Enumeration s = rootNode.children(); s.hasMoreElements();) {
|
for (Enumeration s = rootNode.children(); s.hasMoreElements();) {
|
||||||
TreeNode n = (TreeNode)s.nextElement();
|
TreeNode n = (TreeNode)s.nextElement();
|
||||||
|
|||||||
Reference in New Issue
Block a user