本文整理汇总了Java中org.eclipse.gef.requests.BendpointRequest类的典型用法代码示例。如果您正苦于以下问题:Java BendpointRequest类的具体用法?Java BendpointRequest怎么用?Java BendpointRequest使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
BendpointRequest类属于org.eclipse.gef.requests包,在下文中一共展示了BendpointRequest类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getMoveBendpointCommand
import org.eclipse.gef.requests.BendpointRequest; //导入依赖的package包/类
@Override
protected Command getMoveBendpointCommand(BendpointRequest request) {
Viewport vp = ((FigureCanvas) getHost().getViewer().getControl()).getViewport();
Point viewSize = vp.getViewLocation();
Point p = request.getLocation();
p.setX(p.x + viewSize.x);
p.setY(p.y + viewSize.y);
BendpointMoveCommand cmd = new BendpointMoveCommand();
cmd.setLink((Link) request.getSource().getModel());
cmd.setIndex(request.getIndex());
cmd.setNewLocation(p);
return cmd;
}
示例2: getCreateBendpointCommand
import org.eclipse.gef.requests.BendpointRequest; //导入依赖的package包/类
protected Command getCreateBendpointCommand(BendpointRequest request) {
CreateBendpointCommand com = new CreateBendpointCommand();
Point p = request.getLocation();
conn = getConnection();
conn.translateToRelative(p);
com.setLocation(p);
Point ref1 = conn.getSourceAnchor().getReferencePoint();
Point ref2 = conn.getTargetAnchor().getReferencePoint();
conn.translateToRelative(ref1);
conn.translateToRelative(ref2);
com.setRelativeDimensions(p.getDifference(ref1), p.getDifference(ref2));
com.setConn((Connection) request.getSource().getModel());
com.setIndex(request.getIndex());
return com;
}
示例3: getMoveBendpointCommand
import org.eclipse.gef.requests.BendpointRequest; //导入依赖的package包/类
protected Command getMoveBendpointCommand(BendpointRequest request) {
MoveBendpointCommand com = new MoveBendpointCommand();
Point p = request.getLocation();
conn = getConnection();
conn.translateToRelative(p);
com.setLocation(p);
Point ref1 = getConnection().getSourceAnchor().getReferencePoint();
Point ref2 = getConnection().getTargetAnchor().getReferencePoint();
conn.translateToRelative(ref1);
conn.translateToRelative(ref2);
com.setRelativeDimensions(p.getDifference(ref1), p.getDifference(ref2));
com.setConn((Connection) request.getSource().getModel());
com.setIndex(request.getIndex());
return com;
}
示例4: getCreateBendpointCommand
import org.eclipse.gef.requests.BendpointRequest; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
protected Command getCreateBendpointCommand(final BendpointRequest bendpointrequest) {
final AbstractConnectionEditPart connectionEditPart = (AbstractConnectionEditPart) getHost();
final ConnectionElement connection = (ConnectionElement) connectionEditPart.getModel();
if (connection.getSource() == connection.getTarget()) {
return null;
}
final Point point = bendpointrequest.getLocation();
getConnection().translateToRelative(point);
final CreateBendpointCommand createBendpointCommand = new CreateBendpointCommand(connection, point.x, point.y, bendpointrequest.getIndex());
return createBendpointCommand;
}
示例5: getCreateBendpointCommand
import org.eclipse.gef.requests.BendpointRequest; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
protected Command getCreateBendpointCommand(
BendpointRequest bendpointrequest) {
AbstractConnectionEditPart connectionEditPart = (AbstractConnectionEditPart) this
.getHost();
ConnectionElement connection = (ConnectionElement) connectionEditPart
.getModel();
if (connection.getSource() == connection.getTarget()) {
return null;
}
Point point = bendpointrequest.getLocation();
this.getConnection().translateToRelative(point);
CreateBendpointCommand createBendpointCommand = new CreateBendpointCommand(
this.diagram.getCurrentCategory(),
connection, point.x, point.y, bendpointrequest.getIndex());
return createBendpointCommand;
}
示例6: setReferencePoints
import org.eclipse.gef.requests.BendpointRequest; //导入依赖的package包/类
/**
* setReferencePoints
*
* @param request void
*/
private void setReferencePoints(BendpointRequest request) {
PointList points = getConnection().getPoints();
int bpIndex = -1;
List bendPoints = (List)getConnection().getRoutingConstraint();
Point bp = ((Bendpoint)bendPoints.get(request.getIndex())).getLocation();
int smallestDistance = -1;
for (int i = 0; i < points.size(); i++) {
if (smallestDistance == -1
|| points.getPoint(i).getDistance2(bp) < smallestDistance) {
bpIndex = i;
smallestDistance = points.getPoint(i).getDistance2(bp);
if (smallestDistance == 0)
break;
}
}
points.getPoint(ref1, bpIndex - 1);
getConnection().translateToAbsolute(ref1);
points.getPoint(ref2, bpIndex + 1);
getConnection().translateToAbsolute(ref2);
}
示例7: showCreateBendpointFeedback
import org.eclipse.gef.requests.BendpointRequest; //导入依赖的package包/类
/**
* Shows feedback when a bendpoint is being created. The original figure is used for
* feedback and the original constraint is saved, so that it can be restored when feedback
* is erased.
* @param request the BendpointRequest
*/
protected void showCreateBendpointFeedback(BendpointRequest request) {
Point p = new Point(request.getLocation());
List constraint;
getConnection().translateToRelative(p);
Bendpoint bp = new AbsoluteBendpoint(p);
if (originalConstraint == null) {
saveOriginalConstraint();
constraint = (List)getConnection().getRoutingConstraint();
constraint.add(request.getIndex(), bp);
} else {
constraint = (List)getConnection().getRoutingConstraint();
}
constraint.set(request.getIndex(), bp);
getConnection().setRoutingConstraint(constraint);
}
示例8: showMoveBendpointFeedback
import org.eclipse.gef.requests.BendpointRequest; //导入依赖的package包/类
/**
* Shows feedback when a bendpoint is being moved. Also checks to see if the bendpoint
* should be deleted and then calls {@link #showDeleteBendpointFeedback(BendpointRequest)}
* if needed. The original figure is used for feedback and the original constraint is
* saved, so that it can be restored when feedback is erased.
* @param request the BendpointRequest
*/
protected void showMoveBendpointFeedback(BendpointRequest request) {
Point p = new Point(request.getLocation());
if (!isDeleting)
setReferencePoints(request);
if (lineContainsPoint(ref1, ref2, p)) {
if (!isDeleting) {
isDeleting = true;
eraseSourceFeedback(request);
showDeleteBendpointFeedback(request);
}
return;
}
if (isDeleting) {
isDeleting = false;
eraseSourceFeedback(request);
}
if (originalConstraint == null)
saveOriginalConstraint();
List constraint = (List)getConnection().getRoutingConstraint();
getConnection().translateToRelative(p);
Bendpoint bp = new AbsoluteBendpoint(p);
constraint.set(request.getIndex(), bp);
getConnection().setRoutingConstraint(constraint);
}
示例9: showCreateBendpointFeedback
import org.eclipse.gef.requests.BendpointRequest; //导入依赖的package包/类
/**
* @see org.eclipse.gef.editpolicies.BendpointEditPolicy#showCreateBendpointFeedback(org.eclipse.gef.requests.BendpointRequest)
*/
@Override
protected void showCreateBendpointFeedback(BendpointRequest request) {
IFigure feedback = getDragSourceFeedbackFigure();
Rectangle bounds = new Rectangle(getInitialFeedbackBounds().getCopy());
PrecisionRectangle rect = new PrecisionRectangle(bounds);
getHostFigure().translateToAbsolute(rect);
Point movePoint = request.getLocation();
movePoint.x = ((GraphicalEditPart) getHost()).getFigure().getBounds().x;//movePoint.x - rect.getSize().width / 2;
rect.setLocation(movePoint);
feedback.translateToRelative(rect);
feedback.setBounds(rect);
}
示例10: getCreateBendpointCommand
import org.eclipse.gef.requests.BendpointRequest; //导入依赖的package包/类
@Override
protected Command getCreateBendpointCommand(BendpointRequest bendpointrequest) {
final AbstractConnectionEditPart connectionEditPart = (AbstractConnectionEditPart) getHost();
final WalkerConnection connection = (WalkerConnection) connectionEditPart.getModel();
if (connection.getSourceWalker() == connection.getTargetWalker()) {
return null;
}
final Point point = bendpointrequest.getLocation();
getConnection().translateToRelative(point);
final CreateBendpointCommand createBendpointCommand =
new CreateBendpointCommand(connection, point.x, point.y, bendpointrequest.getIndex());
return createBendpointCommand;
}
示例11: getCreateBendpointCommand
import org.eclipse.gef.requests.BendpointRequest; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
protected Command getCreateBendpointCommand(
BendpointRequest bendpointrequest) {
AbstractConnectionEditPart connectionEditPart = (AbstractConnectionEditPart) this
.getHost();
ConnectionElement connection = (ConnectionElement) connectionEditPart
.getModel();
if (connection.getSource() == connection.getTarget()) {
return null;
}
Point point = bendpointrequest.getLocation();
this.getConnection().translateToRelative(point);
CreateBendpointCommand createBendpointCommand = new CreateBendpointCommand(
connection, point.x, point.y, bendpointrequest.getIndex());
return createBendpointCommand;
}
示例12: setReferencePoints
import org.eclipse.gef.requests.BendpointRequest; //导入依赖的package包/类
private void setReferencePoints(BendpointRequest request) {
PointList points = getConnection().getPoints();
int bpIndex = -1;
List bendPoints = (List) getConnection().getRoutingConstraint();
Point bp = ((Bendpoint) bendPoints.get(request.getIndex()))
.getLocation();
int smallestDistance = -1;
for (int i = 0; i < points.size(); i++) {
if (smallestDistance == -1
|| points.getPoint(i).getDistance2(bp) < smallestDistance) {
bpIndex = i;
smallestDistance = points.getPoint(i).getDistance2(bp);
if (smallestDistance == 0)
break;
}
}
points.getPoint(ref1, bpIndex - 1);
getConnection().translateToAbsolute(ref1);
points.getPoint(ref2, bpIndex + 1);
getConnection().translateToAbsolute(ref2);
}
示例13: showCreateBendpointFeedback
import org.eclipse.gef.requests.BendpointRequest; //导入依赖的package包/类
/**
* Shows feedback when a bendpoint is being created. The original figure is
* used for feedback and the original constraint is saved, so that it can be
* restored when feedback is erased.
*
* @param request
* the BendpointRequest
*/
protected void showCreateBendpointFeedback(BendpointRequest request) {
Point p = new Point(request.getLocation());
List constraint;
getConnection().translateToRelative(p);
Bendpoint bp = new AbsoluteBendpoint(p);
if (originalConstraint == null) {
saveOriginalConstraint();
constraint = (List) getConnection().getRoutingConstraint();
constraint.add(request.getIndex(), bp);
} else {
constraint = (List) getConnection().getRoutingConstraint();
}
constraint.set(request.getIndex(), bp);
getConnection().setRoutingConstraint(constraint);
}
示例14: showMoveBendpointFeedback
import org.eclipse.gef.requests.BendpointRequest; //导入依赖的package包/类
/**
* Shows feedback when a bendpoint is being moved. Also checks to see if the
* bendpoint should be deleted and then calls
* {@link #showDeleteBendpointFeedback(BendpointRequest)} if needed. The
* original figure is used for feedback and the original constraint is
* saved, so that it can be restored when feedback is erased.
*
* @param request
* the BendpointRequest
*/
protected void showMoveBendpointFeedback(BendpointRequest request) {
Point p = new Point(request.getLocation());
if (!isDeleting)
setReferencePoints(request);
if (lineContainsPoint(ref1, ref2, p)) {
if (!isDeleting) {
isDeleting = true;
eraseSourceFeedback(request);
showDeleteBendpointFeedback(request);
}
return;
}
if (isDeleting) {
isDeleting = false;
eraseSourceFeedback(request);
}
if (originalConstraint == null)
saveOriginalConstraint();
List constraint = (List) getConnection().getRoutingConstraint();
getConnection().translateToRelative(p);
Bendpoint bp = new AbsoluteBendpoint(p);
constraint.set(request.getIndex(), bp);
getConnection().setRoutingConstraint(constraint);
}
示例15: getMoveBendpointCommand
import org.eclipse.gef.requests.BendpointRequest; //导入依赖的package包/类
/**
* This method creats and returns a command for changing the position of a {@link Bendpoint}.
*
* @return {@link ORMRelationMoveBendpointCommand}
*/
@Override
protected Command getMoveBendpointCommand(final BendpointRequest request) {
final ORMRelationMoveBendpointCommand command = new ORMRelationMoveBendpointCommand();
Point p = request.getLocation();
Connection conn = getConnection();
conn.translateToRelative(p);
Point sourceP = conn.getSourceAnchor().getReferencePoint();
Point targetP = conn.getTargetAnchor().getReferencePoint();
conn.translateToRelative(sourceP);
conn.translateToRelative(targetP);
command.setRelation((Relation) request.getSource().getModel());
command.setNewDimension(p.getDifference(sourceP), p.getDifference(targetP));
command.setIndex(request.getIndex());
return command;
}