Package org.eclipse.draw2d.geometry

Examples of org.eclipse.draw2d.geometry.Rectangle


  private static RectangleFigure getRectangleIconFigure() {
    RectangleFigure rect = new RectangleFigure();
    rect.setBackgroundColor(red);
    rect.setForegroundColor(blue);
    rect.setBounds(new Rectangle(inset, inset, LOW_WIDTH - 2 * inset,
        LOW_HEIGHT - 2 * inset));
    return rect;
  }
View Full Code Here


  private static Ellipse getEllipseIconFigure() {
    Ellipse ellipse = new Ellipse();
    ellipse.setBackgroundColor(red);
    ellipse.setForegroundColor(blue);
    ellipse.setBounds(new Rectangle(inset, inset, LOW_WIDTH - 2 * inset,
        LOW_HEIGHT - 2 * inset));
    return ellipse;
  }
View Full Code Here

      Figure childFigure = new BorderFigure();
      childFigure.setBorder(new LineBorder(1));
      this.add(childFigure);

      FlowBox box = (FlowBox) fragments.get(i);
      Rectangle rect = new Rectangle(box.getX(), box.getY(), box.getWidth(), box
          .getHeight());
      cssfigure.translateToAbsolute(rect);

      childFigure.translateToRelative(rect);
      childFigure.setBounds(rect);
View Full Code Here

    FragmentCornerHandle target = new FragmentCornerHandle(getOwner());
    this.add(target);

    // for corner small box.
    Rectangle targetBounds = new Rectangle(referencebox.getX(),
        referencebox.getY(), referencebox.getWidth(), referencebox
            .getHeight());
    targetBounds = new PrecisionRectangle(targetBounds);
    reference.translateToAbsolute(targetBounds);
    target.translateToRelative(targetBounds);
    // targetBounds.resize(1, 1);

    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);
  }
View Full Code Here

     *
     * The rectangle is translated to absolute bounds
     */
    public static Rectangle getAdjustedColumnBoundingRectangle(GraphicalEditPart editPart)
    {
        Rectangle bounds = editPart.getFigure().getBounds().getCopy();

        if (editPart.getParent() != null) {
            IFigure figure = ((GraphicalEditPart) editPart.getParent())
                    .getFigure();
            if (figure instanceof CSSFigure) {
                CSSFigure cssFigure = (CSSFigure) figure;
                LayoutManager layoutManager = cssFigure.getLayoutManager();
                if (layoutManager instanceof CSSTableLayout2) {
                    CSSTableLayout2 tableLayout = (CSSTableLayout2) layoutManager;
                    bounds.y = tableLayout.getHSpacing();
                    bounds.height = figure.getClientArea().height
                            - tableLayout.getHSpacing() * 2;
                }
            }
        }
        bounds = new PrecisionRectangle(bounds.getResized(-1, -1));
        editPart.getFigure().translateToAbsolute(bounds);
       
        return bounds;
    }
View Full Code Here

        return bounds;
    }
   
  static Rectangle getColumnBounds(GraphicalEditPart editPart,
      IFigure target) {
      Rectangle bounds = getAdjustedColumnBoundingRectangle(editPart);
        target.translateToRelative(bounds);
        Insets insets = target.getInsets();
    bounds.translate(-insets.left, -insets.top);
    bounds.resize(insets.getWidth() + 1, insets.getHeight() + 1);
    return bounds;
  }
View Full Code Here

     * @return a modifiable Rectangle that represents the bounds of the figure to be relocated
     */
    protected Rectangle getCurrentTargetBounds(IFigure relocateFigure)
    {
        IFigure reference = getReferenceFigure();
        Rectangle targetBounds = new PrecisionRectangle(getReferenceBox().getResized(-1, -1));
        reference.translateToAbsolute(targetBounds);
        relocateFigure.translateToRelative(targetBounds);
        return targetBounds;
    }
View Full Code Here

    {
        return relocateFigure.getPreferredSize();
    }
   
    public void relocate(IFigure target) {
        Rectangle targetBounds = getCurrentTargetBounds(target);
        Dimension targetSize = getNewTargetSize(target);
        relocateBounds(targetBounds, targetSize);

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

        else
        {
            arrowImage = PDPlugin.getDefault().getImage(PIN_UP_IMAGE_FILE);
        }
       
        Rectangle r = getBounds();
        g.setAlpha(75);
        g.setBackgroundColor(getFillColor());
        g.fillRectangle(r.x, r.y, r.width, r.height);
        g.setAlpha(getAlpha());
        g.drawImage(arrowImage, r.x+1, r.y+1);
View Full Code Here

                super.paintFigure(graphics);
               
                if (getImage() == null)
                    return;

                Rectangle srcRect = new Rectangle(getImage().getBounds());
                graphics.drawImage(getImage(), srcRect, getClientArea());
            }
           
        };
       
View Full Code Here

TOP

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

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.