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.CpdReportBean;
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 CpdBarChartStrategy extends AbstractCategoryChartStrategy
34  {
35      /**
36       * Default constructor
37       *
38       * @param bundle
39       * @param title
40       * @param datas
41       */
42      public CpdBarChartStrategy( ResourceBundle bundle, String title, Map datas )
43      {
44          super( bundle, title, datas );
45      }
46      /**
47       *
48       */
49      public void fillDataset()
50      {
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                  CpdReportBean cpdReportBean = (CpdReportBean)datas.get( key );
59                  //String project = this.getTitle();
60                  String classes = this.bundle.getString( "report.cpd.label.nbclasses" );
61                  String duplicate = this.bundle.getString( "report.cpd.label.nbduplicate" );
62  
63                  ( (DefaultCategoryDataset) defaultdataset ).addValue( cpdReportBean.getNbClasses(), classes, key );
64                  ( (DefaultCategoryDataset) defaultdataset ).addValue( cpdReportBean.getNbDuplicate(), duplicate, key );
65              }
66          }
67      }
68      /**
69       *
70       */
71      public String getXAxisLabel()
72      {
73          return "value";
74      }
75  }