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


Java CreateRequest.setSize方法代码示例

本文整理汇总了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());
	}
}
 
开发者ID:ghillairet,项目名称:gef-gwt,代码行数:26,代码来源:CreationTool.java

示例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);
}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:9,代码来源:PaletteContainerListener.java

示例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);
	}
}
 
开发者ID:ghillairet,项目名称:gef-gwt,代码行数:33,代码来源:CreationTool.java


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