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.ResourceBundle;
21  
22  import org.jfree.data.general.Dataset;
23  import org.jfree.data.general.DefaultPieDataset;
24  
25  import org.codehaus.mojo.dashboard.report.plugin.beans.IDashBoardReportBean;
26  
27  /**
28   *
29   * @author <a href="dvicente72@gmail.com">David Vicente</a>
30   *
31   */
32  public abstract class AbstractPieChartStrategy extends AbstractChartStrategy
33  {
34  
35      /**
36       * dataset used to store graph datas
37       */
38      protected DefaultPieDataset defaultdataset = new DefaultPieDataset();
39      /**
40       * resource bundle
41       */
42      protected ResourceBundle bundle;
43      /**
44       * dashboard report used to retreive datas
45       */
46      protected IDashBoardReportBean mDashboardReport;
47  
48      /**
49       *
50       * @param bundle
51       */
52      public AbstractPieChartStrategy( ResourceBundle bundle, String title, IDashBoardReportBean dashboardReport )
53      {
54          this.setTitle( title );
55          this.bundle = bundle;
56          this.mDashboardReport = dashboardReport;
57      }
58  
59      /**
60       * @see org.codehaus.mojo.dashboard.report.plugin.chart.IChartStrategy#getDataset()
61       */
62      public Dataset getDataset()
63      {
64          fillDataset();
65          if ( defaultdataset.getItemCount() > 0 )
66          {
67              this.setDatasetEmpty( false );
68          }
69          return defaultdataset;
70      }
71  
72  }