01: package jdepend.swingui;
02:
03: import java.util.*;
04:
05: import jdepend.framework.*;
06:
07: /**
08: * The <code>AfferentNode</code> class is a <code>PackageNode</code> for an
09: * afferent Java package and its afferent packages.
10: *
11: * @author <b>Mike Clark</b>
12: * @author Clarkware Consulting, Inc.
13: */
14:
15: public class AfferentNode extends PackageNode {
16:
17: /**
18: * Constructs an <code>AfferentNode</code> with the specified parent node
19: * and afferent Java package.
20: *
21: * @param parent Parent package node.
22: * @param jPackage Afferent Java package.
23: */
24: public AfferentNode(PackageNode parent, JavaPackage jPackage) {
25: super (parent, jPackage);
26: }
27:
28: /**
29: * Creates and returns a <code>PackageNode</code> with the specified
30: * parent node and Java package.
31: *
32: * @param parent Parent package node.
33: * @param jPackage Java package.
34: * @return A non-null <code>PackageNode</code.
35: */
36: protected PackageNode makeNode(PackageNode parent,
37: JavaPackage jPackage) {
38: return new AfferentNode(parent, jPackage);
39: }
40:
41: /**
42: * Returns the collection of Java packages coupled to the package
43: * represented in this node.
44: *
45: * @return Collection of coupled packages.
46: */
47: protected Collection getCoupledPackages() {
48: return getPackage().getAfferents();
49: }
50:
51: /**
52: * Returns the string representation of this node in it's current tree
53: * context.
54: *
55: * @return Node label.
56: */
57: public String toString() {
58: if (getParent() == null) {
59: return "Used By - Afferent Dependencies" + " ("
60: + getChildren().size() + " Packages)";
61: }
62:
63: return super.toString();
64: }
65: }
|