当前位置: 首页>>代码示例>>Java>>正文


Java ReconnectRequest.getTarget方法代码示例

本文整理汇总了Java中org.eclipse.gef.requests.ReconnectRequest.getTarget方法的典型用法代码示例。如果您正苦于以下问题:Java ReconnectRequest.getTarget方法的具体用法?Java ReconnectRequest.getTarget怎么用?Java ReconnectRequest.getTarget使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.gef.requests.ReconnectRequest的用法示例。


在下文中一共展示了ReconnectRequest.getTarget方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getSourceConnectionAnchor

import org.eclipse.gef.requests.ReconnectRequest; //导入方法依赖的package包/类
public ConnectionAnchor getSourceConnectionAnchor(Request request) {
    //return new ChopboxAnchor(getFigure());
	if(request instanceof ReconnectRequest) {
		ReconnectRequest r = (ReconnectRequest)request;
		NodeConnectionEditPart con =(NodeConnectionEditPart) r.getConnectionEditPart();
		NodeConnection conModel = (NodeConnection)con.getModel();
		BorderAnchor anchor = con.getSourceAnchor();
		GraphicalEditPart part = (GraphicalEditPart)r.getTarget();
		if(anchor == null || anchor.getOwner() != part.getFigure()) {
		    anchor = new RectangleBorderAnchor(getFigure());
			anchor.setAngle(conModel.getSourceAngle());
			con.setSourceAnchor(anchor);
		}
		
		Point loc = r.getLocation();
		Rectangle rect = Rectangle.SINGLETON;
		rect.setBounds(getFigure().getBounds());
		getFigure().translateToAbsolute(rect);
		Point ref = rect.getCenter();
		double dx = loc.x - ref.x;
		double dy = loc.y - ref.y;
		anchor.setAngle(Math.atan2(dy, dx));
		con.setSourceAnchor(anchor);
		conModel.setSourceAngle(anchor.getAngle());
		return anchor;		
	} else {
			return new RectangleBorderAnchor(getFigure());
	}
}
 
开发者ID:winture,项目名称:wt-studio,代码行数:30,代码来源:BONodeEditPart.java

示例2: getTargetConnectionAnchor

import org.eclipse.gef.requests.ReconnectRequest; //导入方法依赖的package包/类
public ConnectionAnchor getTargetConnectionAnchor(Request request) {
    //return new ChopboxAnchor(getFigure());

    //return new ChopboxAnchor(getFigure());
	if(request instanceof ReconnectRequest) {
		ReconnectRequest r = (ReconnectRequest)request;
		NodeConnectionEditPart con =(NodeConnectionEditPart) r.getConnectionEditPart();
		NodeConnection conModel = (NodeConnection)con.getModel();
		BorderAnchor anchor = con.getTargetAnchor();
		GraphicalEditPart part = (GraphicalEditPart)r.getTarget();
		if(anchor == null || anchor.getOwner() != part.getFigure()) {
		    anchor = new RectangleBorderAnchor(getFigure());
			anchor.setAngle(conModel.getTargetAngle());
			con.setTargetAnchor(anchor);
		}
		
		Point loc = r.getLocation();
		Rectangle rect = Rectangle.SINGLETON;
		rect.setBounds(getFigure().getBounds());
		getFigure().translateToAbsolute(rect);
		Point ref = rect.getCenter();
		double dx = loc.x - ref.x;
		double dy = loc.y - ref.y;
		anchor.setAngle(Math.atan2(dy, dx));
		con.setTargetAnchor(anchor);
		conModel.setTargetAngle(anchor.getAngle());
		return anchor;		
	} else {
			return new RectangleBorderAnchor(getFigure());
	}

}
 
开发者ID:winture,项目名称:wt-studio,代码行数:33,代码来源:BONodeEditPart.java

示例3: getSourceConnectionAnchor

