1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.apache.maven.plugins.changes.issues;
20
21 import java.util.ResourceBundle;
22
23 import org.apache.maven.doxia.sink.Sink;
24 import org.apache.maven.doxia.sink.SinkEventAttributes;
25 import org.apache.maven.doxia.sink.impl.SinkEventAttributeSet;
26 import org.apache.maven.reporting.AbstractMavenReportRenderer;
27
28
29
30
31
32
33
34
35 public abstract class AbstractIssuesReportRenderer extends AbstractMavenReportRenderer {
36
37 protected final ResourceBundle bundle;
38
39 protected AbstractIssuesReportRenderer(Sink sink, ResourceBundle bundle) {
40 super(sink);
41 this.bundle = bundle;
42 }
43
44 public String getAuthor() {
45 return null;
46 }
47
48 @Override
49 public String getTitle() {
50 return bundle.getString("report.issues.header");
51 }
52
53 @Override
54 public void render() {
55
56 String title = getTitle();
57 sink.head();
58 sink.title();
59 text(title);
60 sink.title_();
61
62 String author = getAuthor();
63 if (author != null) {
64 sink.author();
65 text(author);
66 sink.author_();
67 }
68
69 sink.head_();
70
71 sink.body();
72 startSection(title);
73
74 renderBody();
75
76 endSection();
77 sink.body_();
78 sink.flush();
79 sink.close();
80 }
81
82 protected void sinkCell(String text) {
83 sink.tableCell();
84
85 if (text != null) {
86 text(text);
87 } else {
88 sink.nonBreakingSpace();
89 }
90
91 sink.tableCell_();
92 }
93
94 protected void sinkCellLink(String text, String link) {
95 sink.tableCell();
96 link(link, text);
97 sink.tableCell_();
98 }
99
100 protected void sinkFigure(String image, String altText) {
101 SinkEventAttributes attributes = new SinkEventAttributeSet();
102 attributes.addAttribute("alt", altText);
103 attributes.addAttribute("title", altText);
104
105 sink.figureGraphics(image, attributes);
106 }
107
108 protected void sinkShowTypeIcon(String type) {
109 String image = "";
110 String altText = "";
111
112 if (type == null) {
113 image = "images/icon_help_sml.gif";
114 altText = "Unknown";
115 } else if (type.equals("fix")) {
116 image = "images/fix.gif";
117 altText = "Fix";
118 } else if (type.equals("update")) {
119 image = "images/update.gif";
120 altText = "Update";
121 } else if (type.equals("add")) {
122 image = "images/add.gif";
123 altText = "Add";
124 } else if (type.equals("remove")) {
125 image = "images/remove.gif";
126 altText = "Remove";
127 }
128
129 sink.tableCell();
130 sinkFigure(image, altText);
131 sink.tableCell_();
132 }
133 }