Package org.eclipse.draw2d.geometry

Examples of org.eclipse.draw2d.geometry.Rectangle


    public DiamondAnchor(IFigure owner) {
        super(owner);
    }

    public Point getLocation(Point reference) {
        Rectangle r = Rectangle.SINGLETON;
        r.setBounds(getOwner().getBounds());
        getOwner().translateToAbsolute(r);

        Point ref = r.getCenter().negate().translate(reference);

        float centerX = r.x + 0.5f * r.width;
        float centerY = r.y + 0.5f * r.height;
        float dx, dy;

View Full Code Here


            if (children.size() > actionIndex) {
                prevFigure = children.get(children.size() - 1 - actionIndex);
            } else {
                prevFigure = children.get(0);
            }
            Rectangle prevActionBounds = prevFigure.getBounds();
            return new Point(prevActionBounds.x - 5, prevActionBounds.y);
            /*
            // invert visuals
            actionIndex = size - actionIndex;
            int xShift = actionIndex*(ACTION_SIZE+ACTION_DELIM) - addPixels;
View Full Code Here

public class RotateForkJoinDelegate extends BaseActionDelegate {

    public void run(IAction action) {
        Node node = (Node) selectedPart.getModel();
        Rectangle oldConstraint = node.getConstraint();
        Rectangle newConstraint = oldConstraint.getCopy();
        newConstraint.width = oldConstraint.height;
        newConstraint.height = oldConstraint.width;
        node.setConstraint(newConstraint);
    }
View Full Code Here

        GraphicalEditPart target = (GraphicalEditPart) getGraphicalViewer().getEditPartRegistry().get(element);
        if (target == null || !target.getFigure().isVisible()) {
            getOutlineViewer().select(element);
            return;
        }
        Rectangle targetElementConstraint = element.getConstraint();
        GraphElement parentElement = element.getParent();
        while (targetElementConstraint == null && parentElement != null) {
            targetElementConstraint = parentElement.getConstraint();
            parentElement = parentElement.getParent();
        }
View Full Code Here

        LayerManager lm = (LayerManager) getGraphicalViewer().getEditPartRegistry().get(LayerManager.ID);
        IFigure figure = lm.getLayer(LayerConstants.PRINTABLE_LAYERS);

        try {
            Rectangle r = figure.getBounds();
            editor.getDefinition().setDimension(new Dimension(r.width, r.height));
            image = new Image(Display.getDefault(), r.width, r.height);
            gc = new GC(image);
            g = new SWTGraphics(gc);
            g.translate(r.x * -1, r.y * -1);
 
View Full Code Here

    // @Test
    // public void testConflictingSetRecords() {

    Point locOrig = polyLine.getLocation();
    Point loc1 = new Point(10, 10);
    Rectangle rect1 = new Rectangle(loc1, polyLine.getSize());

    ElementRecordChangeLayoutCommand cmd1 = new ElementRecordChangeLayoutCommand();
    cmd1.setModel(polyLine);
    cmd1.setConstraint(rect1);
    cmd1.execute();

    assertTrue(polyLine.getLocation().equals(loc1));

    Point loc2 = new Point(20, 20);
    Rectangle rect2 = new Rectangle(loc2, polyLine.getSize());

    ElementRecordChangeLayoutCommand cmd2 = new ElementRecordChangeLayoutCommand();
    cmd2.setModel(polyLine);
    cmd2.setConstraint(rect2);
    ConflictingSXECommand conflict2 = new ConflictingSXECommand(cmd2);
View Full Code Here

    refreshVisuals();
  }

  @Override
  protected void refreshVisuals() {
    Rectangle bounds = getElementRecord().getLayout();
    ((GraphicalEditPart) getParent()).setLayoutConstraint(this,
        getFigure(), bounds);
  }
View Full Code Here

    Point loc = getLocation();
    Dimension dim = getSize();
    if (loc == null | dim == null)
      return null;
    else
      return new Rectangle(loc, dim);
  }
View Full Code Here

    PointList points = this.points.getCopy();
    if (points.size() == 0)
      points.addAll(getDefaultPoints(layout));

    Rectangle bounds = points.getBounds();
    // calculate difference
    Dimension delta = bounds.getLocation()
        .getDifference(layout.getLocation()).negate();

    // perform translate
    points.translate(delta.width, delta.height);
View Full Code Here

    if (request.getType() == REQ_CREATE
        && getHost() instanceof ElementRecordPart) {

      LayoutElementRecord parent = (LayoutElementRecord) getHost()
          .getModel();
      Rectangle constraint = (Rectangle) getConstraintFor(request);

      // TODO fix point list figure that is wrong positioned on non-root
      /*
       * Note, using drag and drop, the command may also create a
       * polyline. The pencil is always added to the root.
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.