Examples of DoubleDimension


Examples of org.tinyuml.draw.DoubleDimension

  /**
   * Simulates a dragging operation for resizing.
   */
  public void testDragResizeSe() {
    Dimension2D minimumSize = new DoubleDimension(10, 10);
    // start dragging somewhere in the SE handle (322+, 425+)
    selection.startDragging(324.0, 427.0);
    assertTrue(selection.isDragging());
    // make it a little bigger
    setFullResizeExpectations(minimumSize);
   
    selection.updatePosition(330.0, 450.0);
    // and draw it
    // don't forget that sizes are truncated to the local system'
    Constraint[] params = {eq(2.0), eq(5.0), eq(326.0), eq(443.0), NULL};
    mockDrawingContext.expects(once()).method("drawRectangle").
      with(params);
    selection.draw((DrawingContext) mockDrawingContext.proxy());
    // stop dragging
    mockOperations.expects(once()).method("resizeElement").
      with(eq(selection.getElement()), eq(new Point2D.Double(2.0, 5.0)),
           eq(new DoubleDimension(326.0, 443.0)));
    selection.stopDragging(330.0, 450.0);
    assertFalse(selection.isDragging());
  }
View Full Code Here

Examples of org.tinyuml.draw.DoubleDimension

  /**
   * Simulates a dragging operation for resizing with truncation.
   */
  public void testDragResizeSeWithTruncation() {
    // At SE resize, the position is < 22 and 25
    Dimension2D minimumSize = new DoubleDimension(20, 20);
    // start dragging somewhere in the SE handle (322+, 425+)
    selection.startDragging(324.0, 427.0);
    assertTrue(selection.isDragging());
    // make it a little smaller
    setResizeExpectations(minimumSize);
View Full Code Here

Examples of org.tinyuml.draw.DoubleDimension

  /**
   * Simulates a dragging operation for resizing on the NW corner.
   */
  public void testDragResizeNw() {
    Point2D origin = new Point2D.Double(0, 0);
    Dimension2D minimumSize = new DoubleDimension(20, 20);
    // start dragging somewhere in the NW handle (2-, 5-)
    selection.startDragging(1, 3);
    assertTrue(selection.isDragging());
    // make it a little bigger
    setFullResizeExpectations(minimumSize);
   
    selection.updatePosition(-10.0, -10.0);
    // and draw it
    // don't forget that sizes are truncated to the local system'
    Constraint[] params = {eq(-9.0), eq(-8.0), eq(331.0), eq(433.0), NULL};
    mockDrawingContext.expects(once()).method("drawRectangle").
      with(params);
    selection.draw((DrawingContext) mockDrawingContext.proxy());
    // stop dragging
    mockOperations.expects(once()).method("resizeElement").
      with(eq(selection.getElement()), eq(new Point2D.Double(-9.0, -8.0)),
           eq(new DoubleDimension(331.0, 433.0)));
    selection.stopDragging(-10.0, -10.0);
    assertFalse(selection.isDragging());
  }
View Full Code Here

Examples of org.tinyuml.draw.DoubleDimension

  /**
   * Simulates a dragging operation for resizing with truncation, NW corner.
   */
  public void testDragResizeNwWithTruncation() {
    // At NW resize, the position is > (322 - 20) and (425 - 20)
    Dimension2D minimumSize = new DoubleDimension(20, 20);
    // start dragging somewhere in the NW handle (2-, 5-)
    selection.startDragging(1.0, 3.0);
    assertTrue(selection.isDragging());
    // make it a little smaller, dragging it to the lower right
    setResizeExpectations(minimumSize);
View Full Code Here

Examples of org.tinyuml.draw.DoubleDimension

  /**
   * Simulates a dragging operation for resizing on the NE corner.
   */
  public void testDragResizeNe() {
    Point2D origin = new Point2D.Double(0, 0);
    Dimension2D minimumSize = new DoubleDimension(20, 20);
    // start dragging somewhere in the NW handle (322+, 5-)
    selection.startDragging(324, 3);
    assertTrue(selection.isDragging());
    // make it a little bigger
    setFullResizeExpectations(minimumSize);
    mockNode.expects(once()).method("getParent")
      .will(returnValue(mockParent.proxy()));
   
    selection.updatePosition(340.0, -10.0);
    // and draw it
    // don't forget that sizes are truncated to the local system'
    Constraint[] params = {eq(2.0), eq(-8.0), eq(336.0), eq(433.0), NULL};
    mockDrawingContext.expects(once()).method("drawRectangle").
      with(params);
    selection.draw((DrawingContext) mockDrawingContext.proxy());
    // stop dragging
    mockOperations.expects(once()).method("resizeElement").
      with(eq(selection.getElement()), eq(new Point2D.Double(2.0, -8.0)),
           eq(new DoubleDimension(336.0, 433.0)));
    selection.stopDragging(340.0, -10.0);
    assertFalse(selection.isDragging());
  }
View Full Code Here

Examples of org.tinyuml.draw.DoubleDimension

  /**
   * Simulates a dragging operation for resizing with truncation, NW corner.
   */
  public void testDragResizeNeWithTruncation() {
    // At NE resize, the position is < 22 and > (425 - 20)
    Dimension2D minimumSize = new DoubleDimension(20, 20);
    // start dragging somewhere in the NW handle (2-, 5-)
    selection.startDragging(324, 3);
    assertTrue(selection.isDragging());
    // make it a little smaller, dragging it to the lower left
    setResizeExpectations(minimumSize);
View Full Code Here

Examples of org.tinyuml.draw.DoubleDimension

  /**
   * Simulates a dragging operation for resizing on the SW corner.
   */
  public void testDragResizeSw() {
    Point2D origin = new Point2D.Double(0, 0);
    Dimension2D minimumSize = new DoubleDimension(20, 20);
    // start dragging somewhere in the SW handle (2-, 425+)
    selection.startDragging(1, 427);
    assertTrue(selection.isDragging());
    // make it a little bigger
    setFullResizeExpectations(minimumSize);

    selection.updatePosition(-10.0, 440.0);
    // and draw it
    // don't forget that sizes are truncated to the local system'
    Constraint[] params = {eq(-9.0), eq(5.0), eq(331.0), eq(433.0), NULL};
    mockDrawingContext.expects(once()).method("drawRectangle").
      with(params);
    selection.draw((DrawingContext) mockDrawingContext.proxy());
    // stop dragging
    mockOperations.expects(once()).method("resizeElement").
      with(eq(selection.getElement()), eq(new Point2D.Double(-9.0, 5.0)),
           eq(new DoubleDimension(331.0, 433.0)));
    selection.stopDragging(-10.0, 440.0);
    assertFalse(selection.isDragging());
  }
View Full Code Here

Examples of org.tinyuml.draw.DoubleDimension

  /**
   * Simulates a dragging operation for resizing with truncation, SW corner.
   */
  public void testDragResizeSwWithTruncation() {
    // At SW resize, the position is x > (322 - 20) and y < 22
    Dimension2D minimumSize = new DoubleDimension(20, 20);
    // start dragging somewhere in the SW handle (2-, 425+)
    selection.startDragging(1, 427);
    assertTrue(selection.isDragging());
    // make it a little smaller, dragging it to the lower left
    setResizeExpectations(minimumSize);
View Full Code Here

Examples of org.tinyuml.draw.DoubleDimension

   */
  @Override
  public Dimension2D getMinimumSize() {
    Dimension2D minTabSize = tabCompartment.getMinimumSize();
    Dimension2D minMainSize = mainCompartment.getMinimumSize();
    return new DoubleDimension(
      Math.max(minTabSize.getWidth(), minMainSize.getWidth()),
      minTabSize.getHeight() + minMainSize.getHeight());
  }
View Full Code Here

Examples of org.tinyuml.draw.DoubleDimension

   */
  @Override
  public Dimension2D getSize() {
    Dimension2D tabSize = tabCompartment.getSize();
    Dimension2D mainSize = mainCompartment.getSize();
    return new DoubleDimension(
      Math.max(tabSize.getWidth(), mainSize.getWidth()),
      tabSize.getHeight() + mainSize.getHeight());
  }
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.