Package org.tinyuml.umldraw.structure

Examples of org.tinyuml.umldraw.structure.ClassElement


 
  /**
   * Tests that addChild() puts the node into the main compartment.
   */
  public void testAddRemoveChild() {
    ClassElement clss = (ClassElement) ClassElement.getPrototype().clone();
    clss.setModelElement((UmlClass) UmlClass.getPrototype().clone());
    clss.getModelElement().setName("myclass");
    clss.setOrigin(0, 0);
    clss.setSize(100, 100);
    pkgElem.addChild(clss);
    pkgElem.addChild(clss);

    assertTrue(pkgElem.getMainCompartment().getChildren().contains(clss));
    assertEquals(pkgElem.getMainCompartment(), clss.getParent());
    assertEquals(1, pkgElem.getMainCompartment().getChildren().size());
   
    assertEquals(1, pkgElem.getChildren().size());
    assertTrue(pkgElem.getChildren().contains(clss));
    assertEquals(clss, pkgElem.getChildAt(10, 30));
View Full Code Here


 
  /**
   * Tests the creation of an Association.
   */
  public void testCreateAssociation() {
    ClassElement class1 = (ClassElement) factory.createNode(ElementType.CLASS);
    ClassElement class2 = (ClassElement) factory.createNode(ElementType.CLASS);

    Association conn = (Association) factory.createConnection(
      RelationType.ASSOCIATION, class1, class2);
    assertStdConnectionConditions(conn, class1, class2);
    Relation relation = (Relation) conn.getModelElement();
View Full Code Here

 
  /**
   * Tests the creation of a Composition.
   */
  public void testCreateComposition() {
    ClassElement class1 = (ClassElement) factory.createNode(ElementType.CLASS);
    ClassElement class2 = (ClassElement) factory.createNode(ElementType.CLASS);
   
    Association composition = (Association) factory.createConnection(
      RelationType.COMPOSITION, class1, class2);
    assertStdConnectionConditions(composition, class1, class2);
    Relation umlcomp = (Relation) composition.getModelElement();
View Full Code Here

  /**
   * Tests the acceptsConnection() method.
   */
  public void testAcceptsConnection() {
    NoteElement note = NoteElement.getPrototype();
    ClassElement anyumlnode = ClassElement.getPrototype();
    assertTrue(note.acceptsConnection(RelationType.NOTE_CONNECTOR,
      RelationEndType.UNSPECIFIED, anyumlnode));
    assertTrue(note.acceptsConnection(RelationType.NOTE_CONNECTOR,
      RelationEndType.SOURCE, anyumlnode));
    assertTrue(note.acceptsConnection(RelationType.NOTE_CONNECTOR,
View Full Code Here

 
  /**
   * Tests the creation of an Aggregation.
   */
  public void testCreateAggregation() {
    ClassElement class1 = (ClassElement) factory.createNode(ElementType.CLASS);
    ClassElement class2 = (ClassElement) factory.createNode(ElementType.CLASS);
   
    Association composition = (Association) factory.createConnection(
      RelationType.AGGREGATION, class1, class2);
    assertStdConnectionConditions(composition, class1, class2);
    Relation umlcomp = (Relation) composition.getModelElement();
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

 
  /**
   * Tests the clone() method.
   */
  public void testClone() {
    ClassElement cloned = (ClassElement) element.clone();
    assertEquals(1, cloned.getModelElement().getModelElementListeners().size());
    assertTrue(cloned.getModelElement().getModelElementListeners()
      .contains(cloned));
    assertTrue(cloned.getModelElement() != element.getModelElement());
    assertTrue(cloned != element);
    assertTrue(cloned.getMainCompartment() != element.getMainCompartment());
    assertTrue(cloned.getMainCompartment().getParent() == cloned);
    assertTrue(cloned.getAttributesCompartment() !=
               element.getAttributesCompartment());
    assertTrue(cloned.getAttributesCompartment().getParent() == cloned);
    assertTrue(cloned.getOperationsCompartment() !=
               element.getOperationsCompartment());
    assertTrue(cloned.getOperationsCompartment().getParent() == cloned);
   
    // Tests the main label
    assertTrue(cloned.getMainLabel() != element.getMainLabel());
    assertEquals(1, cloned.getMainCompartment().getLabels().size());
    assertEquals(cloned.getMainLabel(),
      cloned.getMainCompartment().getLabels().get(0));
    assertTrue(cloned.getMainCompartment() == cloned.getMainLabel().getParent());
    assertTrue(cloned == cloned.getMainLabel().getSource());
  }
View Full Code Here

  /**
   * {@inheritDoc}
   */
  public void editProperties(DiagramElement element) {
    if (element instanceof ClassElement) {
      ClassElement classElement = (ClassElement) element;
      UmlClass umlclass = (UmlClass) classElement.getModelElement();
      EditClassDialog dialog = new EditClassDialog(frame, classElement, true);
      dialog.setLocationRelativeTo(frame);
      dialog.setVisible(true);
      if (dialog.isOk()) {
        umlclass.setAbstract(dialog.classIsAbstract());
        classElement.setShowOperations(dialog.showOperations());
        classElement.setShowAttributes(dialog.showAttributes());
        classElement.setShowStereotypes(dialog.showStereotypes());
        umlclass.setName(dialog.getName());
        umlclass.setMethods(dialog.getMethods());
        umlclass.setAttributes(dialog.getAttributes());
        umlclass.setStereotypes(dialog.getStereotypes());
        redraw();
View Full Code Here

  /**
   * Tests the acceptsConnection() method.
   */
  public void testAcceptsConnection() {
    NoteElement note = NoteElement.getPrototype();
    ClassElement anyumlnode = ClassElement.getPrototype();
    assertTrue(note.acceptsConnection(RelationType.NOTE_CONNECTOR,
      RelationEndType.UNSPECIFIED, anyumlnode));
    assertTrue(note.acceptsConnection(RelationType.NOTE_CONNECTOR,
      RelationEndType.SOURCE, anyumlnode));
    assertTrue(note.acceptsConnection(RelationType.NOTE_CONNECTOR,
View Full Code Here

  /**
   * {@inheritDoc}
   */
  public void editProperties(DiagramElement element) {
    if (element instanceof ClassElement) {
      ClassElement classElement = (ClassElement) element;
      UmlClass umlclass = (UmlClass) classElement.getModelElement();
      EditClassDialog dialog = new EditClassDialog(frame, classElement, true);
      dialog.setLocationRelativeTo(frame);
      dialog.setVisible(true);
      if (dialog.isOk()) {
        umlclass.setAbstract(dialog.classIsAbstract());
        classElement.setShowOperations(dialog.showOperations());
        classElement.setShowAttributes(dialog.showAttributes());
        classElement.setShowStereotypes(dialog.showStereotypes());
        umlclass.setMethods(dialog.getMethods());
        umlclass.setAttributes(dialog.getAttributes());
        umlclass.setStereotypes(dialog.getStereotypes());
      }
    }
View Full Code Here

TOP

Related Classes of org.tinyuml.umldraw.structure.ClassElement

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.