Package org.eclipse.draw2d.geometry

Examples of org.eclipse.draw2d.geometry.Rectangle.translate()


    public void relocate(CellEditor celleditor) {
        Text text = (Text) celleditor.getControl();
        Rectangle rect = label.getClientArea().getCopy();
        label.translateToAbsolute(rect);
        org.eclipse.swt.graphics.Rectangle trim = text.computeTrim(0, 0, 0, 0);
        rect.translate(trim.x, trim.y);
        rect.width += trim.width;
        rect.height += trim.height;
        text.setBounds(rect.x, rect.y, rect.width, rect.height);
    }
}
View Full Code Here


  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

      int delta = calculateDelta();
      rect = new Rectangle(adapter.getColumnResizeStart(_index) + delta,
          0, adapter.getColumnResizeWidth(), bounds.height
              - insets.getHeight());
    }
    rect.translate(bounds.x + insets.left, bounds.y + insets.top);

    figure.translateToAbsolute(rect);
    getMarqueeRectangleFigure().translateToRelative(rect);
    return rect;
  }
View Full Code Here

    // add copies to root only
    LayoutElementRecord parent = (LayoutElementRecord) toCopy.getParent();
    parent = LayoutUtils.translateToAndGetRoot(layout, parent);

    // shift layout
    layout.translate(shiftCount * SHIFT_FOR_COPY, shiftCount
        * SHIFT_FOR_COPY);

    // copy
    LayoutElementRecord copy = (LayoutElementRecord) toCopy.getCopy();
    copy.setParent(parent);
View Full Code Here

      childPart.getFigure().translateToAbsolute(r);
      r = request.getTransformedRectangle(r);
      //convert this figure to relative
      getLayoutContainer().translateToRelative(r);
      getLayoutContainer().translateFromParent(r);
      r.translate(getLayoutOrigin().getNegated());

      // Because of the scaling and not using double type in size,
      // nodes size was getting bigger. this bug is fixed.
      r.setSize(childPart.getFigure().getSize().getCopy());
      r.setLocation(r.getLocation().translate(1, 1));
View Full Code Here

    childPart.getFigure().translateToAbsolute(r);
    r = request.getTransformedRectangle(r);
    //convert this figure to relative
    getLayoutContainer().translateToRelative(r);
    getLayoutContainer().translateFromParent(r);
    r.translate(getLayoutOrigin().getNegated());
    constraint = getConstraintFor(r);
    command.add(createAddCommand(generic, childPart,
      translateToModelConstraint(constraint)));
  }
  return command.unwrap();
View Full Code Here

  }

  public void reveal(final IFigure figure) {
    Viewport viewport = canvas.getViewport();
    Rectangle viewportBounds = viewport.getBounds().getCopy();
    viewportBounds.translate(viewport.getViewLocation());
    Rectangle figureBounds = figure.getBounds().getCopy();
    figure.translateToAbsolute(figureBounds);
    figureBounds.translate(viewport.getViewLocation());
    if (!viewportBounds.contains(figureBounds)) {
      int newX = viewportBounds.x;
View Full Code Here

    Viewport viewport = canvas.getViewport();
    Rectangle viewportBounds = viewport.getBounds().getCopy();
    viewportBounds.translate(viewport.getViewLocation());
    Rectangle figureBounds = figure.getBounds().getCopy();
    figure.translateToAbsolute(figureBounds);
    figureBounds.translate(viewport.getViewLocation());
    if (!viewportBounds.contains(figureBounds)) {
      int newX = viewportBounds.x;
      int newY = viewportBounds.y;
      if(viewportBounds.x > figureBounds.x) {
        newX = figureBounds.x;
View Full Code Here

    setLayoutManager(new XYLayout());

    for (PositionedContextButton positionedButton : positionedButtons) {
      Rectangle position = transformGenericRectangle(positionedButton.getPosition(), 0);
      // translate position relative to bounds (after the bounds are set!)
      position.translate(-getBounds().getTopLeft().x, -getBounds().getTopLeft().y);
      ContextButton cb = new ContextButton(positionedButton, this);
      add(cb, position);
    }
  }
View Full Code Here

      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());

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

TOP
Copyright © 2018 www.massapi.com. 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.