1 /***
2 * ReportObject.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.Hashtable;
33
34 /***
35 * <code>ReportObject</code> Used as UserObject in
36 * javax.swing.tree.DefaultMutableTreeNode. <code>ReportObject</code>
37 * extends a Hashtable to carry additional information associated with
38 * the report information (eg. formatting hints).
39 *
40 * @see ch.elca.dependency.report.ReportInfo
41 * @see ch.elca.dependency.report.Report
42 *
43 * @author Pawel Kowalski
44 * @version 1.0-beta
45 */
46 class ReportObject extends Hashtable {
47
48 /***
49 * Code name of a TreeNode, used eg. as xml element identifier.
50 */
51 private String m_nodeCode = null;
52
53 /***
54 * Plain text Name of a TreeNode, used eg. for Plain text reports.
55 */
56 private String m_nodeName = null;
57
58 /***
59 * A String value associated with a TreeNode.
60 */
61 private String m_nodeValue = null;
62
63 /***
64 * <code>m_printNodeName</code> used to indicate whether to print
65 * the node name in a Report.
66 */
67 private boolean m_printNodeName = true;
68
69 //****************************************************************************************/
70 // constructors
71 //****************************************************************************************/
72
73 /***
74 * Creates a new <code>ReportObject</code> instance.
75 *
76 * @param nodeCode a <code>String</code> value
77 * @param nodeName a <code>String</code> value
78 */
79 ReportObject(String nodeCode, String nodeName) {
80 this(nodeCode, nodeName, "", true);
81 }
82
83 /***
84 * Creates a new <code>ReportObject</code> instance.
85 *
86 * @param nodeCode a <code>String</code> value
87 * @param nodeName a <code>String</code> value
88 * @param printNodeName a <code>boolean</code> value
89 */
90 ReportObject(String nodeCode, String nodeName,
91 boolean printNodeName) {
92 this(nodeCode, nodeName, "", printNodeName);
93 }
94
95 /***
96 * Creates a new <code>ReportObject</code> instance.
97 *
98 * @param nodeCode a <code>String</code> value
99 * @param nodeName a <code>String</code> value
100 * @param nodeValue a <code>String</code> value
101 */
102 ReportObject(String nodeCode, String nodeName,
103 String nodeValue) {
104 this(nodeCode, nodeName, nodeValue, true);
105 }
106
107 /***
108 * Creates a new <code>ReportObject</code> instance.
109 *
110 * @param nodeCode a <code>String</code> value
111 * @param nodeName a <code>String</code> value
112 * @param nodeValue a <code>String</code> value
113 * @param printNodeName a <code>boolean</code> value
114 */
115 ReportObject(String nodeCode, String nodeName,
116 String nodeValue, boolean printNodeName) {
117 m_nodeCode = nodeCode;
118 m_nodeName = nodeName;
119 m_nodeValue = nodeValue;
120 m_printNodeName = printNodeName;
121 }
122
123 //****************************************************************************************/
124 // getters
125 //****************************************************************************************/
126
127 /***
128 * Retireve a boolean value indicating whether this TreeNode's
129 * name is to be printed in a plain text report.
130 *
131 * @return a <code>boolean</code> value
132 */
133 public boolean isNodeNamePrintable() {
134 return m_printNodeName;
135 }
136
137 /***
138 * Get this TreeNode's code.
139 *
140 * @return a <code>String</code> value
141 */
142 public String getNodeCode() {
143 return m_nodeCode;
144 }
145
146 /***
147 * Get this TreeNode's name.
148 *
149 * @return a <code>String</code> value
150 */
151 public String getNodeName() {
152 return m_nodeName;
153 }
154
155 /***
156 * Set this TreeNode's value.
157 *
158 * @param nodeValue a <code>String</code> value
159 */
160 public void setNodeValue(String nodeValue) {
161 m_nodeValue = nodeValue;
162 }
163
164 /***
165 * Get this TreeNode's value.
166 *
167 * @return a <code>String</code> value
168 */
169 public String getNodeValue() {
170 return m_nodeValue;
171 }
172
173 //****************************************************************************************/
174 // toString
175 //****************************************************************************************/
176
177 /***
178 * Object's Overriden <code>toString</code> method.
179 *
180 * @return a <code>String</code> value
181 */
182 public String toString() {
183 return m_nodeCode + "/" + m_nodeName + "/" + m_nodeValue;
184 }
185 }
This page was automatically generated by Maven