1 package org.codehaus.mojo.dashboard.report.plugin.chart;
2
3 /*
4 * Copyright 2006 David Vicente
5 *
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17 */
18
19 import java.awt.Color;
20 import java.awt.Paint;
21 import java.util.Iterator;
22 import java.util.Map;
23 import java.util.ResourceBundle;
24
25 import org.codehaus.mojo.dashboard.report.plugin.beans.CloverReportBean;
26
27 /**
28 * @author <a href="dvicente72@gmail.com">David Vicente</a>
29 */
30 public class CloverBarChartStrategy extends AbstractCategoryChartStrategy
31 {
32 /**
33 * Default constructor
34 *
35 * @param bundle
36 * @param title
37 * @param datas
38 */
39 public CloverBarChartStrategy( ResourceBundle bundle, String title, Map datas )
40 {
41 super( bundle, title, datas );
42 }
43
44 public void fillDataset()
45 {
46
47 if ( datas != null && !datas.isEmpty() )
48 {
49 Iterator iter = datas.keySet().iterator();
50 String coveredLabel = this.bundle.getString( "report.clover.label.covered" );
51 // String uncoveredLabel = this.bundle.getString( "report.clover.label.uncovered" );
52 while ( iter.hasNext() )
53 {
54 String key = (String) iter.next();
55 CloverReportBean cloverReportBean = (CloverReportBean) datas.get( key );
56
57 this.defaultdataset.setValue( cloverReportBean.getPercentCoveredElements(), coveredLabel,
58 this.bundle.getString( "report.clover.label.total" ) );
59
60 // this.defaultdataset.setValue( cloverReportBean.getPercentUnCoveredElements(), uncoveredLabel,
61 // this.bundle.getString( "report.clover.label.total" ) );
62
63 this.defaultdataset.setValue( cloverReportBean.getPercentCoveredConditionals(), coveredLabel,
64 this.bundle.getString( "report.clover.label.conditionals" ) );
65
66 // this.defaultdataset.setValue( cloverReportBean.getPercentUnCoveredConditionals(), uncoveredLabel,
67 // this.bundle.getString( "report.clover.label.conditionals" ) );
68 this.defaultdataset.setValue( cloverReportBean.getPercentCoveredStatements(), coveredLabel,
69 this.bundle.getString( "report.clover.label.statements" ) );
70
71 // this.defaultdataset.setValue( cloverReportBean.getPercentUnCoveredStatements(), uncoveredLabel,
72 // this.bundle.getString( "report.clover.label.statements" ) );
73 this.defaultdataset.setValue( cloverReportBean.getPercentCoveredMethods(), coveredLabel,
74 this.bundle.getString( "report.clover.label.methods" ) );
75
76 // this.defaultdataset.setValue( cloverReportBean.getPercentUnCoveredMethods() , uncoveredLabel,
77 // this.bundle.getString( "report.clover.label.methods" ) );
78 }
79 }
80 }
81
82 public Paint[] getPaintColor()
83 {
84 return new Paint[] { Color.GREEN, Color.RED };
85 }
86 }