View Javadoc

1   package org.codehaus.mojo.dashboard.report.plugin.chart;
2   
3   /*
4    * Copyright 2006 Matthew Beermann
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.awt.Color;
20  import java.awt.Paint;
21  import java.util.Iterator;
22  import java.util.Map;
23  import java.util.ResourceBundle;
24  
25  import org.codehaus.mojo.dashboard.report.plugin.beans.CloverReportBean;
26  import org.jfree.data.category.DefaultCategoryDataset;
27  
28  /**
29   * @author <a href="mbeerman@yahoo.com">Matthew Beermann</a>
30   */
31  public class MultiCloverBarChartStrategy extends AbstractCategoryChartStrategy
32  {
33      /**
34       * Default constructor
35       *
36       * @param bundle
37       * @param title
38       * @param datas
39       */
40      public MultiCloverBarChartStrategy( ResourceBundle bundle, String title, Map datas )
41      {
42          super( bundle, title, datas );
43      }
44  
45      public void fillDataset()
46      {
47  
48          if ( datas != null && !datas.isEmpty() )
49          {
50              Iterator iter = datas.keySet().iterator();
51  
52              while ( iter.hasNext() )
53              {
54                  String key = (String) iter.next();
55                  CloverReportBean cloverReportBean = (CloverReportBean) datas.get( key );
56  
57                  ( (DefaultCategoryDataset) defaultdataset ).setValue(
58                                                                        cloverReportBean.getPercentCoveredElements(),
59                                                                        "Total "
60                                                                                        + this.bundle.getString( "report.clover.label.covered" ),
61                                                                        key );
62              }
63          }
64      }
65  
66      public Paint[] getPaintColor()
67      {
68          return new Paint[] { Color.GREEN, Color.RED };
69      }
70  }