001    /**
002     * www.jcoverage.com
003     * Copyright (C)2003 jcoverage ltd.
004     *
005     * This file is part of jcoverage.
006     *
007     * jcoverage is free software; you can redistribute it and/or modify
008     * it under the terms of the GNU General Public License as published
009     * by the Free Software Foundation; either version 2 of the License,
010     * or (at your option) any later version.
011     *
012     * jcoverage is distributed in the hope that it will be useful, but
013     * WITHOUT ANY WARRANTY; without even the implied warranty of
014     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
015     * General Public License for more details.
016     *
017     * You should have received a copy of the GNU General Public License
018     * along with jcoverage; if not, write to the Free Software
019     * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
020     * USA
021     *
022     */
023    package com.jcoverage.coverage.reporting.collation;
024    
025    import com.jcoverage.reporting.AbstractPage;
026    import com.jcoverage.reporting.Column;
027    import com.jcoverage.reporting.DefaultLineCategory;
028    import com.jcoverage.reporting.Line;
029    import com.jcoverage.reporting.LineCategory;
030    import com.jcoverage.reporting.Page;
031    import java.util.ArrayList;
032    import java.util.List;
033    import org.apache.log4j.Logger;
034    
035    /**
036     *
037     */
038    public class ReportSummaryPage extends AbstractPage implements Page {
039      
040      static Logger logger=Logger.getLogger(ReportSummaryPage.class);
041      
042      public static DefaultLineCategory CATEGORY_PACKAGE_SUMMARY=new DefaultLineCategory("Package Summary");
043    
044      static {
045        CATEGORY_PACKAGE_SUMMARY.addColumn(ReportSummaryPackageLine.COLUMN_PACKAGE_NAME);
046        CATEGORY_PACKAGE_SUMMARY.addColumn(ReportSummaryPackageLine.COLUMN_TOTAL_JAVAFILES);
047        CATEGORY_PACKAGE_SUMMARY.addColumn(ReportSummaryPackageLine.COLUMN_TOTAL_LINES);
048        CATEGORY_PACKAGE_SUMMARY.addColumn(ReportSummaryPackageLine.COLUMN_AVERAGE_COVERAGE);
049        CATEGORY_PACKAGE_SUMMARY.addColumn(ReportSummaryPackageLine.COLUMN_AVERAGE_COVERAGE_PERCENT);
050        CATEGORY_PACKAGE_SUMMARY.addColumn(ReportSummaryPackageLine.COLUMN_BRANCH_AVERAGE_COVERAGE);
051        CATEGORY_PACKAGE_SUMMARY.addColumn(ReportSummaryPackageLine.COLUMN_BRANCH_AVERAGE_COVERAGE_PERCENT);
052      }
053    
054      public ReportSummaryPage() {
055        super("Summary");
056        addCategory(CATEGORY_PACKAGE_SUMMARY);
057        addCategory(PackageSummaryPage.CATEGORY_JAVAFILES);
058      }
059    
060      public Line instantiateLineForCategory(LineCategory category) {
061        if(category.equals(CATEGORY_PACKAGE_SUMMARY)) {
062          return new ReportSummaryPackageLine();
063        } else {
064          return null;
065        }
066      }
067    
068    }