示例#1
0
  private void doLoadCatalog(final NetworkCatalogTree tree) {
    boolean resumeNotLoad = false;
    if (tree.hasChildren()) {
      if (tree.isContentValid()) {
        if (tree.Item.supportsResumeLoading()) {
          resumeNotLoad = true;
        } else {
          doOpenTree(tree);
          return;
        }
      } else {
        tree.clearCatalog();
      }
    }

    tree.startItemsLoader(
        new Authenticator() {
          public void run(String url) {}
        },
        resumeNotLoad);
    processExtraData(
        tree.Item.extraData(),
        new Runnable() {
          public void run() {
            doOpenTree(tree);
          }
        });
  }
示例#2
0
  public void updateVisibility() {
    final LinkedList<FBTree> toRemove = new LinkedList<FBTree>();

    ListIterator<FBTree> nodeIterator = subTrees().listIterator();
    FBTree currentNode = null;
    int nodeCount = 0;

    for (int i = 0; i < ChildrenItems.size(); ++i) {
      NetworkLibraryItem currentItem = ChildrenItems.get(i);
      if (!(currentItem instanceof NetworkCatalogItem)) {
        continue;
      }
      boolean processed = false;
      while (currentNode != null || nodeIterator.hasNext()) {
        if (currentNode == null) {
          currentNode = nodeIterator.next();
        }
        if (!(currentNode instanceof NetworkCatalogTree)) {
          currentNode = null;
          ++nodeCount;
          continue;
        }
        NetworkCatalogTree child = (NetworkCatalogTree) currentNode;
        if (child.Item == currentItem) {
          switch (child.Item.getVisibility()) {
            case B3_TRUE:
              child.updateVisibility();
              break;
            case B3_FALSE:
              toRemove.add(child);
              break;
            case B3_UNDEFINED:
              child.clear();
              child.ChildrenItems.clear();
              break;
          }
          currentNode = null;
          ++nodeCount;
          processed = true;
          break;
        } else {
          boolean found = false;
          for (int j = i + 1; j < ChildrenItems.size(); ++j) {
            if (child.Item == ChildrenItems.get(j)) {
              found = true;
              break;
            }
          }
          if (!found) {
            toRemove.add(currentNode);
            currentNode = null;
            ++nodeCount;
          } else {
            break;
          }
        }
      }
      final int nextIndex = nodeIterator.nextIndex();
      if (!processed
          && NetworkTreeFactory.createNetworkTree(this, currentItem, nodeCount) != null) {
        ++nodeCount;
        nodeIterator = subTrees().listIterator(nextIndex + 1);
      }
    }

    while (currentNode != null || nodeIterator.hasNext()) {
      if (currentNode == null) {
        currentNode = nodeIterator.next();
      }
      if (currentNode instanceof NetworkCatalogTree) {
        toRemove.add(currentNode);
      }
      currentNode = null;
    }

    for (FBTree tree : toRemove) {
      tree.removeSelf();
    }
  }