Package org.tinyuml.umldraw.shared

Examples of org.tinyuml.umldraw.shared.NoteElement


  /**
   * Tests the clone() method.
   */
  public void testClone() {
    Mock mockParent1 = mock(CompositeNode.class);
    NoteElement note = NoteElement.getPrototype();
    assertNull(note.getParent());
    note.setOrigin(0, 0);
    note.setSize(100, 80);
    note.setLabelText("oldlabel");
    note.setParent((CompositeNode) mockParent1.proxy());
   
    NoteElement cloned = (NoteElement) note.clone();
    assertTrue(note != cloned);
    assertEquals(note.getParent(), cloned.getParent());
    assertEquals("oldlabel", cloned.getLabelText());
    note.setLabelText("mylabel");
    assertFalse(cloned.getLabelText() == note.getLabelText());
   
    // now test the label
    mockParent1.expects(atLeastOnce()).method("getAbsoluteX1")
      .will(returnValue(0.0));
    mockParent1.expects(atLeastOnce()).method("getAbsoluteY1")
      .will(returnValue(0.0));
    assertNotNull(cloned.getLabelAt(20, 20));
    assertTrue(cloned.getLabelAt(20.0, 20.0) != note.getLabelAt(20.0, 20.0));
    assertTrue(cloned.getLabelAt(20.0, 20.0).getSource() == cloned);
    assertTrue(cloned.getLabelAt(20.0, 20.0).getParent() == cloned);
  }
View Full Code Here


  /**
   * Initializes the element map with the element prototypes.
   */
  private void setupElementPrototypeMap() {
    NoteElement notePrototype = (NoteElement)
      NoteElement.getPrototype().clone();
    elementPrototypes.put(ElementType.NOTE, notePrototype);

    // Add package prototype
    UmlPackage pkg = (UmlPackage) UmlPackage.getPrototype().clone();
View Full Code Here

    mockComponent.expects(once()).method("setOrigin");
    handler.setElementType(ElementType.COMPONENT);
    handler.mousePressed((EditorMouseEvent) mockEvent.proxy());

    // create note
    NoteElement note = (NoteElement) NoteElement.getPrototype().clone();
    mockFactory.expects(once()).method("createNote").will(returnValue(note));
    handler.setElementType(ElementType.NOTE);
    handler.mousePressed((EditorMouseEvent) mockEvent.proxy());
    assertEquals(new Point2D.Double(30, 25), note.getOrigin());
  }
View Full Code Here

  /**
   * Test creating a NoteElement.
   */
  public void testCreateNote() {
    NoteElement node = factory.createNote();
    assertNull(node.getParent());
    node.setParent(diagram);
    node.setAbsolutePos(1.0, 3.0);
    assertEquals(1, notificationCounter);
  }
View Full Code Here

   */
  public void testCreateNoteConnection() {
    mockElementFactory.expects(atLeastOnce()).method("create").
      with(eq(ElementType.CLASS)).will(returnValue(clss));
    ClassElement clss = factory.createClass();
    NoteElement note = factory.createNote();
    NoteConnection conn = (NoteConnection)
      factory.createConnection(RelationType.NOTE_CONNECTOR, clss, note);
    assertEquals(clss, conn.getNode1());
    assertEquals(note, conn.getNode2());
    assertEquals(1, clss.getConnections().size());
    assertEquals(1, note.getConnections().size());
    assertNull(conn.getParent());
  }
View Full Code Here

  /**
   * Tests the creation of a note connection.
   */
  public void testCreateNoteConnection() {
    ClassElement clss = (ClassElement) factory.createNode(ElementType.CLASS);
    NoteElement note = (NoteElement) factory.createNode(ElementType.NOTE);
    NoteConnection conn = (NoteConnection)
      factory.createConnection(RelationType.NOTE_CONNECTOR, clss, note);
    assertStdConnectionConditions(conn, clss, note);
    assertNull(conn.getModelElement());
  }
View Full Code Here

  /**
   * Initializes the element map with the element prototypes.
   */
  private void setupElementPrototypeMap() {
    NoteElement notePrototype = (NoteElement)
      NoteElement.getPrototype().clone();
    elementPrototypes.put(ElementType.NOTE, notePrototype);

    // Add package prototype
    UmlPackage pkg = (UmlPackage) UmlPackage.getPrototype().clone();
View Full Code Here

   */
  protected Map<ElementType, UmlDiagramElement> setupElementPrototypeMap() {
    Map<ElementType, UmlDiagramElement> elementPrototypes =
      new HashMap<ElementType, UmlDiagramElement>();

    NoteElement notePrototype = (NoteElement)
      NoteElement.getPrototype().clone();
    elementPrototypes.put(ElementType.NOTE, notePrototype);
    LifeLineElement lifeLinePrototype = (LifeLineElement)
      LifeLineElement.getPrototype().clone();
    UmlLifeLine umlLifeLine = (UmlLifeLine) UmlLifeLine.getPrototype().clone();
View Full Code Here

   */
  protected Map<ElementType, UmlDiagramElement> setupElementPrototypeMap() {
    Map<ElementType, UmlDiagramElement> elementPrototypes =
      new HashMap<ElementType, UmlDiagramElement>();

    NoteElement notePrototype = (NoteElement)
      NoteElement.getPrototype().clone();
    elementPrototypes.put(ElementType.NOTE, notePrototype);

    // Add package prototype
    UmlPackage pkg = (UmlPackage) UmlPackage.getPrototype().clone();
View Full Code Here

TOP

Related Classes of org.tinyuml.umldraw.shared.NoteElement

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.