View Javadoc

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