import org.eclipse.gef.requests.ReconnectRequest; //导入方法依赖的package包/类
public ConnectionAnchor getSourceConnectionAnchor(Request request) {
	if(request instanceof ReconnectRequest) {
		ReconnectRequest r = (ReconnectRequest)request;
		ColumnConnectionEditPart con =(ColumnConnectionEditPart) r.getConnectionEditPart();
		ColumnConnection conModel = (ColumnConnection)con.getModel();
		BorderAnchor anchor = con.getSourceAnchor();
		GraphicalEditPart part = (GraphicalEditPart)r.getTarget();
		if(anchor == null || anchor.getOwner() != part.getFigure()) {
		    anchor = new RectangleBorderAnchor(getFigure());
			anchor.setAngle(conModel.getSourceAngle());
			con.setSourceAnchor(anchor);
		}
		
		Point loc = r.getLocation();
		Rectangle rect = Rectangle.SINGLETON;
		rect.setBounds(getFigure().getBounds());
		getFigure().translateToAbsolute(rect);
		Point ref = rect.getCenter();
		double dx = loc.x - ref.x;
		double dy = loc.y - ref.y;
		anchor.setAngle(Math.atan2(dy, dx));
		con.setSourceAnchor(anchor);
		conModel.setSourceAngle(anchor.getAngle());
		return anchor;		
	} else {
			return new RectangleBorderAnchor(getFigure());
	}
}
 
开发者ID:winture,项目名称:wt-studio,代码行数:29,代码来源:FunctionColumnModelEditPart.java

示例4: getTargetConnectionAnchor

import org.eclipse.gef.requests.ReconnectRequest; //导入方法依赖的package包/类
public ConnectionAnchor getTargetConnectionAnchor(Request request) {
	if(request instanceof ReconnectRequest) {
		ReconnectRequest r = (ReconnectRequest)request;
		ColumnConnectionEditPart con =(ColumnConnectionEditPart) r.getConnectionEditPart();
		ColumnConnection conModel = (ColumnConnection)con.getModel();
		BorderAnchor anchor = con.getTargetAnchor();
		GraphicalEditPart part = (GraphicalEditPart)r.getTarget();
		if(anchor == null || anchor.getOwner() != part.getFigure()) {
		    anchor = new RectangleBorderAnchor(getFigure());
			anchor.setAngle(conModel.getTargetAngle());
			con.setTargetAnchor(anchor);
		}
		
		Point loc = r.getLocation();
		Rectangle rect = Rectangle.SINGLETON;
		rect.setBounds(getFigure().getBounds());
		getFigure().translateToAbsolute(rect);
		Point ref = rect.getCenter();
		double dx = loc.x - ref.x;
		double dy = loc.y - ref.y;
		anchor.setAngle(Math.atan2(dy, dx));
		con.setTargetAnchor(anchor);
		conModel.setTargetAngle(anchor.getAngle());
		return anchor;		
	} else {
			return new RectangleBorderAnchor(getFigure());
	}
}
 
开发者ID:winture,项目名称:wt-studio,代码行数:29,代码来源:FunctionColumnModelEditPart.java

示例5: getSourceConnectionAnchor

import org.eclipse.gef.requests.ReconnectRequest; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public ConnectionAnchor getSourceConnectionAnchor(final Request request) {
    if (request instanceof ReconnectRequest) {
        final ReconnectRequest reconnectRequest = (ReconnectRequest) request;

        final ConnectionEditPart connectionEditPart = reconnectRequest.getConnectionEditPart();

        // if (!(connectionEditPart instanceof RelationEditPart)) {
        // return super.getSourceConnectionAnchor(request);
        // }

        final ConnectionElement connection = (ConnectionElement) connectionEditPart.getModel();
        if (connection.getSource() == connection.getTarget()) {
            return new XYChopboxAnchor(getFigure());
        }

        final EditPart editPart = reconnectRequest.getTarget();

        if (editPart == null || !editPart.getModel().equals(connection.getSource())) {
            return new XYChopboxAnchor(getFigure());
        }

        final Point location = new Point(reconnectRequest.getLocation());
        getFigure().translateToRelative(location);
        final IFigure sourceFigure = ((TableViewEditPart) connectionEditPart.getSource()).getFigure();

        final XYChopboxAnchor anchor = new XYChopboxAnchor(getFigure());

        final Rectangle bounds = sourceFigure.getBounds();

        final Rectangle centerRectangle = new Rectangle(bounds.x + (bounds.width / 4), bounds.y + (bounds.height / 4), bounds.width / 2, bounds.height / 2);

        if (!centerRectangle.contains(location)) {
            final Point point = getIntersectionPoint(location, sourceFigure);
            anchor.setLocation(point);
        }

        return anchor;

    } else if (request instanceof CreateConnectionRequest) {
        final CreateConnectionRequest connectionRequest = (CreateConnectionRequest) request;

        final Command command = connectionRequest.getStartCommand();

        if (command instanceof CreateCommentConnectionCommand) {
            return new ChopboxAnchor(getFigure());
        }
    }

    return new XYChopboxAnchor(getFigure());
}
 
