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