本文整理汇总了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;
}
示例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);
}
示例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));
}
示例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));
}
示例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);
}
示例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);
}