开发者ID:roundrop,项目名称:ermasterr,代码行数:55,代码来源:NodeElementEditPart.java

示例6: getTargetConnectionAnchor

import org.eclipse.gef.requests.ReconnectRequest; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public ConnectionAnchor getTargetConnectionAnchor(final Request request) {
    if (request instanceof ReconnectRequest) {
        final ReconnectRequest reconnectRequest = (ReconnectRequest) request;

        final ConnectionEditPart connectionEditPart = reconnectRequest.getConnectionEditPart();

        // if (!(connectionEditPart instanceof RelationEditPart)) {
        // return super.getTargetConnectionAnchor(request);
        // }

        final ConnectionElement connection = (ConnectionElement) connectionEditPart.getModel();
        if (connection.getSource() == connection.getTarget()) {
            return new XYChopboxAnchor(getFigure());
        }

        final EditPart editPart = reconnectRequest.getTarget();

        if (editPart == null || !editPart.getModel().equals(connection.getTarget())) {
            return new XYChopboxAnchor(getFigure());
        }

        final Point location = new Point(reconnectRequest.getLocation());
        getFigure().translateToRelative(location);
        final IFigure targetFigure = ((AbstractModelEditPart) connectionEditPart.getTarget()).getFigure();

        final XYChopboxAnchor anchor = new XYChopboxAnchor(getFigure());

        final Rectangle bounds = targetFigure.getBounds();

        final Rectangle centerRectangle = new Rectangle(bounds.x + (bounds.width / 4), bounds.y + (bounds.height / 4), bounds.width / 2, bounds.height / 2);

        if (!centerRectangle.contains(location)) {
            final Point point = getIntersectionPoint(location, targetFigure);
            anchor.setLocation(point);
        }

        return anchor;

    } else if (request instanceof CreateConnectionRequest) {
        final CreateConnectionRequest connectionRequest = (CreateConnectionRequest) request;

        final Command command = connectionRequest.getStartCommand();

        if (command instanceof CreateCommentConnectionCommand) {
            return new ChopboxAnchor(getFigure());
        }
    }

    return new XYChopboxAnchor(getFigure());
}
 
开发者ID:roundrop,项目名称:ermasterr,代码行数:55,代码来源:NodeElementEditPart.java

示例7: getSourceConnectionAnchor

