Java 类org.eclipse.draw2d.XYAnchor 实例源码

项目:NEXCORE-UML-Modeler    文件:LifeLineBehaviorEditPart.java   
/**
 * @see nexcore.tool.uml.ui.core.diagram.edit.part.AbstractNotationNodeEditPart#getSourceConnectionAnchor(org.eclipse.gef.ConnectionEditPart)
 */
public ConnectionAnchor getSourceConnectionAnchor(ConnectionEditPart connection) {
    if (connection instanceof AttachementEditPart) {
        return new ChopboxAnchor(getFigure());
    }

    if (connection.getTarget() != null && connection.getSource() != null) {
        LifeLineNode sourceNode = SequenceUtil.getLifeLineNode((AbstractNode) connection.getSource().getModel());
        LifeLineNode targetNode = SequenceUtil.getLifeLineNode((AbstractNode) connection.getTarget().getModel());
        if (sourceNode.equals(targetNode)) {
            Point point = new Point(sourceNode.getX() + sourceNode.getWidth() / 2,
                ((AbstractView) connection.getModel()).getY());
            connection.getFigure().translateToAbsolute(point);
            return new XYAnchor(point);
        } else {
            return new MessageOutgoingConnectionAnchor(getFigure(), connection);
        }
    } else {
        return new MessageOutgoingConnectionAnchor(getFigure(), connection);
    }
}
项目:NEXCORE-UML-Modeler    文件:LifeLineBehaviorEditPart.java   
/**
 * @see nexcore.tool.uml.ui.core.diagram.edit.part.AbstractNotationNodeEditPart#getTargetConnectionAnchor(org.eclipse.gef.ConnectionEditPart)
 */
public ConnectionAnchor getTargetConnectionAnchor(ConnectionEditPart connection) {
    if (connection instanceof AttachementEditPart) {
        return new ChopboxAnchor(getFigure());
    }

    if (connection.getTarget() != null && connection.getSource() != null) {
        LifeLineNode sourceNode = SequenceUtil.getLifeLineNode((AbstractNode) connection.getSource().getModel());
        LifeLineNode targetNode = SequenceUtil.getLifeLineNode((AbstractNode) connection.getTarget().getModel());
        if (sourceNode.equals(targetNode)) {
            Point point = new Point(targetNode.getX() + targetNode.getWidth() / 2,
                ((AbstractView) connection.getModel()).getY() + 10);
            connection.getFigure().translateToAbsolute(point);
            return new XYAnchor(point);
        } else {
            return new MessageIncommingConnectionAnchor(getFigure(), connection);
        }
    } else {
        return new MessageIncommingConnectionAnchor(getFigure(), connection);
    }
}
项目:gef-gwt    文件:FeedbackHelper.java   
/**
 * Constructs a new FeedbackHelper.
 */
public FeedbackHelper() {
    dummyAnchor = new XYAnchor(new Point(10, 10));
}