本文整理汇总了Java中org.eclipse.gef.requests.AlignmentRequest类的典型用法代码示例。如果您正苦于以下问题:Java AlignmentRequest类的具体用法?Java AlignmentRequest怎么用?Java AlignmentRequest使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AlignmentRequest类属于org.eclipse.gef.requests包,在下文中一共展示了AlignmentRequest类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createAlignmentCommand
import org.eclipse.gef.requests.AlignmentRequest; //导入依赖的package包/类
private Command createAlignmentCommand() {
final AlignmentRequest request = new AlignmentRequest(RequestConstants.REQ_ALIGN);
request.setAlignmentRectangle(calculateAlignmentRectangle(request));
request.setAlignment(alignment);
final List editparts = getOperationSet(request);
if (editparts.size() < 2)
return null;
final CompoundCommand command = new CompoundCommand();
command.setDebugLabel(getText());
for (int i = 0; i < editparts.size(); i++) {
final EditPart editpart = (EditPart) editparts.get(i);
command.add(editpart.getCommand(request));
}
return command;
}
示例2: createAlignmentCommand
import org.eclipse.gef.requests.AlignmentRequest; //导入依赖的package包/类
private Command createAlignmentCommand() {
AlignmentRequest request = new AlignmentRequest(
RequestConstants.REQ_ALIGN);
request.setAlignmentRectangle(calculateAlignmentRectangle(request));
request.setAlignment(alignment);
List editparts = getOperationSet(request);
if (editparts.size() < 2)
return null;
CompoundCommand command = new CompoundCommand();
command.setDebugLabel(getText());
for (int i = 0; i < editparts.size(); i++) {
EditPart editpart = (EditPart) editparts.get(i);
command.add(editpart.getCommand(request));
}
return command;
}
示例3: getConstraintFor
import org.eclipse.gef.requests.AlignmentRequest; //导入依赖的package包/类
@Override
protected Object getConstraintFor(ChangeBoundsRequest request,
GraphicalEditPart child) {
if (request instanceof AlignmentRequest) {
return super.getConstraintFor(request, child);
}
final Rectangle rect = (Rectangle) super.getConstraintFor(request,
child);
final Rectangle cons = getCurrentConstraintFor(child);
final int newTreePosition = TreeLayoutUtil.getNewTreeNodePosition(
request.getLocation(),
TreeLayoutUtil.getSiblings((IGraphicalEditPart) child));
if (cons instanceof TreeLayoutConstraint) {
final TreeLayoutConstraint treeLayoutConstraint = (TreeLayoutConstraint) cons;
return new TreeLayoutConstraint(rect,
treeLayoutConstraint.isRoot(), newTreePosition);
}
return new TreeLayoutConstraint(rect, false, newTreePosition);
}
示例4: createAlignmentCommand
import org.eclipse.gef.requests.AlignmentRequest; //导入依赖的package包/类
private Command createAlignmentCommand() {
final AlignmentRequest request = new AlignmentRequest(RequestConstants.REQ_ALIGN);
request.setAlignmentRectangle(calculateAlignmentRectangle(request));
request.setAlignment(alignment);
final List<?> editparts = getOperationSet(request);
if (editparts.size() < 2)
return null;
final CompoundCommand command = new CompoundCommand();
command.setDebugLabel(getText());
for (int i = 0; i < editparts.size(); i++) {
final EditPart editpart = (EditPart) editparts.get(i);
command.add(editpart.getCommand(request));
}
return command;
}
示例5: getCommand
import org.eclipse.gef.requests.AlignmentRequest; //导入依赖的package包/类
@Override
public Command getCommand(Request request) {
Object type = request.getType();
if (!canMove()) {
return null;
}
if (getHost()==null || getHost().getParent() == null) {
// SPF-9135 NPE: GEF 3.6 superclass will try to access getHost().getParent().getCommand(req)
return null;
}
if (REQ_MOVE.equals(type) && isDragAllowed())
return getMoveCommand((ChangeBoundsRequest)request);
if (REQ_MOVE_INITIATED.equals(type))
return forwardToParent((ChangeBoundsRequest)request, REQ_MOVE_CHILDREN_INITIATED);
if (REQ_MOVE_COMPLETED.equals(type))
return forwardToParent((ChangeBoundsRequest)request, REQ_MOVE_CHILDREN_COMPLETED);
if (REQ_ORPHAN.equals(type))
return getOrphanCommand(request);
if (REQ_ALIGN.equals(type))
return getAlignCommand((AlignmentRequest)request);
return null;
}
示例6: getCommand
import org.eclipse.gef.requests.AlignmentRequest; //导入依赖的package包/类
/**
* Factors out RESIZE and ALIGN requests, otherwise calls <code>super</code>
* .
*
* @see org.eclipse.gef.EditPolicy#getCommand(Request)
*/
public Command getCommand(Request request) {
if (REQ_RESIZE_CHILDREN.equals(request.getType()))
return getResizeChildrenCommand((ChangeBoundsRequest) request);
if (REQ_ALIGN_CHILDREN.equals(request.getType()))
return getAlignChildrenCommand((AlignmentRequest) request);
return super.getCommand(request);
}
示例7: getCommand
import org.eclipse.gef.requests.AlignmentRequest; //导入依赖的package包/类
/**
* @see org.eclipse.gef.EditPolicy#getCommand(org.eclipse.gef.Request)
*/
public Command getCommand(Request request) {
Object type = request.getType();
if (REQ_MOVE.equals(type) && isDragAllowed())
return getMoveCommand((ChangeBoundsRequest) request);
if (REQ_ORPHAN.equals(type))
return getOrphanCommand(request);
if (REQ_ALIGN.equals(type))
return getAlignCommand((AlignmentRequest) request);
return null;
}
示例8: getAlignCommand
import org.eclipse.gef.requests.AlignmentRequest; //导入依赖的package包/类
/**
* Returns the command contribution to an alignment request
*
* @param request
* the alignment request
* @return the contribution to the alignment
*/
protected Command getAlignCommand(AlignmentRequest request) {
AlignmentRequest req = new AlignmentRequest(REQ_ALIGN_CHILDREN);
req.setEditParts(getHost());
req.setAlignment(request.getAlignment());
req.setAlignmentRectangle(request.getAlignmentRectangle());
return getHost().getParent().getCommand(req);
}
示例9: getAlignChildrenCommand
import org.eclipse.gef.requests.AlignmentRequest; //导入依赖的package包/类
/**
* Returns the command to align a group of children. By default, this is
* treated the same as a resize, and
* {@link #getResizeChildrenCommand(ChangeBoundsRequest)} is returned.
*
* @param request
* the AligmentRequest
* @return the command to perform alignment
*/
protected Command getAlignChildrenCommand(AlignmentRequest request) {
return getResizeChildrenCommand(request);
}