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);
      }
    }
  }
  /** Return a Fig that can be used to represent the given edge */
  public FigEdge getFigEdgeFor(GraphModel gm, Layer lay, Object edge) {
    if (edge instanceof MDependency) {

      MDependency dep = (MDependency) edge;
      FigDependency depFig = new FigDependency(dep);

      MModelElement supplier = (MModelElement) ((dep.getSuppliers().toArray())[0]);
      MModelElement client = (MModelElement) ((dep.getClients().toArray())[0]);

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

      depFig.setSourcePortFig(cliFN);
      depFig.setSourceFigNode(cliFN);
      depFig.setDestPortFig(supFN);
      depFig.setDestFigNode(supFN);
      depFig.getFig().setLayer(lay);
      depFig.getFig().setDashed(true);
      return depFig;
    }

    if (edge instanceof MAssociation) {
      MAssociation asc = (MAssociation) edge;
      FigAssociation ascFig = new FigAssociation(asc, lay);
      Collection connections = asc.getConnections();
      if (connections == null) System.out.println("null connections....");
      Object[] connArray = connections.toArray();
      MAssociationEnd fromEnd = (MAssociationEnd) connArray[0];
      MClassifier fromCls = (MClassifier) fromEnd.getType();
      MAssociationEnd toEnd = (MAssociationEnd) connArray[1];
      MClassifier toCls = (MClassifier) toEnd.getType();
      FigNode fromFN = (FigNode) lay.presentationFor(fromCls);
      FigNode toFN = (FigNode) lay.presentationFor(toCls);
      ascFig.setSourcePortFig(fromFN);
      ascFig.setSourceFigNode(fromFN);
      ascFig.setDestPortFig(toFN);
      ascFig.setDestFigNode(toFN);
      ascFig.getFig().setLayer(lay);
      return ascFig;
    }
    return null;
  }