1
0
Fork 0
mirror of https://github.com/geometer/FBReaderJ.git synced 2025-10-05 10:49:24 +02:00

catalog's items hiding has been implemented

git-svn-id: https://only.mawhrin.net/repos/FBReaderJ/trunk@1135 6a642e6f-84f6-412e-ac94-c4a38d5a04b0
This commit is contained in:
Vasiliy Bout 2010-03-23 18:56:21 +00:00
parent 0a5bd768cf
commit 1744d5c718
4 changed files with 111 additions and 7 deletions

View file

@ -43,6 +43,7 @@ public class NetworkLibrary {
private final RootTree myRootTree = new RootTree();
private boolean myUpdateChildren = true;
private boolean myUpdateAccountDependents;
private static class LinksComparator implements Comparator<NetworkLink> {
public int compare(NetworkLink link1, NetworkLink link2) {
@ -90,10 +91,14 @@ public class NetworkLibrary {
myUpdateChildren = true;
}
public void invalidateAccountDependents() {
myUpdateAccountDependents = true;
}
private void makeUpToDate() {
final LinkedList<FBTree> toRemove = new LinkedList<FBTree>();
Iterator<FBTree> nodeIterator = myRootTree.iterator();
Iterator<FBTree> nodeIterator = myRootTree.subTrees().iterator();
FBTree currentNode = null;
int nodeCount = 0;
@ -109,6 +114,7 @@ public class NetworkLibrary {
}
if (!(currentNode instanceof NetworkCatalogTree)) {
currentNode = null;
++nodeCount;
continue;
}
final NetworkLink nodeLink = ((NetworkCatalogTree)currentNode).Item.Link;
@ -165,7 +171,7 @@ public class NetworkLibrary {
NetworkNodesFactory::createSubnodes(srNode, result);
}*/
for (FBTree tree : toRemove) {
for (FBTree tree: toRemove) {
tree.removeSelf();
}
@ -175,11 +181,24 @@ public class NetworkLibrary {
}*/
}
private void updateAccountDependents() {
for (FBTree tree: myRootTree.subTrees()) {
if (!(tree instanceof NetworkCatalogTree)) {
continue;
}
((NetworkCatalogTree) tree).updateAccountDependents();
}
}
public void synchronize() {
if (myUpdateChildren) {
myUpdateChildren = false;
makeUpToDate();
}
if (myUpdateAccountDependents) {
myUpdateAccountDependents = false;
updateAccountDependents();
}
}
public NetworkTree getTree() {