Package org.eclipse.draw2d

Examples of org.eclipse.draw2d.ConnectionAnchor


    return new DefaultAccessibleAnchorProvider() {
      public List getSourceAnchorLocations() {
        List list = new ArrayList();
        Vector sourceAnchors = getNodeFigure().getSourceConnectionAnchors();
        for (int i=0; i<sourceAnchors.size(); i++) {
          ConnectionAnchor anchor = (ConnectionAnchor)sourceAnchors.get(i);
          list.add(anchor.getReferencePoint().getTranslated(0, -3));
        }
        return list;
      }
      public List getTargetAnchorLocations() {
        List list = new ArrayList();
        Vector targetAnchors = getNodeFigure().getTargetConnectionAnchors();
        for (int i=0; i<targetAnchors.size(); i++) {
          ConnectionAnchor anchor = (ConnectionAnchor)targetAnchors.get(i);
          list.add(anchor.getReferencePoint());
        }
        return list;
      }
    };
  return super.getAdapter(key);
View Full Code Here


      public List getSourceAnchorLocations() {
        List list = new ArrayList();
        Vector sourceAnchors = getNodeFigure().getSourceConnectionAnchors();
        Vector targetAnchors = getNodeFigure().getTargetConnectionAnchors();
        for (int i=0; i<sourceAnchors.size(); i++) {
          ConnectionAnchor sourceAnchor = (ConnectionAnchor)sourceAnchors.get(i);
          ConnectionAnchor targetAnchor = (ConnectionAnchor)targetAnchors.get(i);
          list.add(new Rectangle(sourceAnchor.getReferencePoint(), targetAnchor.getReferencePoint()).getCenter());
        }
        return list;
      }
      public List getTargetAnchorLocations() {
        return getSourceAnchorLocations();
View Full Code Here

protected Hashtable connectionAnchors = new Hashtable(7);
protected Vector inputConnectionAnchors = new Vector(2,2);
protected Vector outputConnectionAnchors = new Vector(2,2);

public ConnectionAnchor connectionAnchorAt(Point p) {
  ConnectionAnchor closest = null;
  long min = Long.MAX_VALUE;

  Enumeration e = getSourceConnectionAnchors().elements();
  while (e.hasMoreElements()) {
    ConnectionAnchor c = (ConnectionAnchor) e.nextElement();
    Point p2 = c.getLocation(null);
    long d = p.getDistance2(p2);
    if (d < min) {
      min = d;
      closest = c;
    }
  }
  e = getTargetConnectionAnchors().elements();
  while (e.hasMoreElements()) {
    ConnectionAnchor c = (ConnectionAnchor) e.nextElement();
    Point p2 = c.getLocation(null);
    long d = p.getDistance2(p2);
    if (d < min) {
      min = d;
      closest = c;
    }
View Full Code Here

  }
  return null;
}

public ConnectionAnchor getSourceConnectionAnchorAt(Point p) {
  ConnectionAnchor closest = null;
  long min = Long.MAX_VALUE;

  Enumeration e = getSourceConnectionAnchors().elements();
  while (e.hasMoreElements()) {
    ConnectionAnchor c = (ConnectionAnchor) e.nextElement();
    Point p2 = c.getLocation(null);
    long d = p.getDistance2(p2);
    if (d < min) {
      min = d;
      closest = c;
    }
View Full Code Here

public Vector getSourceConnectionAnchors() {
  return outputConnectionAnchors;
}

public ConnectionAnchor getTargetConnectionAnchorAt(Point p) {
  ConnectionAnchor closest = null;
  long min = Long.MAX_VALUE;

  Enumeration e = getTargetConnectionAnchors().elements();
  while (e.hasMoreElements()) {
    ConnectionAnchor c = (ConnectionAnchor) e.nextElement();
    Point p2 = c.getLocation(null);
    long d = p.getDistance2(p2);
    if (d < min) {
      min = d;
      closest = c;
    }
View Full Code Here

    if (connection instanceof TransitionPart) {
      TransitionPart part = (TransitionPart) connection;
      Transition trans = (Transition) part.getModel();
      IDOMNode input = trans.getInput();
      if (input != null) {
        ConnectionAnchor anchor = ((BorderedActivityLabel) getFigure()).getConnectionAnchor(trans.getInput()
            .getLocalName());
        if (anchor != null) {
          return anchor;
        }
      }
View Full Code Here

  }

  @Override
  public ConnectionAnchor getSourceConnectionAnchor(Request request) {
    Point pt = new Point(((DropRequest) request).getLocation());
    ConnectionAnchor anchor = ((BorderedActivityLabel) getFigure()).getSourceConnectionAnchorAt(pt);
    if (anchor != null) {
      return anchor;
    }
    return super.getSourceConnectionAnchor(request);
  }
View Full Code Here

    if (connection instanceof TransitionPart) {
      TransitionPart part = (TransitionPart) connection;
      Transition trans = (Transition) part.getModel();
      IDOMNode input = trans.getInput();
      if (input != null) {
        ConnectionAnchor anchor = ((BorderedActivityLabel) getFigure()).getConnectionAnchor(trans.getInput()
            .getLocalName());
        if (anchor != null) {
          return anchor;
        }
      }
View Full Code Here

  }

  @Override
  public ConnectionAnchor getTargetConnectionAnchor(Request request) {
    Point pt = new Point(((DropRequest) request).getLocation());
    ConnectionAnchor anchor = ((BorderedActivityLabel) getFigure()).getTargetConnectionAnchorAt(pt);
    if (anchor != null) {
      return anchor;
    }
    return super.getTargetConnectionAnchor(request);
  }
View Full Code Here

    }
    return d;
  }

  public ConnectionAnchor connectionAnchorAt(Point p) {
    ConnectionAnchor closest = null;
    long min = Long.MAX_VALUE;

    Enumeration<FixedConnectionAnchor> e = getSourceConnectionAnchors().elements();
    while (e.hasMoreElements()) {
      ConnectionAnchor c = e.nextElement();
      Point p2 = c.getLocation(null);
      long d = p.getDistance2(p2);
      if (d < min) {
        min = d;
        closest = c;
      }
    }
    e = getTargetConnectionAnchors().elements();
    while (e.hasMoreElements()) {
      ConnectionAnchor c = e.nextElement();
      Point p2 = c.getLocation(null);
      long d = p.getDistance2(p2);
      if (d < min) {
        min = d;
        closest = c;
      }
View Full Code Here

TOP

Related Classes of org.eclipse.draw2d.ConnectionAnchor

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.