View Javadoc

1   /*
2    * This file is a part of CAST project.
3    * (c) Copyright 2007, AGH University of Science & Technology
4    * https://caribou.iisg.agh.edu.pl/trac/cast
5    *
6    * Licensed under the Eclipse Public License, Version 1.0 (the "License").
7    * You may not use this file except in compliance with the License.
8    * You may obtain a copy of the License at
9    * http://www.eclipse.org/legal/epl-v10.html
10   */
11  /*
12   * File: ConnectionGroupWrapper.java
13   * Created: 2007-00-00
14   * Author: klewandowski
15   * $Id: ConnectionGroupWrapper.java 2770 2009-04-21 19:17:34Z kpietak $
16   */
17  
18  package pl.edu.agh.cast.ui.outline;
19  
20  import pl.edu.agh.cast.model.visual.backward.ConnectionGroup;
21  import pl.edu.agh.cast.model.visual.backward.Node;
22  
23  /**
24   * Class wrapping {@link ConnectionGroup} so that it can be easily displayed in a {@link OutlineTreeView}.
25   *
26   * @author AGH CAST Team
27   */
28  public class ConnectionGroupWrapper {
29  
30  	private ConnectionGroup connectionGroup;
31  
32  	private Node sourceNode;
33  
34  	/**
35  	 * Creates new {@link ConnectionGroup} wrapper.
36  	 *
37  	 * @param connectionGroup
38  	 *            {@link ConnectionGroup} to wrap
39  	 * @param sourceNode
40  	 *            source {@link Node}
41  	 */
42  	public ConnectionGroupWrapper(ConnectionGroup connectionGroup, Node sourceNode) {
43  		this.connectionGroup = connectionGroup;
44  		this.sourceNode = sourceNode;
45  	}
46  
47  	public ConnectionGroup getConnectionGroup() {
48  		return connectionGroup;
49  	}
50  
51  	public Node getSourceNode() {
52  		return sourceNode;
53  	}
54  
55  	public Node getTargetNode() {
56  		return connectionGroup.getSource().equals(sourceNode) ? connectionGroup.getTarget() : connectionGroup
57  		        .getSource();
58  	}
59  
60  }