1 /***
2 * DependenciesReportInfo.java
3 *
4 * Project: Dependency Tool
5 *
6 * WHEN WHO WHAT
7 * 06.06.2003 pko initial public release
8 * 31.10.2002 pko creation
9 *
10 * Copyright 2003 ELCA Informatique SA
11 * Av. de la Harpe 22-24, 1000 Lausanne 13, Switzerland
12 * www.elca.ch
13 *
14 * This library is free software; you can redistribute it and/or
15 * modify it under the terms of the GNU Lesser General Public License
16 * as published by the Free Software Foundation; either version 2.1 of
17 * the License, or (at your option) any later version.
18 *
19 * This library is distributed in the hope that it will be useful, but
20 * WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
22 * Lesser General Public License for more details.
23 *
24 * You should have received a copy of the GNU Lesser General Public
25 * License along with this library; if not, write to the Free Software
26 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
27 * USA
28 */
29
30 package ch.elca.dependency.report;
31
32 import java.util.*;
33 import javax.swing.tree.DefaultMutableTreeNode;
34
35 /***
36 * <code>DependenciesReportInfo</code> used to create information
37 * about package dependencies within the analyzed project.
38 *
39 * @author Pawel Kowalski
40 * @version 1.0-beta
41 */
42 class DependenciesReportInfo extends ReportInfo {
43
44 /***
45 * Code identifying this ReportInfo
46 */
47 private static final String CODE_REPORT_INFO_NAME = "package-dependencies";
48
49 /***
50 * Text identifying this ReportInfo
51 */
52 private static final String TEXT_REPORT_INFO_NAME = "package dependencies";
53
54 /***
55 * Code identifying a package dependent on other packages
56 */
57 private static final String CODE_PACKAGE = "package";
58
59 /***
60 * Text identifying a package dependent on other packages
61 */
62 private static final String TEXT_PACKAGE = "package";
63
64 /***
65 * Code identifying packages that an other package depends on
66 */
67 private static final String CODE_DEPENDS = "depends-on";
68
69 /***
70 * Text identifying packages that an other package depends on
71 */
72 private static final String TEXT_DEPENDS = "depends on";
73
74 //****************************************************************************************/
75 // constructor
76 //****************************************************************************************/
77
78 /***
79 * Creates a new <code>DependenciesReportInfo</code> instance.
80 */
81 DependenciesReportInfo() {
82 super();
83 }
84
85 //****************************************************************************************/
86 // report method
87 //****************************************************************************************/
88
89 /***
90 * Create Information tree containing package dependencies within
91 * the analyzed project
92 */
93 void report() {
94
95 ReportObject reportObject = null;
96 DefaultMutableTreeNode treeNodeLevel_1 = null;
97 DefaultMutableTreeNode treeNodeLevel_2 = null;
98 ArrayList deps = null;
99 String packageName = null;
100
101 HashMap dependencies = m_dependencyModel.getPackDepend();
102 Set keys = dependencies.keySet();
103
104 // ReportInfo name
105 //
106 reportObject = new ReportObject(CODE_REPORT_INFO_NAME, TEXT_REPORT_INFO_NAME);
107 reportObject.put(Report.INDENT, new Integer(1));
108 reportObject.put(Report.IS_HEADER, Report.IS_HEADER);
109 m_rootNode.setUserObject(reportObject);
110
111 // iterate through all packages that depend on other packages
112 //
113 for (Iterator iter = keys.iterator(); iter.hasNext(); ) {
114
115 // package that depends on other packages
116 //
117 packageName = (String)iter.next();
118 reportObject = new ReportObject(CODE_PACKAGE, TEXT_PACKAGE,
119 packageName, false);
120 reportObject.put(Report.INDENT, new Integer(2));
121 treeNodeLevel_1 = new DefaultMutableTreeNode(reportObject);
122 m_rootNode.add(treeNodeLevel_1);
123
124 // iterate through all packages that an other package depends on
125 //
126 deps = (ArrayList)dependencies.get(packageName);
127 for (Iterator iter2 = deps.iterator(); iter2.hasNext(); ) {
128 packageName = String.valueOf(iter2.next());
129 reportObject = new ReportObject(CODE_DEPENDS, TEXT_DEPENDS,
130 packageName, false);
131 reportObject.put(Report.INDENT, new Integer(3));
132 treeNodeLevel_2 = new DefaultMutableTreeNode(reportObject);
133 treeNodeLevel_1.add(treeNodeLevel_2);
134 }
135 }
136 }
137 }
This page was automatically generated by Maven