View Javadoc

1   /*
2    * Copyright 2008-2013 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  package de.smartics.maven.issues.bugzilla;
17  
18  import java.util.List;
19  
20  import org.apache.maven.doxia.sink.Sink;
21  import org.eclipse.mylyn.tasks.core.data.TaskData;
22  
23  import de.smartics.maven.issues.RendererConfig;
24  
25  /**
26   * The renderer prints issues in the order fetched to a table. The columns shown
27   * can be parameterized.
28   *
29   * @author <a href="mailto:robert.reiner@smartics.de">Robert Reiner</a>
30   */
31  public class TabularReportRenderer extends AbstractIssuesReportRenderer
32  {
33    // ********************************* Fields *********************************
34  
35    // --- constants ------------------------------------------------------------
36  
37    // --- members --------------------------------------------------------------
38  
39    // ****************************** Initializer *******************************
40  
41    // ****************************** Constructors ******************************
42  
43    /**
44     * Default constructor.
45     *
46     * @param config the configuration to control the rendering process.
47     * @param sink the sink to write to.
48     * @param issues the issue information to render in the report.
49     */
50    public TabularReportRenderer(final RendererConfig config, final Sink sink,
51        final List<TaskData> issues)
52    {
53      super(config, sink, issues);
54    }
55  
56    // ****************************** Inner Classes *****************************
57  
58    // ********************************* Methods ********************************
59  
60    // --- init -----------------------------------------------------------------
61  
62    // --- get&set --------------------------------------------------------------
63  
64    // --- business -------------------------------------------------------------
65  
66    /**
67     * {@inheritDoc}
68     */
69    @Override
70    protected void renderBody()
71    {
72      sink.section1();
73      final boolean noResults = issues.isEmpty();
74      renderTitle(noResults);
75  
76      if (!noResults)
77      {
78        sink.table();
79        renderTableHeader();
80        for (TaskData issue : issues)
81        {
82          renderTableRow(issue);
83        }
84        sink.table_();
85  
86      }
87  
88      renderFooter();
89      sink.section1_();
90    }
91  
92    /**
93     * {@inheritDoc}
94     */
95    @Override
96    public String getTitle()
97    {
98      return getTitle("report.name.release");
99    }
100 
101   /**
102    * {@inheritDoc}
103    */
104   @Override
105   public String getDescription()
106   {
107     return getDescription("report.description.release");
108   }
109 
110   /**
111    * {@inheritDoc}
112    */
113   @Override
114   public String getNoResultsDescription()
115   {
116     return getNoResultsDescription("report.noResultsDescription.release");
117   }
118 
119   // --- object basics --------------------------------------------------------
120 
121 }