Ejemplo n.º 1
0
  public synchronized void push(
      DocumentPanel documentpanel, DocumentFormatterRef documentformatterref) {
    init();
    DocumentFormatterRef documentformatterref1 = documentpanel.current;
    if (documentpanel.isLoadingNext()) documentformatterref1 = documentpanel.next;
    if (documentformatterref1 == null) return;
    Node node = new Node();
    node.target = documentpanel;
    node.newContents = new DocumentFormatterPresentation(documentformatterref);
    node.oldContents = new DocumentFormatterPresentation(documentformatterref1);
    node.extViewer = false;
    if (!(documentpanel instanceof HotJavaBrowserBean)) {
      Vector vector = new Vector();
      for (java.awt.Container container = documentpanel.getParent();
          container != null;
          container = container.getParent()) {
        if (!(container instanceof DocumentPanel)) continue;
        vector.addElement(((DocumentPanel) container).current);
        if (container instanceof HotJavaBrowserBean) break;
      }

      node.parents = new DocumentFormatterRef[vector.size()];
      for (int j = 0; j < vector.size(); j++) {
        node.parents[j] = (DocumentFormatterRef) vector.elementAt(j);
        node.parents[j].addClient();
      }
    }
    node.oldContents.setScrollPosition(documentpanel.getScrollPosition());
    node.oldContents.getFormatterRef().offsetStored = true;
    node.oldContents.getFormatterRef().getFormatter().dispatchDocumentEvent(1040, null);
    pruneCurrentToTop();
    nodes.addElement(node);
    currentPos++;
    enforceContentsThreshold(currentPos - purgeContentsThreshold);
    enforceURLThreshold(currentPos - purgeURLThreshold);
    for (int i = 0; i < nodes.size(); i++) {
      Node node1 = (Node) nodes.elementAt(i);
      if (node1.extViewer) {
        node.oldContents = node1.oldContents;
        nodes.removeElementAt(i);
        currentPos--;
      }
    }
  }