Package org.eclipse.draw2d

Examples of org.eclipse.draw2d.ConnectionAnchor


//            c.setOffsetV(getBounds().height);
//            c.setOffsetH(getBounds().width);
        }
       
        public ConnectionAnchor getOutgoingConnectionAnchorAt(Point p) {
            ConnectionAnchor closest = null;
            long min = Long.MAX_VALUE;
            for (ConnectionAnchor c: outgoingConnectionAnchors) {
                Point p2 = c.getLocation(null);
                long d = p.getDistance2(p2);
                if (d < min) {
View Full Code Here


   * @return The {@link ConnectionAnchor} of the underlying shape.
   */
  public ConnectionAnchor getSourceAnchor(Edge edge, Connection conn) {
    String portName = (String) edge
        .getValue(ObjectType.PARAMETER_SOURCE_PORT);
    ConnectionAnchor anchor = shape.getConnectionAnchor(this, portName,
        true);

    // again another serious flaw in Draw2D: if we decide to add one
    // bendpoint near the start, and the other one in getTargetAnchor, half
    // of the time Draw2D will mess up.
View Full Code Here

   * @return The {@link ConnectionAnchor} of the underlying shape.
   */
  public ConnectionAnchor getTargetAnchor(Edge edge, Connection conn) {
    String portName = (String) edge
        .getValue(ObjectType.PARAMETER_TARGET_PORT);
    ConnectionAnchor anchor = shape.getConnectionAnchor(this, portName,
        false);

    return anchor;
  }
View Full Code Here

//            c.setOffsetV(getBounds().height);
//            c.setOffsetH(getBounds().width);
        }
       
        public ConnectionAnchor getOutgoingConnectionAnchorAt(Point p) {
            ConnectionAnchor closest = null;
            long min = Long.MAX_VALUE;
            for (ConnectionAnchor c: outgoingConnectionAnchors) {
                Point p2 = c.getLocation(null);
                long d = p.getDistance2(p2);
                if (d < min) {
View Full Code Here

    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().getTranslated(0, 3));
        }
        return list;
      }
    };
  return super.getAdapter(key);
View Full Code Here

    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;
      }

    };
View Full Code Here

}

protected Command getConnectionCompleteCommand(CreateConnectionRequest request) { 
  ConnectionCommand command = (ConnectionCommand)request.getStartCommand();
  command.setTarget(getLogicSubpart());
  ConnectionAnchor ctor = getLogicEditPart().getTargetConnectionAnchor(request);
  if (ctor == null)
    return null;
  command.setTargetTerminal(getLogicEditPart().mapConnectionAnchorToTerminal(ctor));
  return command;
}
View Full Code Here

protected Command getConnectionCreateCommand(CreateConnectionRequest request) {
  ConnectionCommand command = new ConnectionCommand();
  command.setWire(new Wire());
  command.setSource(getLogicSubpart());
  ConnectionAnchor ctor = getLogicEditPart().getSourceConnectionAnchor(request);
  command.setSourceTerminal(getLogicEditPart().mapConnectionAnchorToTerminal(ctor));
  request.setStartCommand(command);
  return command;
}
View Full Code Here

      return null;
 
  ConnectionCommand cmd = new ConnectionCommand();
  cmd.setWire((Wire)request.getConnectionEditPart().getModel());

  ConnectionAnchor ctor = getLogicEditPart().getTargetConnectionAnchor(request);
  cmd.setTarget(getLogicSubpart());
  cmd.setTargetTerminal(getLogicEditPart().mapConnectionAnchorToTerminal(ctor));
  return cmd;
}
View Full Code Here

protected Command getReconnectSourceCommand(ReconnectRequest request) {
  ConnectionCommand cmd = new ConnectionCommand();
  cmd.setWire((Wire)request.getConnectionEditPart().getModel());

  ConnectionAnchor ctor = getLogicEditPart().getSourceConnectionAnchor(request);
  cmd.setSource(getLogicSubpart());
  cmd.setSourceTerminal(getLogicEditPart().mapConnectionAnchorToTerminal(ctor));
  return cmd;
}
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.