import org.eclipse.gef.requests.ReconnectRequest; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
public ConnectionAnchor getSourceConnectionAnchor(Request request) {
	if (request instanceof ReconnectRequest) {
		ReconnectRequest reconnectRequest = (ReconnectRequest) request;

		ConnectionEditPart connectionEditPart = reconnectRequest
				.getConnectionEditPart();

		// if (!(connectionEditPart instanceof RelationEditPart)) {
		// return super.getSourceConnectionAnchor(request);
		// }

		ConnectionElement connection = (ConnectionElement) connectionEditPart
				.getModel();
		if (connection.getSource() == connection.getTarget()) {
			return new XYChopboxAnchor(this.getFigure());
		}

		EditPart editPart = reconnectRequest.getTarget();

		if (editPart == null
				|| !editPart.getModel().equals(connection.getSource())) {
			return new XYChopboxAnchor(this.getFigure());
		}

		Point location = new Point(reconnectRequest.getLocation());
		this.getFigure().translateToRelative(location);
		IFigure sourceFigure = ((TableViewEditPart) connectionEditPart
				.getSource()).getFigure();

		XYChopboxAnchor anchor = new XYChopboxAnchor(this.getFigure());

		Rectangle bounds = sourceFigure.getBounds();

		Rectangle centerRectangle = new Rectangle(bounds.x
				+ (bounds.width / 4), bounds.y + (bounds.height / 4),
				bounds.width / 2, bounds.height / 2);

		if (!centerRectangle.contains(location)) {
			Point point = getIntersectionPoint(location, sourceFigure);
			anchor.setLocation(point);
		}

		return anchor;

	} else if (request instanceof CreateConnectionRequest) {
		CreateConnectionRequest connectionRequest = (CreateConnectionRequest) request;

		Command command = connectionRequest.getStartCommand();

		if (command instanceof CreateCommentConnectionCommand) {
			return new ChopboxAnchor(this.getFigure());
		}
	}

	return new XYChopboxAnchor(this.getFigure());
}
 
开发者ID:kozake,项目名称:ermaster-k,代码行数:60,代码来源:NodeElementEditPart.java

示例8: getTargetConnectionAnchor

import org.eclipse.gef.requests.ReconnectRequest; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
public ConnectionAnchor getTargetConnectionAnchor(Request request) {
	if (request instanceof ReconnectRequest) {
		ReconnectRequest reconnectRequest = (ReconnectRequest) request;

		ConnectionEditPart connectionEditPart = reconnectRequest
				.getConnectionEditPart();

		// if (!(connectionEditPart instanceof RelationEditPart)) {
		// return super.getTargetConnectionAnchor(request);
		// }

		ConnectionElement connection = (ConnectionElement) connectionEditPart
				.getModel();
		if (connection.getSource() == connection.getTarget()) {
			return new XYChopboxAnchor(this.getFigure());
		}

		EditPart editPart = reconnectRequest.getTarget();

		if (editPart == null
				|| !editPart.getModel().equals(connection.getTarget())) {
			return new XYChopboxAnchor(this.getFigure());
		}

		Point location = new Point(reconnectRequest.getLocation());
		this.getFigure().translateToRelative(location);
		IFigure targetFigure = ((AbstractModelEditPart) connectionEditPart
				.getTarget()).getFigure();

		XYChopboxAnchor anchor = new XYChopboxAnchor(this.getFigure());

		Rectangle bounds = targetFigure.getBounds();

		Rectangle centerRectangle = new Rectangle(bounds.x
				+ (bounds.width / 4), bounds.y + (bounds.height / 4),
				bounds.width / 2, bounds.height / 2);

		if (!centerRectangle.contains(location)) {
			Point point = getIntersectionPoint(location, targetFigure);
			anchor.setLocation(point);
		}

		return anchor;

	} else if (request instanceof CreateConnectionRequest) {
		CreateConnectionRequest connectionRequest = (CreateConnectionRequest) request;

		Command command = connectionRequest.getStartCommand();

		if (command instanceof CreateCommentConnectionCommand) {
			return new ChopboxAnchor(this.getFigure());
		}
	}

	return new XYChopboxAnchor(this.getFigure());
}
 
开发者ID:kozake,项目名称:ermaster-k,代码行数:60,代码来源:NodeElementEditPart.java

示例9: getSourceConnectionAnchor

