Package org.eclipse.draw2d.geometry

Examples of org.eclipse.draw2d.geometry.PrecisionRectangle


   */
  @Override
  public void relocate(IFigure target) {

    IFigure reference = getReferenceFigure();
    Rectangle targetBounds = new PrecisionRectangle(getReferenceBox()
        .getResized(-1, -1));
    reference.translateToAbsolute(targetBounds);
    target.translateToRelative(targetBounds);
    targetBounds.resize(1, 1);

    Dimension targetSize = target.getPreferredSize();

    switch (fLocation & PositionConstants.EAST_WEST) {
      case PositionConstants.WEST:
        targetBounds.x -= (targetSize.width) / 2;
        targetBounds.x += fHorizontalInset;
        break;
      case PositionConstants.EAST:
        targetBounds.x += targetBounds.width - (targetSize.width) / 2;
        targetBounds.x -= fHorizontalInset;
        break;
     
      // Only North || South is given
      default :
        targetBounds.x += targetBounds.width/;
        break;
    }
    switch (fLocation & PositionConstants.NORTH_SOUTH) {
      case PositionConstants.NORTH:
        targetBounds.y -= (targetSize.height) / 2;
        targetBounds.y += fVerticalInset;
        break;
      case PositionConstants.SOUTH:
        targetBounds.y += targetBounds.height - (targetSize.height + 2/ 2;
        targetBounds.y -= fVerticalInset;
        break;
       
        // Only West || East is given
      default :
        targetBounds.y += targetBounds.height/2 ;
        break;
       
    }

    targetBounds.setSize(targetSize);
    target.setBounds(targetBounds);
  }
View Full Code Here


    if (reference instanceof HandleBounds)
      bounds = ((HandleBounds) reference).getHandleBounds();
    else
      bounds = reference.getBounds();

    bounds = new PrecisionRectangle(bounds.getCopy());
    reference.translateToAbsolute(bounds);
    target.translateToRelative(bounds);
    bounds.translate(-insets.left, -insets.top);
    bounds.resize(insets.getWidth(), insets.getHeight());
View Full Code Here

TOP

Related Classes of org.eclipse.draw2d.geometry.PrecisionRectangle

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.