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


Java PrecisionRectangle.resize方法代码示例

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


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

示例1: calculateFeedbackBounds

import org.eclipse.draw2d.geometry.PrecisionRectangle; //导入方法依赖的package包/类
@SuppressWarnings({ "unchecked" })
private Rectangle calculateFeedbackBounds(ChangeBoundsRequest request, Rectangle feedbackBounds, int level,
		IFigure containerFigure) {
	Rectangle result = feedbackBounds.getCopy();
	List<IGraphicalEditPart> editParts = request.getEditParts();
	for (IGraphicalEditPart editPart : editParts) {
		PrecisionRectangle transformedRect = new PrecisionRectangle(editPart.getFigure().getBounds());
		editPart.getFigure().translateToAbsolute(transformedRect);
		transformedRect.translate(request.getMoveDelta());
		transformedRect.resize(request.getSizeDelta());
		transformedRect.expand(SPACEING * level, SPACEING * level);
		result.union(transformedRect);
		Dimension preferredSize = containerFigure.getPreferredSize().getCopy();
		editPart.getFigure().translateToAbsolute(preferredSize);
		Dimension max = Dimension.max(result.getSize(), preferredSize);
		result.setSize(max);
		if (result.x < feedbackBounds.x || result.y < feedbackBounds.y) {
			return feedbackBounds;
		}
	}
	return result;
}
 
开发者ID:Yakindu,项目名称:statecharts,代码行数:23,代码来源:EnlargeContainerEditPolicy.java

示例2: showChangeBoundsFeedback

import org.eclipse.draw2d.geometry.PrecisionRectangle; //导入方法依赖的package包/类
@Override
protected void showChangeBoundsFeedback(final ChangeBoundsRequest request) {
	final IFigure feedback = getDragSourceFeedbackFigure();

	final PrecisionRectangle rect = new PrecisionRectangle(
			getInitialFeedbackBounds().getCopy());
	getHostFigure().translateToAbsolute(rect);
	rect.translate(request.getMoveDelta());
	rect.resize(request.getSizeDelta());
	// the unchanged value can be set to zero, because
	// the size will be recalculated later
	checkAndPrepareConstraint(request, rect);

	feedback.translateToRelative(rect);
	feedback.setBounds(rect);
}
 
开发者ID:Yakindu,项目名称:statecharts,代码行数:17,代码来源:BarResizeEditPolicy.java

示例3: showChangeBoundsFeedback

import org.eclipse.draw2d.geometry.PrecisionRectangle; //导入方法依赖的package包/类
protected void showChangeBoundsFeedback(ChangeBoundsRequest request) {
    IFigure feedback = getDragSourceFeedbackFigure();

    PrecisionRectangle rect = new PrecisionRectangle(getInitialFeedbackBounds().getCopy());
    getHostFigure().translateToAbsolute(rect);
    rect.translate(request.getMoveDelta());
    rect.resize(request.getSizeDelta());

    feedback.translateToRelative(rect);
    
    Rectangle oldConstraint = ((GraphicalEditPart)getHost()).getFigure().getBounds();
    feedback.setBounds(new Rectangle(oldConstraint.x, oldConstraint.y, oldConstraint.width, rect.height));
}
 
开发者ID:SK-HOLDINGS-CC,项目名称:NEXCORE-UML-Modeler,代码行数:14,代码来源:BehaviorResizableEditPolicy.java

示例4: showChangeBoundsFeedback

import org.eclipse.draw2d.geometry.PrecisionRectangle; //导入方法依赖的package包/类
/**
 * Shows or updates feedback for a change bounds request.
 * 
 * @param request
 *          the request
 */
