View Javadoc

1   /*
2    * Copyright 2008-2010 smartics, Kronseder & Reiner GmbH
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *     http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  
17  package de.smartics.maven.issues.bugzilla;
18  
19  import java.util.List;
20  
21  import org.apache.maven.doxia.sink.Sink;
22  import org.eclipse.mylyn.tasks.core.data.TaskData;
23  
24  import de.smartics.maven.issues.RendererConfig;
25  
26  /**
27   * The renderer prints issues in the order fetched to a table. The columns shown
28   * can be parameterized.
29   *
30   * @author <a href="mailto:robert.reiner@smartics.de">Robert Reiner</a>
31   */
32  public class TabularReportRenderer extends AbstractIssuesReportRenderer
33  {
34    // ********************************* Fields *********************************
35  
36    // --- constants ------------------------------------------------------------
37  
38    // --- members --------------------------------------------------------------
39  
40    // ****************************** Initializer *******************************
41  
42    // ****************************** Constructors ******************************
43  
44    /**
45     * Default constructor.
46     *
47     * @param config the configuration to control the rendering process.
48     * @param sink the sink to write to.
49     * @param issues the issue information to render in the report.
50     */
51    public TabularReportRenderer(final RendererConfig config, final Sink sink,
52        final List<TaskData> issues)
53    {
54      super(config, sink, issues);
55    }
56  
57    // ****************************** Inner Classes *****************************
58  
59    // ********************************* Methods ********************************
60  
61    // --- init -----------------------------------------------------------------
62  
63    // --- get&set --------------------------------------------------------------
64  
65    // --- business -------------------------------------------------------------
66  
67    /**
68     * {@inheritDoc}
69     */
70    @Override
71    protected void renderBody()
72    {
73      sink.section1();
74      final boolean noResults = issues.isEmpty();
75      renderTitle(noResults);
76  
77      if (!noResults)
78      {
79        sink.table();
80        renderTableHeader();
81        for (TaskData issue : issues)
82        {
83          renderTableRow(issue);
84        }
85        sink.table_();
86  
87      }
88  
89      renderFooter();
90      sink.section1_();
91    }
92  
93    /**
94     * {@inheritDoc}
95     */
96    @Override
97    public String getTitle()
98    {
99      return getTitle("report.name.release");
100   }
101 
102   /**
103    * {@inheritDoc}
104    */
105   @Override
106   public String getDescription()
107   {
108     return getDescription("report.description.release");
109   }
110 
111   /**
112    * {@inheritDoc}
113    */
114   @Override
115   public String getNoResultsDescription()
116   {
117     return getNoResultsDescription("report.noResultsDescription.release");
118   }
119 
120   // --- object basics --------------------------------------------------------
121 
122 }