Package java.awt.geom

Examples of java.awt.geom.Dimension2D


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


  /**
   * 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

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

 
  /**
   * Tests the centerHorizontally() method.
   */
  public void testCenterHorizontally() {
    Dimension2D size = new DoubleDimension(100, 30);
    label.setSize(40, 10);
    label.setOrigin(0, 12);
    mockParent.expects(once()).method("getSize").will(returnValue(size));
    label.centerHorizontally();
    assertEquals(12.0, label.getOrigin().getY());
View Full Code Here

  /**
   * {@inheritDoc}
   */
  @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

  /**
   * 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

  /**
   * {@inheritDoc}
   */
  @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

  /**
   * {@inheritDoc}
   */
  @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

   * Returns the total canvas size for export functions. The total size
   * includes the margins
   * @return the total canvas size
   */
  public Dimension getTotalCanvasSize() {
    Dimension2D diagramSize = diagram.getSize();
    Dimension result = new Dimension();
    result.width = (int) (diagramSize.getWidth() + MARGIN_LEFT + MARGIN_RIGHT);
    result.height = (int) (diagramSize.getHeight() + MARGIN_TOP +
      MARGIN_BOTTOM);
    return result;
  }
View Full Code Here

 
  /**
   * Tests the centerHorizontally() method.
   */
  public void testCenterHorizontally() {
    Dimension2D size = new DoubleDimension(100, 30);
    label.setSize(40, 10);
    label.setOrigin(0, 12);
    mockParent.expects(once()).method("getSize").will(returnValue(size));
    label.centerHorizontally();
    assertEquals(12.0, label.getOrigin().getY());
View Full Code Here

TOP

Related Classes of java.awt.geom.Dimension2D

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.