View Javadoc
1 /*** 2 * CompositeReportInfo.java 3 * 4 * Project: Dependency Tool 5 * 6 * WHEN WHO WHAT 7 * 06.06.2003 pko initial public release 8 * 30.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.ArrayList; 33 import java.util.Iterator; 34 35 import ch.elca.dependency.core.DependencyModel; 36 37 /*** 38 * <code>CompositeReportInfo</code> used for holding concrete 39 * subclasses of ReportInfo. This class is used by 40 * ch.elca.dependency.report.Report so that Report needs not care 41 * about all subreports. Report invokes methods on CompositeReportInfo 42 * that are then delegeted to the members of CompositeReportInfo. 43 * 44 * @author Pawel Kowalski 45 * @version 1.0-beta 46 */ 47 class CompositeReportInfo extends ReportInfo { 48 49 /*** 50 * Code identifying this ReportInfo 51 */ 52 private static final String CODE_REPORT_INFO_NAME = "project-report"; 53 54 /*** 55 * Text identifying this ReportInfo 56 */ 57 private static final String TEXT_REPORT_INFO_NAME = "report for project"; 58 59 /*** 60 * Members (ReportInfo instances) of this CompositeReportInfo 61 */ 62 private ArrayList m_members = null; 63 64 //****************************************************************************************/ 65 // constructor 66 //****************************************************************************************/ 67 68 /*** 69 * Creates a new <code>CompositeReportInfo</code> instance. 70 */ 71 protected CompositeReportInfo() { 72 super(); 73 m_members = new ArrayList(); 74 } 75 76 //****************************************************************************************/ 77 // initReportInfo method 78 //****************************************************************************************/ 79 80 /*** 81 * Init this CompositeReportInfo with a <code>DependencyModel</code> 82 * and a <code>RawModel</code>. As a result this method will be 83 * invoked on all members of this CompositeReportInfo. 84 * 85 * @param filteredModel a <code>DependencyModel</code> value 86 * @param rawModel a <code>RawModel</code> value 87 */ 88 protected void initReportInfo(DependencyModel dependencyModel) { 89 super.initReportInfo(dependencyModel); 90 for (Iterator iter = m_members.iterator(); iter.hasNext(); ) { 91 ((ReportInfo)iter.next()).initReportInfo(dependencyModel); 92 } 93 } 94 95 96 //****************************************************************************************/ 97 // report method 98 //****************************************************************************************/ 99 100 /*** 101 * Create information tree containing information trees of all 102 * members of this CompositeReportInfo. 103 */ 104 protected void report() { 105 106 // cause members to create reports 107 // 108 for (Iterator iter = m_members.iterator(); iter.hasNext(); ) { 109 ((ReportInfo)iter.next()).report(); 110 } 111 112 // create root node for this ReportInfo 113 // 114 ReportObject reportObject = new ReportObject(CODE_REPORT_INFO_NAME, 115 TEXT_REPORT_INFO_NAME, 116 m_dependencyModel.getProjectRoot().toString()); 117 reportObject.put(Report.IS_HEADER, Report.IS_HEADER); 118 m_rootNode.setUserObject(reportObject); 119 120 // collect report results from members 121 // 122 for (Iterator iter = m_members.iterator(); iter.hasNext(); ) { 123 m_rootNode.add(((ReportInfo)iter.next()).getReportInfoTree()); 124 } 125 } 126 127 //****************************************************************************************/ 128 // addReportInfo method 129 //****************************************************************************************/ 130 131 /*** 132 * Add a ReportInfo instance to this CompositeReportInfo. An added 133 * ReportInfo becomes a member of this CompositeReportInfo. 134 * 135 * @param reportInfo a <code>ReportInfo</code> value 136 */ 137 protected void addReportInfo(ReportInfo reportInfo) { 138 m_members.add(reportInfo); 139 } 140 141 /*** 142 * Add a ReportInfo instance to this CompositeReportInfo at the 143 * <code>position</code>. An added ReportInfo becomes a member of 144 * this CompositeReportInfo. 145 * 146 * @param position an <code>int</code> value 147 * @param reportInfo a <code>ReportInfo</code> value 148 */ 149 protected void addReportInfo(int position, ReportInfo reportInfo) { 150 m_members.add(position, reportInfo); 151 } 152 }

This page was automatically generated by Maven