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

Catalog`s visibility code cleanup (2)

git-svn-id: https://only.mawhrin.net/repos/FBReaderJ/trunk@1377 6a642e6f-84f6-412e-ac94-c4a38d5a04b0
This commit is contained in:
Vasiliy Bout 2010-05-12 10:30:45 +00:00
parent 52940ddf81
commit 458b1e33ff
6 changed files with 15 additions and 15 deletions

View file

@ -58,7 +58,7 @@ class AuthenticationDialog extends NetworkDialog {
return;
}
final NetworkLibrary library = NetworkLibrary.Instance();
library.invalidateAccountDependents();
library.invalidateVisibility();
library.synchronize();
NetworkView.Instance().fireModelChanged();
if (message.what < 0) {

View file

@ -358,7 +358,7 @@ class NetworkBookActions extends NetworkTreeActions {
}
if (mgr.isAuthorised(true).Status == ZLBoolean3.B3_FALSE) {
final NetworkLibrary library = NetworkLibrary.Instance();
library.invalidateAccountDependents();
library.invalidateVisibility();
library.synchronize();
}
if (NetworkView.Instance().isInitialized()) {

View file

@ -231,7 +231,7 @@ class NetworkCatalogActions extends NetworkTreeActions {
} else {
afterUpdateCatalog(errorMessage, myTree.ChildrenItems.size() == 0);
final NetworkLibrary library = NetworkLibrary.Instance();
library.invalidateAccountDependents();
library.invalidateVisibility();
library.synchronize();
}
if (NetworkView.Instance().isInitialized()) {
@ -358,7 +358,7 @@ class NetworkCatalogActions extends NetworkTreeActions {
final Handler handler = new Handler() {
public void handleMessage(Message message) {
final NetworkLibrary library = NetworkLibrary.Instance();
library.invalidateAccountDependents();
library.invalidateVisibility();
library.synchronize();
if (NetworkView.Instance().isInitialized()) {
NetworkView.Instance().fireModelChanged();

View file

@ -65,7 +65,7 @@ class RegisterUserDialog extends NetworkDialog {
final Handler handler = new Handler() {
public void handleMessage(Message message) {
final NetworkLibrary library = NetworkLibrary.Instance();
library.invalidateAccountDependents();
library.invalidateVisibility();
library.synchronize();
if (NetworkView.Instance().isInitialized()) {
NetworkView.Instance().fireModelChanged();

View file

@ -49,7 +49,7 @@ public class NetworkLibrary {
private final RootTree myRootTree = new RootTree();
private boolean myUpdateChildren = true;
private boolean myUpdateAccountDependents;
private boolean myUpdateVisibility;
private static class LinksComparator implements Comparator<NetworkLink> {
public int compare(NetworkLink link1, NetworkLink link2) {
@ -123,8 +123,8 @@ public class NetworkLibrary {
myUpdateChildren = true;
}
public void invalidateAccountDependents() {
myUpdateAccountDependents = true;
public void invalidateVisibility() {
myUpdateVisibility = true;
}
private void makeUpToDate() {
@ -192,12 +192,12 @@ public class NetworkLibrary {
}
}
private void updateAccountDependents() {
private void updateVisibility() {
for (FBTree tree: myRootTree.subTrees()) {
if (!(tree instanceof NetworkCatalogTree)) {
continue;
}
((NetworkCatalogTree) tree).updateAccountDependents();
((NetworkCatalogTree) tree).updateVisibility();
}
}
@ -206,9 +206,9 @@ public class NetworkLibrary {
myUpdateChildren = false;
makeUpToDate();
}
if (myUpdateAccountDependents) {
myUpdateAccountDependents = false;
updateAccountDependents();
if (myUpdateVisibility) {
myUpdateVisibility = false;
updateVisibility();
}
}

View file

@ -60,7 +60,7 @@ public class NetworkCatalogTree extends NetworkTree {
}
public void updateAccountDependents() {
public void updateVisibility() {
final LinkedList<FBTree> toRemove = new LinkedList<FBTree>();
ListIterator<FBTree> nodeIterator = subTrees().listIterator();
@ -85,7 +85,7 @@ public class NetworkCatalogTree extends NetworkTree {
NetworkCatalogTree child = (NetworkCatalogTree) currentNode;
if (child.Item == currentItem) {
if (child.Item.isVisible()) {
child.updateAccountDependents();
child.updateVisibility();
} else {
toRemove.add(child);
}