Package org.tinyuml.draw

Examples of org.tinyuml.draw.SimpleConnectionSelection


   * around, then cancel the drag.
   */
  public void testDragSegmentAndCancel() {
    node1.setOrigin(10, 10); // (10, 10, 80, 40) -> max (90, 50)
    node2.setOrigin(120, 10); // (120, 10, 80, 40) -> max (200, 50)
    SimpleConnectionSelection selection = setupConnection();
    selection.startDragging(105, 30);
    Point2D oldp1 = conn.getEndPoint1();
    Point2D oldp2 = conn.getEndPoint2();
    assertEquals(3, selection.getEditPoints().size());
    assertTrue(selection.isDragging());
    selection.updatePosition(120, 50);
    selection.updatePosition(130, 70);
    selection.cancelDragging();
    assertFalse(selection.isDragging());
    assertEquals(2, conn.getPoints().size());
    assertEquals(oldp1, conn.getPoints().get(0));
    assertEquals(oldp2, conn.getPoints().get(1));
  }
View Full Code Here


   * around, then stop the drag.
   */
  public void testDragSegmentAndStop() {
    node1.setOrigin(10, 10); // (10, 10, 80, 40) -> max (90, 50)
    node2.setOrigin(120, 10); // (120, 10, 80, 40) -> max (200, 50)
    SimpleConnectionSelection selection = setupConnection();
    selection.startDragging(105, 30);
    assertEquals(3, selection.getEditPoints().size());
    assertTrue(selection.isDragging());
    selection.updatePosition(120, 50);
    selection.updatePosition(130, 70);
    selection.stopDragging(140, 90);
    assertFalse(selection.isDragging());
    assertEquals(3, conn.getPoints().size());
    // the position at stopDragging() has no effect !
    Point2D pNew = new Point2D.Double(130, 70);
    assertEquals(pNew, conn.getPoints().get(1));
  }
View Full Code Here

   * around, then stop the drag at a meltin position.
   */
  public void testDragSegmentAndStopAtMeltinPosition() {
    node1.setOrigin(10, 10); // (10, 10, 80, 40) -> max (90, 50)
    node2.setOrigin(120, 10); // (120, 10, 80, 40) -> max (200, 50)
    SimpleConnectionSelection selection = setupConnection();
    Point2D oldp1 = conn.getEndPoint1();
    Point2D oldp2 = conn.getEndPoint2();
    selection.startDragging(105, 30);
    assertEquals(3, selection.getEditPoints().size());
    assertTrue(selection.isDragging());
    selection.updatePosition(120, 50);
    selection.updatePosition(110, 40);
    selection.updatePosition(106, 31); // melting position
    selection.stopDragging(106, 31);
    assertFalse(selection.isDragging());
    assertEquals(2, conn.getPoints().size());
    assertEquals(oldp1, conn.getPoints().get(0));
    assertEquals(oldp2, conn.getPoints().get(1));
  }
View Full Code Here

   * Dragging a point and moving it around.
   */
  public void testDragPointAndStop() {
    node1.setOrigin(10, 10); // (10, 10, 80, 40) -> max (90, 50)
    node2.setOrigin(120, 10); // (120, 10, 80, 40) -> max (200, 50)
    SimpleConnectionSelection selection = setupConnection();
    // insert a new control point to make a total of three
    conn.getPoints().add(1, new Point2D.Double(105, 90));
    selection.startDragging(105, 90);
    assertTrue(selection.isDragging());
    selection.updatePosition(120, 50);
    selection.updatePosition(130, 70);
    selection.updatePosition(140, 90);
    selection.stopDragging(140, 90);
    assertFalse(selection.isDragging());
    assertEquals(3, conn.getPoints().size());
    Point2D pNew = new Point2D.Double(140, 90);
    assertEquals(pNew, conn.getPoints().get(1));
  }
View Full Code Here

   * Dragging a point and moving it around and stopping at a meltin position.
   */
  public void testDragPointAndStopWithMeldin() {
    node1.setOrigin(10, 10); // (10, 10, 80, 40) -> max (90, 50)
    node2.setOrigin(120, 10); // (120, 10, 80, 40) -> max (200, 50)
    SimpleConnectionSelection selection = setupConnection();
    // insert a new control point to make a total of three
    conn.getPoints().add(1, new Point2D.Double(105, 90));
    selection.startDragging(105, 90);
    assertTrue(selection.isDragging());
    selection.updatePosition(120, 50);
    selection.updatePosition(110, 40);
    selection.updatePosition(105, 31);
    selection.stopDragging(105, 31);
    assertFalse(selection.isDragging());
    assertEquals(2, conn.getPoints().size());
  }
View Full Code Here

TOP

Related Classes of org.tinyuml.draw.SimpleConnectionSelection

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.