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.html;
024    
025    import java.util.Set;
026    
027    import org.apache.log4j.Logger;
028    
029    import com.jcoverage.coverage.reporting.collation.OverallSummaryLine;
030    import com.jcoverage.reporting.Column;
031    import com.jcoverage.reporting.FormattingContext;
032    import com.jcoverage.reporting.Page;
033    import com.jcoverage.reporting.html.ColumnRenderer;
034    import com.jcoverage.reporting.html.LabelColumnRenderer;
035    import com.jcoverage.reporting.html.CssColumnRenderer;
036    import com.jcoverage.reporting.html.PercentageRedGreenIndicator;
037    import com.jcoverage.reporting.html.RedGreenIndicator;
038    import com.jcoverage.reporting.html.ReportTable;
039    
040    /**
041     *
042     */
043    public class OverallSummaryTable extends ReportTable {
044      
045      static Logger logger=Logger.getLogger(OverallSummaryTable.class);
046      
047      static Column TITLE_COLUMN=new Column(null,String.class);
048    
049      static Column[] COLUMNS=new Column[]{TITLE_COLUMN,
050                                           OverallSummaryLine.COLUMN_TOTAL_JAVAFILES,
051                                           OverallSummaryLine.COLUMN_TOTAL_LINES,
052                                           OverallSummaryLine.COLUMN_AVERAGE_COVERAGE_PERCENT,
053                                           OverallSummaryLine.COLUMN_AVERAGE_COVERAGE_PERCENT,
054                                           OverallSummaryLine.COLUMN_BRANCH_AVERAGE_COVERAGE_PERCENT,
055                                           OverallSummaryLine.COLUMN_BRANCH_AVERAGE_COVERAGE_PERCENT};
056    
057      public OverallSummaryTable(Page page,Set records,FormattingContext ctx) {
058        super(page,records,COLUMNS,ctx);
059        setColumnRenderer(TITLE_COLUMN,new LabelColumnRenderer("Overall","Overall coverage figures"));
060        setColumnRenderer(OverallSummaryLine.COLUMN_TOTAL_LINES,new CssColumnRenderer("lines"));
061        setColumnRenderer(OverallSummaryLine.COLUMN_TOTAL_JAVAFILES,new CssColumnRenderer("files"));
062        setColumnRenderer(OverallSummaryLine.COLUMN_AVERAGE_COVERAGE_PERCENT,new PercentColumnRenderer("coverage"));
063        setColumnRenderer(OverallSummaryLine.COLUMN_AVERAGE_COVERAGE_PERCENT,new RedGreenIndicator("indicator"),4);
064        setColumnRenderer(OverallSummaryLine.COLUMN_BRANCH_AVERAGE_COVERAGE_PERCENT,new PercentColumnRenderer("coverage"));
065        setColumnRenderer(OverallSummaryLine.COLUMN_BRANCH_AVERAGE_COVERAGE_PERCENT,new RedGreenIndicator("indicator"),6);
066      }
067    
068    }