Package org.tinyuml.model

Examples of org.tinyuml.model.UmlRelation


   * Tests the NoteConnection class.
   */
  public void testNoteConnection() {
    // relation has no effect
    NoteConnection connection = NoteConnection.getPrototype();
    connection.setRelation(new UmlRelation());
    assertNull(connection.getModelElement());
  }
View Full Code Here


   * Tests the clone() method.
   */
  public void testClone() {
    MyBaseConnection conn = new MyBaseConnection();
    SimpleConnection simpleconn = new SimpleConnection();
    Relation relation = new UmlRelation();
    conn.setConnection(simpleconn);
    conn.setRelation(relation);
    MyBaseConnection cloned = (MyBaseConnection) conn.clone();
    assertTrue(cloned.getConnection() != conn.getConnection());
    assertTrue(cloned.getModelElement() != conn.getModelElement());
View Full Code Here

    relation.setCanSetElement1Navigability(false);
    relation.setCanSetElement2Navigability(true);
    relation.setNavigableToElement1(true);
    relation.setNavigableToElement2(false);
   
    UmlRelation cloned = (UmlRelation) relation.clone();
    assertEquals(relation.getName(), cloned.getName());
    assertEquals(relation.getElement1(), cloned.getElement1());
    assertEquals(relation.getElement2(), cloned.getElement2());
    assertEquals(relation.canSetElement1Navigability(),
      cloned.canSetElement1Navigability());
    assertEquals(relation.canSetElement2Navigability(),
      cloned.canSetElement2Navigability());
    assertEquals(relation.isNavigableToElement1(),
      cloned.isNavigableToElement1());
    assertEquals(relation.isNavigableToElement2(),
      cloned.isNavigableToElement2());
  }
View Full Code Here

   * Tests the clone() method.
   */
  public void testClone() {
    MyBaseConnection conn = new MyBaseConnection();
    SimpleConnection simpleconn = new SimpleConnection();
    Relation relation = new UmlRelation();
    conn.setConnection(simpleconn);
    conn.setRelation(relation);
    MyBaseConnection cloned = (MyBaseConnection) conn.clone();
    assertTrue(cloned.getConnection() != conn.getConnection());
    assertTrue(cloned.getModelElement() != conn.getModelElement());
View Full Code Here

    relation.setCanSetElement1Navigability(false);
    relation.setCanSetElement2Navigability(true);
    relation.setNavigableToElement1(true);
    relation.setNavigableToElement2(false);
   
    UmlRelation cloned = (UmlRelation) relation.clone();
    assertEquals(relation.getName(), cloned.getName());
    assertEquals(relation.getElement1(), cloned.getElement1());
    assertEquals(relation.getElement2(), cloned.getElement2());
    assertEquals(relation.canSetElement1Navigability(),
      cloned.canSetElement1Navigability());
    assertEquals(relation.canSetElement2Navigability(),
      cloned.canSetElement2Navigability());
    assertEquals(relation.isNavigableToElement1(),
      cloned.isNavigableToElement1());
    assertEquals(relation.isNavigableToElement2(),
      cloned.isNavigableToElement2());
  }
View Full Code Here

   * Tests the NoteConnection class.
   */
  public void testNoteConnection() {
    // relation has no effect
    NoteConnection connection = NoteConnection.getPrototype();
    connection.setRelation(new UmlRelation());
    assertNull(connection.getModelElement());
  }
View Full Code Here

  private void myPostInit() {
    getRootPane().setDefaultButton(okButton);
    assocNameTextField.setText(association.getModelElement().getName());
    showMultiplicitiesCb.setSelected(association.showMultiplicities());
    nameVisibilityCb.setSelected(association.showName());
    UmlRelation relation = (UmlRelation) association.getModelElement();
    ReadingDirection direction = relation.getNameReadingDirection();
    switch (direction) {
      case LEFT_RIGHT:
        l2rRadioButton.setSelected(true);
        break;
      case RIGHT_LEFT:
        r2lRadioButton.setSelected(true);
        break;
      default:
        noDirectionRadioButton.setSelected(true);
        break;
    }
    showRolesCb.setEnabled(false);
    roleANameTextField.setEnabled(false);
    roleBNameTextField.setEnabled(false);
    multiplicityACb.setSelectedItem(
      relation.getElement1Multiplicity().toString());
    multiplicityBCb.setSelectedItem(
      relation.getElement2Multiplicity().toString());
  }
