Example #1
0
  /**
   * Remove entire composite Fig from Diagram. Discover the attached FigEdgeAssociationClass and the
   * FigClassAssociationClass attached to that. Remove them from the diagram before removing this.
   */
  @Override
  protected void removeFromDiagramImpl() {
    FigEdgeAssociationClass figEdgeLink = null;
    List edges = null;

    FigEdgePort figEdgePort = getEdgePort();
    if (figEdgePort != null) {
      edges = figEdgePort.getFigEdges();
    }

    if (edges != null) {
      for (Iterator it = edges.iterator(); it.hasNext() && figEdgeLink == null; ) {
        Object o = it.next();
        if (o instanceof FigEdgeAssociationClass) {
          figEdgeLink = (FigEdgeAssociationClass) o;
        }
      }
    }

    if (figEdgeLink != null) {
      FigNode figClassBox = figEdgeLink.getDestFigNode();
      if (!(figClassBox instanceof FigClassAssociationClass)) {
        figClassBox = figEdgeLink.getSourceFigNode();
      }
      figEdgeLink.removeFromDiagramImpl();
      ((FigClassAssociationClass) figClassBox).removeFromDiagramImpl();
    }

    super.removeFromDiagramImpl();
  }
Example #2
0
  /**
   * Gets FigClassAssociationClass that is contained in this FigAssociationClass.
   *
   * @return FigClassAssociationClass that is contained in this FigAssociationClass.
   */
  public FigClassAssociationClass getAssociationClass() {
    FigEdgeAssociationClass figEdgeLink = null;
    List edges = null;

    FigEdgePort figEdgePort = this.getEdgePort();
    if (figEdgePort != null) {
      edges = figEdgePort.getFigEdges();
    }

    if (edges != null) {
      for (Iterator it = edges.iterator(); it.hasNext() && figEdgeLink == null; ) {
        Object o = it.next();
        if (o instanceof FigEdgeAssociationClass) {
          figEdgeLink = (FigEdgeAssociationClass) o;
        }
      }
    }

    FigNode figClassBox = null;
    if (figEdgeLink != null) {
      figClassBox = figEdgeLink.getDestFigNode();
      if (!(figClassBox instanceof FigClassAssociationClass)) {
        figClassBox = figEdgeLink.getSourceFigNode();
      }
    }
    return (FigClassAssociationClass) figClassBox;
  }
 /** Create a FigCommentPort if needed */
 public void makeEdgePort() {
   if (edgePort == null) {
     edgePort = new FigEdgePort();
     edgePort.setOwner(getOwner());
     edgePort.setVisible(false);
     addPathItem(edgePort, new PathConvPercent(this, 50, 0));
   }
 }
Example #4
0
  /**
   * Gets FigEdgeAssociationClass that is contained in this FigAssociationClass.
   *
   * @return FigEdgeAssociationClass that is contained in this FigAssociationClass
   */
  public FigEdgeAssociationClass getFigEdgeAssociationClass() {
    FigEdgeAssociationClass figEdgeLink = null;
    List edges = null;

    FigEdgePort figEdgePort = this.getEdgePort();
    if (figEdgePort != null) {
      edges = figEdgePort.getFigEdges();
    }

    if (edges != null) {
      for (Iterator it = edges.iterator(); it.hasNext() && figEdgeLink == null; ) {
        Object o = it.next();
        if (o instanceof FigEdgeAssociationClass) {
          figEdgeLink = (FigEdgeAssociationClass) o;
        }
      }
    }

    return figEdgeLink;
  }