/**
   * Causes an {@link SmallStepNodeComponent#update() on all
   * nodes that have changed.<br>
   * <br>
   * When all updates are done relayouts the View.
   *
   * @see #relayout()
   */
  @Override
  protected void nodesChanged(TreeModelEvent event) {
    boolean relayout = false;
    Object[] children = event.getChildren();
    if (children == null) {

      // if the children are null and the path only contains one element
      // this element is the root node.
      if (event.getPath().length == 1) {
        SmallStepProofNode proofNode = (SmallStepProofNode) event.getPath()[0];
        SmallStepNodeComponent nodeComponent = (SmallStepNodeComponent) proofNode.getUserObject();
        if (nodeComponent != null) {
          nodeComponent.update();
          relayout = true;
        }
      }
    } else {
      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) {
            nodeComponent.update();
            relayout = true;
          }
        }
      }
    }
    if (relayout) {
      relayout();
    }
  }