Ejemplo n.º 1
0
  public void setOwner(Object own) {
    Object oldOwner = getOwner();
    super.setOwner(own);

    if (own instanceof MDependency) {
      MDependency newDep = (MDependency) own;
      for (int i = 0; i < newDep.getSuppliers().size(); i++) {
        ((MModelElement) ((Object[]) newDep.getSuppliers().toArray())[i])
            .removeMElementListener(this);
        ((MModelElement) ((Object[]) newDep.getSuppliers().toArray())[i]).addMElementListener(this);
      }
      for (int i = 0; i < newDep.getClients().size(); i++) {
        ((MModelElement) ((Object[]) newDep.getClients().toArray())[i])
            .removeMElementListener(this);
        ((MModelElement) ((Object[]) newDep.getClients().toArray())[i]).addMElementListener(this);
      }
      newDep.removeMElementListener(this);
      newDep.addMElementListener(this);
      MModelElement supplier = (MModelElement) ((newDep.getSuppliers().toArray())[0]);
      MModelElement client = (MModelElement) ((newDep.getClients().toArray())[0]);

      FigNode supFN = (FigNode) getLayer().presentationFor(supplier);
      FigNode cliFN = (FigNode) getLayer().presentationFor(client);

      if (cliFN != null) {
        setSourcePortFig(cliFN);
        setSourceFigNode(cliFN);
      }
      if (supFN != null) {
        setDestPortFig(supFN);
        setDestFigNode(supFN);
      }
    }
  }
Ejemplo n.º 2
0
 public void setFig(Fig f) {
   super.setFig(f);
   _fig.setDashed(true);
   // computeRoute(); // this recomputes the route if you reload the diagram.
 }
Ejemplo n.º 3
0
 public void paint(Graphics g) {
   endArrow.setLineColor(getLineColor());
   super.paint(g);
 }
  public void setEnclosingFig(Fig encloser) {

    if (encloser != null && encloser.getOwner() instanceof MNodeInstance && getOwner() != null) {
      MNodeInstance node = (MNodeInstance) encloser.getOwner();
      MComponentInstance comp = (MComponentInstance) getOwner();
      if (comp.getNodeInstance() != node) {
        comp.setNodeInstance(node);
      }
      super.setEnclosingFig(encloser);

      Vector figures = getEnclosedFigs();

      if (getLayer() != null) {
        // elementOrdering(figures);
        Vector contents = getLayer().getContents();
        int contentsSize = contents.size();
        for (int j = 0; j < contentsSize; j++) {
          Object o = contents.elementAt(j);
          if (o instanceof FigEdgeModelElement) {
            FigEdgeModelElement figedge = (FigEdgeModelElement) o;
            figedge.getLayer().bringToFront(figedge);
          }
        }
      }
    } else if (encloser == null && getEnclosingFig() != null) {
      if (getEnclosingFig() instanceof FigNodeModelElement)
        ((FigNodeModelElement) getEnclosingFig()).getEnclosedFigs().removeElement(this);
      _encloser = null;
    }
    /*
    super.setEnclosingFig(encloser);

    Vector figures = getEnclosedFigs();

    if (getLayer() != null) {
      // elementOrdering(figures);
      Vector contents = getLayer().getContents();
      int contentsSize = contents.size();
      for (int j=0; j<contentsSize; j++) {
        Object o = contents.elementAt(j);
        if (o instanceof FigEdgeModelElement) {
          FigEdgeModelElement figedge = (FigEdgeModelElement) o;
          figedge.getLayer().bringToFront(figedge);
        }
      }
    }

    if (!(getOwner() instanceof MModelElement)) return;
    if (getOwner() instanceof MComponentInstance) {
      MComponentInstance me = (MComponentInstance) getOwner();
      MNodeInstance mnode = null;

      if (encloser != null && (encloser.getOwner() instanceof MNodeInstance)) {
        mnode = (MNodeInstance) encloser.getOwner();
      }
      if (encloser != null && (encloser.getOwner() instanceof MComponentInstance)) {
        MComponentInstance comp = (MComponentInstance) encloser.getOwner();
        mnode = (MNodeInstance) comp.getNodeInstance();
      }
      try {
        if(mnode != null) {
          me.setNodeInstance(mnode);
        }
        else {
          if (me.getNodeInstance() != null) {
            me.setNodeInstance(null);
          }
        }
        setNode(figures);
      }
      catch (Exception e) {
        cat.error("could not set package", e);

      }
    }
    */
  }