View Javadoc

1   package org.codehaus.mojo.dashboard.report.plugin.chart;
2   
3   /*
4    * Copyright 2008 Henrik Lynggaard
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.IDashBoardReportBean;
24  import org.codehaus.mojo.dashboard.report.plugin.beans.TagListReportBean;
25  
26  /**
27   *
28   * @author Henrik Lynggaard
29   *
30   */
31  public class TaglistPieChartStrategy extends AbstractPieChartStrategy
32  {
33  
34      /**
35       * Default constructor
36       *
37       * @param bundle
38       * @param title
39       * @param dashboardReport
40       */
41      public TaglistPieChartStrategy( ResourceBundle bundle, String title, IDashBoardReportBean dashboardReport )
42      {
43          super( bundle, title, dashboardReport );
44      }
45  
46      /**
47       *
48       */
49      public void fillDataset()
50      {
51          if ( mDashboardReport instanceof TagListReportBean )
52          {
53              TagListReportBean taglistReportBean = (TagListReportBean) mDashboardReport;
54              Iterator tags = taglistReportBean.getTags().entrySet().iterator();
55              while ( tags.hasNext() )
56              {
57                  Map.Entry entry = (Map.Entry) tags.next();
58                  String name = (String) entry.getKey();
59                  int value = ( (Integer) entry.getValue() ).intValue();
60                  this.defaultdataset.setValue( name + " = " + value, value );
61  
62              }
63          }
64      }
65  }