本文整理汇总了Java中org.eclipse.gef.requests.CreateRequest.setSize方法的典型用法代码示例。如果您正苦于以下问题:Java CreateRequest.setSize方法的具体用法?Java CreateRequest.setSize怎么用?Java CreateRequest.setSize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.gef.requests.CreateRequest
的用法示例。
在下文中一共展示了CreateRequest.setSize方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: enforceConstraintsForSizeOnDropCreate
import org.eclipse.gef.requests.CreateRequest; //导入方法依赖的package包/类
/**
* Ensures size constraints (by default minimum and maximum) are respected
* by the given request. May be overwritten by clients to enforce additional
* constraints.
*
* @since 3.7
*/
protected void enforceConstraintsForSizeOnDropCreate(CreateRequest request) {
CreateRequest createRequest = (CreateRequest) getTargetRequest();
if (createRequest.getSize() != null) {
// ensure create request respects minimum and maximum size
// constraints
PrecisionRectangle constraint = new PrecisionRectangle(
createRequest.getLocation(), createRequest.getSize());
((GraphicalEditPart) getTargetEditPart()).getContentPane()
.translateToRelative(constraint);
constraint.setSize(Dimension.max(constraint.getSize(),
getMinimumSizeFor(createRequest)));
constraint.setSize(Dimension.min(constraint.getSize(),
getMaximumSizeFor(createRequest)));
((GraphicalEditPart) getTargetEditPart()).getContentPane()
.translateToAbsolute(constraint);
createRequest.setSize(constraint.getSize());
}
}
示例2: setComponentRequestParams
import org.eclipse.gef.requests.CreateRequest; //导入方法依赖的package包/类
private void setComponentRequestParams(CreateRequest componentRequest) {
componentRequest.setSize(genericComponent.getSize());
Point newCompDefaultLocation = getLocationForNewComponent();
defaultComponentLocation.setLocation(newCompDefaultLocation.x, newCompDefaultLocation.y);
componentRequest.setLocation(defaultComponentLocation);
}
示例3: updateTargetRequest
import org.eclipse.gef.requests.CreateRequest; //导入方法依赖的package包/类
/**
* Sets the location (and size if the user is performing size-on-drop) of
* the request.
*
* @see org.eclipse.gef.tools.TargetingTool#updateTargetRequest()
*/
protected void updateTargetRequest() {
CreateRequest createRequest = getCreateRequest();
if (isInState(STATE_DRAG_IN_PROGRESS)) {
Point loq = getStartLocation();
Rectangle bounds = new Rectangle(loq, loq);
bounds.union(loq.getTranslated(getDragMoveDelta()));
createRequest.setSize(bounds.getSize());
createRequest.setLocation(bounds.getLocation());
createRequest.getExtendedData().clear();
createRequest.setSnapToEnabled(!getCurrentInput().isModKeyDown(
MODIFIER_NO_SNAPPING));
if (helper != null && createRequest.isSnapToEnabled()) {
PrecisionRectangle baseRect = new PrecisionRectangle(bounds);
PrecisionRectangle result = baseRect.getPreciseCopy();
helper.snapRectangle(createRequest, PositionConstants.NSEW,
baseRect, result);
createRequest.setLocation(result.getLocation());
createRequest.setSize(result.getSize());
}
enforceConstraintsForSizeOnDropCreate(createRequest);
} else {
createRequest.setSize(null);
createRequest.setLocation(getLocation());
createRequest.setSnapToEnabled(false);
}
}