View Full Code Here

  /**
   * Transfers the data to the association object.
   */
  private void transferDataToAssociation() {
    UmlRelation relation = (UmlRelation) association.getModelElement();
    relation.setName(getAssociationName());
    association.setShowName(nameVisibilityCb.isSelected());
    setReadingDirection(relation);
    association.setShowMultiplicities(showMultiplicitiesCb.isSelected());
    try {
      relation.setElement1Multiplicity(Multiplicity.getInstanceFromString(
        multiplicityACb.getSelectedItem().toString()));
      relation.setElement2Multiplicity(Multiplicity.getInstanceFromString(
        multiplicityBCb.getSelectedItem().toString()));
    } catch (ParseException ignore) {
      // do not catch it here, but in the verification
      ignore.printStackTrace();
    }
View Full Code Here

  /**
   * Initializes the map with the connection prototypes.
   */
  private void setupConnectionPrototypeMap() {
    UmlRelation notnavigable = new UmlRelation();
    notnavigable.setCanSetElement1Navigability(false);
    notnavigable.setCanSetElement2Navigability(false);
    UmlRelation fullnavigable = new UmlRelation();
    fullnavigable.setCanSetElement1Navigability(true);
    fullnavigable.setCanSetElement2Navigability(true);
    UmlRelation targetnavigable = new UmlRelation();
    targetnavigable.setCanSetElement1Navigability(false);
    targetnavigable.setCanSetElement2Navigability(true);

    Dependency depPrototype = (Dependency) Dependency.getPrototype().clone();
    depPrototype.setRelation((Relation) notnavigable.clone());
    connectionPrototypes.put(RelationType.DEPENDENCY, depPrototype);

    Association assocPrototype = (Association)
      Association.getPrototype().clone();
    assocPrototype.setRelation((Relation) fullnavigable.clone());
    connectionPrototypes.put(RelationType.ASSOCIATION, assocPrototype);

    Association compPrototype = (Association)
      Association.getPrototype().clone();
    compPrototype.setAssociationType(AssociationType.COMPOSITION);
    compPrototype.setRelation((Relation) targetnavigable.clone());
    connectionPrototypes.put(RelationType.COMPOSITION, compPrototype);

    Association aggrPrototype = (Association)
      Association.getPrototype().clone();
    aggrPrototype.setAssociationType(AssociationType.AGGREGATION);
    aggrPrototype.setRelation((Relation) targetnavigable.clone());
    connectionPrototypes.put(RelationType.AGGREGATION, aggrPrototype);

    Inheritance inheritPrototype = (Inheritance)
      Inheritance.getPrototype().clone();
    inheritPrototype.setRelation((Relation) notnavigable.clone());
View Full Code Here

  /**
   * Initializes the map with the connection prototypes.
   */
  private void setupConnectionPrototypeMap() {
    UmlRelation notnavigable = new UmlRelation();
    notnavigable.setCanSetElement1Navigability(false);
    notnavigable.setCanSetElement2Navigability(false);
    UmlRelation fullnavigable = new UmlRelation();
    fullnavigable.setCanSetElement1Navigability(true);
    fullnavigable.setCanSetElement2Navigability(true);
    UmlRelation targetnavigable = new UmlRelation();
    targetnavigable.setCanSetElement1Navigability(false);
    targetnavigable.setCanSetElement2Navigability(true);

    Dependency depPrototype = (Dependency) Dependency.getPrototype().clone();
    depPrototype.setRelation((Relation) notnavigable.clone());
    connectionPrototypes.put(RelationType.DEPENDENCY, depPrototype);

    Association assocPrototype = (Association)
      Association.getPrototype().clone();
    assocPrototype.setRelation((Relation) fullnavigable.clone());
    connectionPrototypes.put(RelationType.ASSOCIATION, assocPrototype);

    Association compPrototype = (Association)
      Association.getPrototype().clone();
    compPrototype.setAssociationType(AssociationType.COMPOSITION);
    compPrototype.setRelation((Relation) targetnavigable.clone());
    connectionPrototypes.put(RelationType.COMPOSITION, compPrototype);

    Association aggrPrototype = (Association)
      Association.getPrototype().clone();
    aggrPrototype.setAssociationType(AssociationType.AGGREGATION);
    aggrPrototype.setRelation((Relation) targetnavigable.clone());
    connectionPrototypes.put(RelationType.AGGREGATION, aggrPrototype);

    Inheritance inheritPrototype = (Inheritance)
      Inheritance.getPrototype().clone();
    inheritPrototype.setRelation((Relation) notnavigable.clone());
View Full Code Here

TOP

Related Classes of org.tinyuml.model.UmlRelation

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.