View Javadoc

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.util.Iterator;
20  import java.util.Map;
21  import java.util.ResourceBundle;
22  
23  import org.codehaus.mojo.dashboard.report.plugin.beans.CoberturaReportBean;
24  
25  /**
26   *
27   * @author <a href="dvicente72@gmail.com">David Vicente</a>
28   *
29   */
30  public class CoberturaBarChartStrategy extends AbstractCategoryChartStrategy
31  {
32      /**
33       * Default constructor
34       *
35       * @param bundle
36       * @param title
37       * @param datas
38       */
39      public CoberturaBarChartStrategy( ResourceBundle bundle, String title, Map datas )
40      {
41          super( bundle, title, datas );
42      }
43  
44      /**
45       *
46       */
47      public void fillDataset()
48      {
49  
50          if( datas != null && !datas.isEmpty())
51          {
52              Iterator iter = datas.keySet().iterator();
53  
54              while(iter.hasNext()){
55                  String key = (String)iter.next();
56                  CoberturaReportBean coberReportBean = (CoberturaReportBean)datas.get( key );
57                  //String project = this.getTitle();
58                  String linecover = this.bundle.getString( "report.cobertura.label.linecover" );
59                  String branchcover = this.bundle.getString( "report.cobertura.label.branchcover" );
60                  defaultdataset.addValue( coberReportBean.getLineCoverRate(), linecover, key );
61                  defaultdataset.addValue( coberReportBean.getBranchCoverRate(), branchcover, key );
62              }
63          }
64  
65      }
66  
67      /**
68       *
69       */
70      public String getXAxisLabel()
71      {
72          return this.bundle.getString( "report.cobertura.label.coverage" );
73      }
74  
75  }