/**
   * Notify this controller that the most recently created canvas has been tagged, such that if it
   * is also linked, this controller can discern whether to collapse the chain and make the new
   * canvsa sibling of the canvas it was created from.
   */
  public void collapseLikeIntentionTypes() {
    if (canvasCreationContext != null) {
      long linkOriginCanvasId = canvasCreationContext.originatingCanvasId;
      long parentCanvasId = 0L;
      for (long anchorId :
          CCanvasLinkController.getInstance()
              .getAnchorIdsByCanvasId(canvasCreationContext.originatingCanvasId)) {
        CCanvasLinkAnchor anchor = CCanvasLinkController.getInstance().getAnchor(anchorId);
        if (anchor.getLink().getAnchorB() == anchor) {
          parentCanvasId = anchor.getOpposite().getCanvasId();
          break;
        }
      }

      if (parentCanvasId > 0L) {
        CIntentionCell newCell =
            CIntentionCellController.getInstance()
                .getCellByCanvasId(canvasCreationContext.newCanvasId);
        CIntentionCell originatingCell =
            CIntentionCellController.getInstance()
                .getCellByCanvasId(canvasCreationContext.originatingCanvasId);
        if ((newCell != null)
            && (originatingCell != null)
            && (originatingCell.getIntentionTypeId() == newCell.getIntentionTypeId())) {
          linkOriginCanvasId = parentCanvasId;
        }
      }
      // collapse like tags
      CCanvasLinkController.getInstance()
          .createLink(linkOriginCanvasId, canvasCreationContext.newCanvasId);
    }
  }
  @Override
  public void clearContent(long canvas_uuid) {
    CCanvasLinkController.getInstance().clearLinks(canvas_uuid);

    long cellId = CIntentionCellController.getInstance().getCellByCanvasId(canvas_uuid).getId();
    CIntentionCellController.getInstance().clearCell(cellId);
  }
  /**
   * Notify this controller that the Canvas View is now showing <code>canvasId</code>. Updates all
   * visual components accordingly.
   */
  public void canvasChanged(long canvasId) {
    currentCanvasId = canvasId;
    CanvasTitlePanel.getInstance().moveTo(canvasId);
    CanvasTagPanel.getInstance().moveTo(canvasId);

    CCanvasLinkController.getInstance().showingCanvas(canvasId);

    CIntentionCell cell = CIntentionCellController.getInstance().getCellByCanvasId(canvasId);
    if (cell == null) {
      showTagPanel(false);
    } else {
      showTagPanel(!cell.hasIntentionType());
    }

    if ((canvasCreationContext != null) && (canvasId != canvasCreationContext.newCanvasId)) {
      canvasCreationContext = null;
    }
  }