Package org.tinyuml.model

Examples of org.tinyuml.model.UmlAssociation


   * @param node1 the UmlNode 1
   * @param node2 the UmlNode 2
   * @return the UmlAssoication
   */
  private UmlAssociation createAssociationModel(UmlNode node1, UmlNode node2) {
    UmlAssociation association = (UmlAssociation)
      modelElementFactory.create(RelationType.DEPENDENCY);
    association.setElement1(node1.getModelElement());
    association.setElement2(node2.getModelElement());
    return association;
  }
View Full Code Here


  /**
   * {@inheritDoc}
   */
  public Connection createDependency(UmlNode sourceNode, UmlNode targetNode) {
    UmlAssociation association = (UmlAssociation)
      modelElementFactory.create(ElementType.DEPENDENCY);
    association.setSource(sourceNode.getModelElement());
    association.setTarget(targetNode.getModelElement());
    Connection connection = new Dependency(association);
    connection.setNode0(sourceNode);
    connection.setNode1(targetNode);
    return connection;
  }
View Full Code Here

  /**
   * {@inheritDoc}
   */
  public Association createAssociation(UmlNode node0, UmlNode node1) {
    UmlAssociation association = (UmlAssociation)
      modelElementFactory.create(ElementType.DEPENDENCY);
    association.setSource(node0.getModelElement());
    association.setTarget(node1.getModelElement());
    Association assoc = new Association(association);
    assoc.setNode0(node0);
    assoc.setNode1(node1);
    return assoc;
  }
View Full Code Here

 
  /**
   * Tests adding Connections.
   */
  public void testAddRemoveConnection() {
    UmlAssociation assoc = (UmlAssociation)
      UmlAssociation.getInstance().clone();
    Line2D line = new Line2D.Double();
    line.setLine(5.0, 5.0, 10.0, 5.0);
    Connection conn = new BaseConnection(assoc, line);
    diagram.addChild(conn);
View Full Code Here

 
  /**
   * Tests adding Connections.
   */
  public void testAddRemoveConnection() {
    UmlAssociation assoc = (UmlAssociation)
      UmlAssociation.getInstance().clone();
    Line2D line = new Line2D.Double();
    line.setLine(5.0, 5.0, 10.0, 5.0);
    Connection conn = new BaseConnection(assoc, line);
    diagram.addChild(conn);
View Full Code Here

   * @return the association element
   */
  private UmlAssociation createAssociation(RelationType associationType,
    Attributes attributes) {
    int id = Integer.valueOf(attributes.getValue("id"));
    UmlAssociation assoc = (UmlAssociation)
      elementFactory.create(associationType);
    assoc.setName(attributes.getValue("name"));
    int sourceId = Integer.valueOf(attributes.getValue("source"));
    int targetId = Integer.valueOf(attributes.getValue("target"));
    assoc.setElement1(elementMap.get(sourceId));
    assoc.setElement2(elementMap.get(targetId));
    elementMap.put(id, assoc);
    return assoc;
  }
View Full Code Here

  /**
   * Tests the run() method.
   */
  public void testRun() {
    UmlAssociation assoc = (UmlAssociation)
      UmlAssociation.getInstance().clone();
    mockFactory.expects(once()).method("create").
      with(eq(ElementType.DEPENDENCY)).will(returnValue(assoc));
    mockSourceNode.expects(once()).method("getModelElement").
      will(returnValue(source));
    mockTargetNode.expects(once()).method("getModelElement").
      will(returnValue(target));
    mockDiagram.expects(once()).method("addConnection");
    mockNotification.expects(once()).method("notifyElementAdded");
   
    command.run();
    Connection conn = command.getConnection();
    assertNotNull(conn);
    assertEquals(source, assoc.getSource());
    assertEquals(target, assoc.getTarget());
  }
View Full Code Here

   * @return the association element
   */
  private UmlAssociation createAssociation(ElementType elemType,
    Attributes attributes) {
    int id = Integer.valueOf(attributes.getValue("id"));
    UmlAssociation assoc = (UmlAssociation) elementFactory.create(elemType);
    assoc.setName(attributes.getValue("name"));
    int sourceId = Integer.valueOf(attributes.getValue("source"));
    int targetId = Integer.valueOf(attributes.getValue("target"));
    assoc.setSource(elementMap.get(sourceId));
    assoc.setTarget(elementMap.get(targetId));
    elementMap.put(id, assoc);
    return assoc;
  }
View Full Code Here

   * @return the association element
   */
  private UmlAssociation createAssociation(ElementType elemType,
    Attributes attributes) {
    int id = Integer.valueOf(attributes.getValue("id"));
    UmlAssociation assoc = (UmlAssociation) elementFactory.create(elemType);
    assoc.setName(attributes.getValue("name"));
    int sourceId = Integer.valueOf(attributes.getValue("source"));
    int targetId = Integer.valueOf(attributes.getValue("target"));
    assoc.setSource(elementMap.get(sourceId));
    assoc.setTarget(elementMap.get(targetId));
    elementMap.put(id, assoc);
    return assoc;
  }
View Full Code Here

   * @return the association element
   */
  private UmlAssociation createAssociation(ElementType elemType,
    Attributes attributes) {
    int id = Integer.valueOf(attributes.getValue("id"));
    UmlAssociation assoc = (UmlAssociation) elementFactory.create(elemType);
    assoc.setName(attributes.getValue("name"));
    int sourceId = Integer.valueOf(attributes.getValue("source"));
    int targetId = Integer.valueOf(attributes.getValue("target"));
    assoc.setSource(elementMap.get(sourceId));
    assoc.setTarget(elementMap.get(targetId));
    elementMap.put(id, assoc);
    return assoc;
  }
View Full Code Here

TOP

Related Classes of org.tinyuml.model.UmlAssociation

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.