public void relocate(IFigure target) { final Rectangle finalBounds = getFinalMenuBounds(target); target.setBounds(finalBounds); }
public void relocate(IFigure target) { target.setBounds(ColumnHelper.getColumnBounds(editPart, target)); } }
private void animateBoundsChange(final IFigure target, final Rectangle startBounds, final Point endPoint) { final int numSteps = 5; final int numMs = 500; final int timeSteps = numMs/numSteps; int xDelta = endPoint.x - startBounds.x; int yDelta = endPoint.y - startBounds.y; final int widthIncrement = -1 * startBounds.width / numSteps; final int heightIncrement = -1 * startBounds.height / numSteps; int xIncrement = xDelta / numSteps; int yIncrement = yDelta / numSteps; target.setBounds(startBounds); if (widthIncrement != 0 || heightIncrement != 0) { _isAnimating = true; doAnimation(numMs, timeSteps, widthIncrement, heightIncrement, xIncrement, yIncrement, endPoint, target); } }
public void layout(IFigure figure) { Dimension preferredSize = calculatePreferredClientAreaSize(figure); Rectangle r = figure.getClientArea().getCopy(); List children = figure.getChildren(); int nChildren = children.size(); int extraHorizontalSpace = r.width - preferredSize.width; for (Iterator i = children.iterator(); i.hasNext();) { IFigure child = (IFigure) i.next(); Dimension preferredChildSize = child.getPreferredSize(); if (isHorizontal) { int w = preferredChildSize.width + (extraHorizontalSpace / nChildren); child.setBounds(new Rectangle(r.x, r.y, w, Math.max(preferredSize.height, r.height))); r.x += w + spacing; } else { child.setBounds(new Rectangle(r.x, r.y, Math.max(preferredSize.width, r.width), preferredChildSize.height)); r.y += preferredChildSize.height + spacing; } } } }
public void relocate(IFigure target) { Rectangle targetBounds = getCurrentTargetBounds(target); Dimension targetSize = getNewTargetSize(target); relocateBounds(targetBounds, targetSize); target.setBounds(targetBounds); } }
/** * Relocates the target using the relative offset locations. * * @see org.eclipse.draw2d.Locator#relocate(org.eclipse.draw2d.IFigure) */ public void relocate(IFigure target) { Rectangle targetBounds = ColumnHelper.getColumnBounds(editPart, target); Dimension targetSize = target.getPreferredSize(); targetBounds.x += (int) (targetBounds.width * relativeX - ((targetSize.width + 1) / 2)); targetBounds.y += (int) (targetBounds.height * relativeY - ((targetSize.height + 1) / 2)); targetBounds.setSize(targetSize); target.setBounds(targetBounds); } }
public void setSize ( final double width, final double height ) { final Rectangle b = getPropertyFigure ().getBounds (); getPropertyFigure ().setBounds ( new PrecisionRectangle ( b.preciseX (), b.preciseY (), width, height ) ); }
public void setSize ( final double width, final double height ) { final Rectangle b = getPropertyFigure ().getBounds (); getPropertyFigure ().setBounds ( new PrecisionRectangle ( b.preciseX (), b.preciseY (), width, height ) ); }
public void setHeight ( final double height ) { final Rectangle b = getPropertyFigure ().getBounds (); getPropertyFigure ().setBounds ( new PrecisionRectangle ( b.preciseX (), b.preciseY (), b.preciseWidth (), height ) ); }
public void setWidth ( final double width ) { final Rectangle b = getPropertyFigure ().getBounds (); getPropertyFigure ().setBounds ( new PrecisionRectangle ( b.preciseX (), b.preciseY (), width, b.preciseHeight () ) ); }
public void setHeight ( final double height ) { final Rectangle b = getPropertyFigure ().getBounds (); getPropertyFigure ().setBounds ( new PrecisionRectangle ( b.preciseX (), b.preciseY (), b.preciseWidth (), height ) ); }
public void setWidth ( final double width ) { final Rectangle b = getPropertyFigure ().getBounds (); getPropertyFigure ().setBounds ( new PrecisionRectangle ( b.preciseX (), b.preciseY (), width, b.preciseHeight () ) ); }
/** * Refresh the visuals. */ protected void refreshVisuals() { // Obtain model for location to refresh Model model = this.getCastedModel(); // Obtain the size of the figure Dimension figureSize = this.getFigure().getSize(); // Refresh the view off the model this.getFigure().setBounds( new Rectangle(model.getX(), model.getY(), figureSize.width, figureSize.height)); }
/** * Relocates the target figure to the reference point with possible x and y * offsetting. Uses the target's preferredSize as the new size. */ public void relocate(IFigure target) { Point leftTop = new Point(_referencePoint.x+_xOffset, _referencePoint.y+_yOffset); //figure.translateToAbsolute(leftTop); target.translateToRelative(leftTop); Dimension d = target.getPreferredSize(); Rectangle rect = new Rectangle(leftTop, d); // to avoid enlargemeent if (_intersectFigure != null) { rect = rect.intersect(_intersectFigure.getBounds()); } target.setBounds(rect); }
public void run() { if (remainingTime <= 0) { if (target.getParent() != null) { target.getParent().remove(target); } _isAnimating = false; } else { final Rectangle curBounds = target.getBounds().getCopy(); curBounds.width += widthIncrement; curBounds.height += heightIncrement; curBounds.x += xIncrement; curBounds.y += yIncrement; target.setBounds(curBounds); target.revalidate(); doAnimation(remainingTime-timeIncrement, timeIncrement, widthIncrement, heightIncrement, xIncrement, yIncrement, endPoint, target); } } });
public void relocate(IFigure target) { Rectangle bounds; if (getReference() instanceof HandleBounds) { bounds = ((HandleBounds) getReference()).getHandleBounds(); } else { bounds = getReference().getBounds(); } Insets referenceInsets = getReference().getInsets(); Rectangle r = new Rectangle(bounds.x + referenceInsets.left, bounds.y + bounds.height, bounds.width - referenceInsets.getWidth(), TableEditConst.HEIGHT); getReference().translateToAbsolute(r); target.translateToRelative(r); target.setBounds(r); relocateChildren(target, getReference()); }
public void relocate(IFigure target) { Rectangle bounds; if (getReference() instanceof HandleBounds) { bounds = ((HandleBounds) getReference()).getHandleBounds(); } else { bounds = getReference().getBounds(); } // bounds = new PrecisionRectangle(bounds.getResized(-1, -1)); Insets referenceInsets = getReference().getInsets(); Rectangle r = new Rectangle(bounds.x + bounds.width, bounds.y + referenceInsets.top, TableEditConst.WIDTH, bounds.height - referenceInsets.getHeight()); bounds = new PrecisionRectangle(r); getReference().translateToAbsolute(bounds); target.translateToRelative(bounds); target.setBounds(bounds); relocateChildren(target, getReference()); }
/** * 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()); // to avoid enlarge feedback pane. // when draging a editpart inside designer to move/copy it, we do not // want to // enlarge the canvas, since that may resulting in relayout. rect = (PrecisionRectangle) rect.intersect(getFeedbackLayer() .getBounds()); feedback.translateToRelative(rect); feedback.setBounds(rect); }
protected void addConnectorToParent(IFigure p) { Rectangle r = originalLocation.getCopy(); Rectangle pBounds = r.getCopy(); PointList pointList = getConnectionPoints(r); if (pointList != null && pointList.size() > 0) { polyLine.setPoints(pointList); Point firstPoint = pointList.getFirstPoint(); if (firstPoint != null) { pBounds = pBounds.getUnion(new Rectangle(firstPoint.x, firstPoint.y, 1, 1)); } } if (parentEditPart != null) { if (parentEditPart.getFigure() instanceof GenericGroupFigure) { GenericGroupFigure fig = (GenericGroupFigure)parentEditPart.getFigure(); Rectangle iconBounds = getZoomedBounds(fig.getIconFigure().getBounds()); pBounds = pBounds.getUnion(iconBounds); } } p.setBounds(pBounds); p.validate(); }