Package org.tinyuml.umldraw.structure

Examples of org.tinyuml.umldraw.structure.ClassElement


  /**
   * {@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());
        redraw();
      }
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 creation of an Association.
   */
  public void testCreateAssociation() {
    mockElementFactory.expects(atLeastOnce()).method("create").
      with(eq(ElementType.CLASS)).will(returnValue(clss));
    ClassElement class1 = factory.createClass();
    ClassElement class2 = factory.createClass();

    Association conn = (Association) factory.createConnection(
      RelationType.ASSOCIATION, class1, class2);
    assertEquals(class1, conn.getNode1());
    assertEquals(class2, conn.getNode2());
    assertEquals(1, class1.getConnections().size());
    assertEquals(1, class2.getConnections().size());
    assertNull(conn.getParent());   
  }
View Full Code Here

   * Tests the creation of a note connection.
   */
  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

    mockAttrCompartment.expects(once()).method("setAlignment")
      .with(eq(Alignment.LEFT));
    mockOpCompartment.expects(once()).method("setAlignment")
      .with(eq(Alignment.LEFT));
   
    mockedElement = new ClassElement(umlclass,
      (Compartment) mockMainCompartment.proxy(),
      (Compartment) mockAttrCompartment.proxy(),
      (Compartment) mockOpCompartment.proxy());
  }
View Full Code Here

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

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.