/**
   * Removes all userobjects from the nodes that will be removed by the {@link SmallStepProofModel}
   * later.
   */
  @Override
  protected void nodesRemoved(TreeModelEvent event) {
    Object[] children = event.getChildren();
    if (children == null) {
      return;
    }
    for (int i = 0; i < children.length; i++) {
      if (children[i] instanceof ProofNode) {
        SmallStepProofNode proofNode = (SmallStepProofNode) children[i];

        SmallStepNodeComponent nodeComponent = (SmallStepNodeComponent) proofNode.getUserObject();
        if (nodeComponent != null) {
          remove(nodeComponent);
          proofNode.setUserObject(null);
        }
      }
    }
  }
  /**
   * Traversing the ProofTree recursivly and adds a SmallStepNodeComponent where none is.<br>
   * <br>
   * Usualy only at newly added nodes the SmallStepNodeComponent is missing.
   *
   * @param node When calling this method: the rootNode of the tree.
   */
  void checkForUserObject(SmallStepProofNode node) {
    if (node == null) {
      return;
    }

    SmallStepNodeComponent nodeComponent = (SmallStepNodeComponent) node.getUserObject();
    if (nodeComponent == null) {

      // create the noded that has not been there yet
      nodeComponent =
          new SmallStepNodeComponent(
              node, this.model, this.translator, this.spacing, this.advanced);

      // add the needed listener
      nodeComponent.addSmallStepNodeListener(
          new SmallStepNodeListener() {
            public void nodeChanged(SmallStepNodeComponent pNode) {
              SmallStepComponent.this.relayout();
            }

            public void repaintAll() {
              SmallStepComponent.this.repaint();
            }

            public void requestJumpToNode(ProofNode pNode) {
              SmallStepComponent.this.setJumpNode(pNode);
            }
          });

      nodeComponent.update();

      // save it to the node
      node.setUserObject(nodeComponent);

      // and add the SmallStepNodeComponent to the gui
      add(nodeComponent);
    }

    checkForUserObject(getFirstChild(node));
  }