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