import org.eclipse.gef.requests.ReconnectRequest; //导入方法依赖的package包/类
@Override
public ConnectionAnchor getSourceConnectionAnchor(Request request) {
    if (request instanceof ReconnectRequest) {
        final ReconnectRequest reconnectRequest = (ReconnectRequest) request;
        final ConnectionEditPart connectionEditPart = reconnectRequest.getConnectionEditPart();
        if (!(connectionEditPart instanceof RelationEditPart)) {
            return super.getSourceConnectionAnchor(request);
        }

        final Relationship relation = (Relationship) connectionEditPart.getModel();
        if (relation.getSourceWalker() == relation.getTargetWalker()) {
            return new XYChopboxAnchor(getFigure());
        }

        final EditPart editPart = reconnectRequest.getTarget();
        if (editPart == null || !editPart.getModel().equals(relation.getSourceWalker())) {
            return new XYChopboxAnchor(getFigure());
        }

        final Point location = new Point(reconnectRequest.getLocation());
        getFigure().translateToRelative(location);

        final IFigure sourceFigure = ((TableViewEditPart) connectionEditPart.getSource()).getFigure();
        final Rectangle bounds = sourceFigure.getBounds();
        final Rectangle centerRectangle =
                new Rectangle(bounds.x + (bounds.width / 4), bounds.y + (bounds.height / 4), bounds.width / 2, bounds.height / 2);

        final XYChopboxAnchor anchor = new XYChopboxAnchor(getFigure());
        if (!centerRectangle.contains(location)) {
            final Point point = getIntersectionPoint(location, sourceFigure);
            anchor.setLocation(point);
        }

        return anchor;
    } else if (request instanceof CreateConnectionRequest) {
        final CreateConnectionRequest connectionRequest = (CreateConnectionRequest) request;
        final Command command = connectionRequest.getStartCommand();
        if (command instanceof CreateCommentConnectionCommand) {
            return super.getTargetConnectionAnchor(request);
        }
    }

    return new XYChopboxAnchor(getFigure());
}
 
开发者ID:dbflute-session,项目名称:erflute,代码行数:45,代码来源:TableViewEditPart.java

示例10: getTargetConnectionAnchor

import org.eclipse.gef.requests.ReconnectRequest; //导入方法依赖的package包/类
@Override
public ConnectionAnchor getTargetConnectionAnchor(Request request) {
    if (request instanceof ReconnectRequest) {
        final ReconnectRequest reconnectRequest = (ReconnectRequest) request;
        final ConnectionEditPart connectionEditPart = reconnectRequest.getConnectionEditPart();
        if (!(connectionEditPart instanceof RelationEditPart)) {
            return super.getTargetConnectionAnchor(request);
        }

        final Relationship relation = (Relationship) connectionEditPart.getModel();
        if (relation.getSourceWalker() == relation.getTargetWalker()) {
            return new XYChopboxAnchor(getFigure());
        }

        final EditPart editPart = reconnectRequest.getTarget();
        if (editPart == null || !editPart.getModel().equals(relation.getTargetWalker())) {
            return new XYChopboxAnchor(getFigure());
        }

        final Point location = new Point(reconnectRequest.getLocation());
        getFigure().translateToRelative(location);

        final IFigure targetFigure = ((TableViewEditPart) connectionEditPart.getTarget()).getFigure();
        final Rectangle bounds = targetFigure.getBounds();
        final Rectangle centerRectangle =
                new Rectangle(bounds.x + (bounds.width / 4), bounds.y + (bounds.height / 4), bounds.width / 2, bounds.height / 2);
        final XYChopboxAnchor anchor = new XYChopboxAnchor(getFigure());
        if (!centerRectangle.contains(location)) {
            final Point point = getIntersectionPoint(location, targetFigure);
            anchor.setLocation(point);
        }

        return anchor;
    } else if (request instanceof CreateConnectionRequest) {
        final CreateConnectionRequest connectionRequest = (CreateConnectionRequest) request;
        final Command command = connectionRequest.getStartCommand();
        if (command instanceof CreateCommentConnectionCommand) {
            return super.getTargetConnectionAnchor(request);
        }
    }

    return new XYChopboxAnchor(getFigure());
}
 
开发者ID:dbflute-session,项目名称:erflute,代码行数:44,代码来源:TableViewEditPart.java


注:本文中的org.eclipse.gef.requests.ReconnectRequest.getTarget方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。