protected void showChangeBoundsFeedback(ChangeBoundsRequest request) {

	IFigure feedback = getDragSourceFeedbackFigure();

	PrecisionRectangle rect = new PrecisionRectangle(getInitialFeedbackBounds().getCopy());
	getHostFigure().translateToAbsolute(rect);
	rect.translate(request.getMoveDelta());
	rect.resize(request.getSizeDelta());

	// Calculate changes for the figure...
	String s = "";
	int scaleH = 0;
	int scaleW = 0;
	if (getHost() instanceof FigureEditPart
			&& ((FigureEditPart) getHost()).getModelNode().getValue() instanceof JRDesignElement) {
		JRDesignElement jrElement = (JRDesignElement) ((FigureEditPart) getHost()).getModelNode().getValue();
		Rectangle oldBounds = new Rectangle(jrElement.getX(), jrElement.getY(), jrElement.getWidth(),
				jrElement.getHeight());

		PrecisionRectangle rect2 = new PrecisionRectangle(new Rectangle(request.getMoveDelta().x,
				request.getMoveDelta().y, request.getSizeDelta().width, request.getSizeDelta().height));
		getHostFigure().translateToRelative(rect2);

		oldBounds.translate(rect2.x, rect2.y);
		oldBounds.resize(rect2.width, rect2.height);

		s += oldBounds.x + ", " + oldBounds.y + ", " + oldBounds.width + ", " + oldBounds.height;
		if (oldBounds.width != 0)
			scaleW = rect.width / oldBounds.width - 1;
		if (oldBounds.height != 0)
			scaleH = rect.height / oldBounds.height - 1;
	}

	feedback.translateToRelative(rect);

	((ElementFeedbackFigure) feedback).setText(s);

	feedback.setBounds(rect.resize(-scaleW, -scaleH));
}
 
开发者ID:OpenSoftwareSolutions,项目名称:PDFReporter-Studio,代码行数:46,代码来源:ElementResizableEditPolicy.java

示例5: showChangeBoundsFeedback

import org.eclipse.draw2d.geometry.PrecisionRectangle; //导入方法依赖的package包/类
@Override
protected void showChangeBoundsFeedback(ChangeBoundsRequest request) {
	IFigure feedback = getDragSourceFeedbackFigure();
	PrecisionRectangle rect = new PrecisionRectangle(getInitialFeedbackBounds().getCopy());
	getHostFigure().translateToAbsolute(rect);
	rect.translate(request.getMoveDelta());
	rect.resize(request.getSizeDelta());
	
	rect.height = 4;
	rect.x = 0;
	
	Point location = request.getLocation();
	EditPart ep = getHost().getViewer().findObjectAt(location);
	if (ep == getHost()) {
		ep = getHost().getViewer().findObjectAt(location.translate(0, 3));
	}
	if (ep instanceof GraphicalEditPart) {
		Position position = getPosition((GraphicalEditPart) ep, location);
		Rectangle bounds = ((GraphicalEditPart)ep).getFigure().getBounds();
		switch (position) {
		case ABOVE:
			rect.y = bounds.getTop().y;
			break;
		case BELOW:
			rect.y = bounds.getBottom().y;
			break;
		}
		rect.y -= 2;
	}
	
	feedback.translateToRelative(rect);
	feedback.setBounds(rect);
}
 
开发者ID:nasa,项目名称:OpenSPIFe,代码行数:34,代码来源:TimelineOrderedLayoutEditPolicy.java

示例6: showChangeBoundsFeedback

import org.eclipse.draw2d.geometry.PrecisionRectangle; //导入方法依赖的package包/类
/**
 * Shows or updates feedback for a change bounds request.
 * 
 * @param request
 *            the request
 */
protected void showChangeBoundsFeedback(ChangeBoundsRequest request) {
	IFigure feedback = getDragSourceFeedbackFigure();

	PrecisionRectangle rect = new PrecisionRectangle(
			getInitialFeedbackBounds().getCopy());
	getHostFigure().translateToAbsolute(rect);
	rect.translate(request.getMoveDelta());
	rect.resize(request.getSizeDelta());

	feedback.translateToRelative(rect);
	feedback.setBounds(rect);
}
 
开发者ID:ghillairet,项目名称:gef-gwt,代码行数:19,代码来源:NonResizableEditPolicy.java


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