1. Project Clover database Tue Dec 20 2016 21:24:09 CET
  2. Package org.xwiki.rendering.internal.renderer.event

File EventsChainingRenderer.java

 

Coverage histogram

../../../../../../img/srcFileCovDistChart10.png
0% of files have more coverage

Code metrics

22
99
55
1
480
349
67
0.68
1.8
55
1.22

Classes

Class Line # Actions
EventsChainingRenderer 42 99 0% 67 2
0.988636498.9%
 

Contributing tests

This file is covered by 495 tests. .

Source view

1    /*
2    * See the NOTICE file distributed with this work for additional
3    * information regarding copyright ownership.
4    *
5    * This is free software; you can redistribute it and/or modify it
6    * under the terms of the GNU Lesser General Public License as
7    * published by the Free Software Foundation; either version 2.1 of
8    * the License, or (at your option) any later version.
9    *
10    * This software is distributed in the hope that it will be useful,
11    * but WITHOUT ANY WARRANTY; without even the implied warranty of
12    * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13    * Lesser General Public License for more details.
14    *
15    * You should have received a copy of the GNU Lesser General Public
16    * License along with this software; if not, write to the Free
17    * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
18    * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
19    */
20    package org.xwiki.rendering.internal.renderer.event;
21   
22    import java.util.Iterator;
23    import java.util.Map;
24    import java.util.TreeMap;
25   
26    import org.apache.commons.lang3.StringUtils;
27    import org.xwiki.rendering.listener.Format;
28    import org.xwiki.rendering.listener.HeaderLevel;
29    import org.xwiki.rendering.listener.ListType;
30    import org.xwiki.rendering.listener.MetaData;
31    import org.xwiki.rendering.listener.chaining.ListenerChain;
32    import org.xwiki.rendering.listener.reference.ResourceReference;
33    import org.xwiki.rendering.renderer.AbstractChainingPrintRenderer;
34    import org.xwiki.rendering.syntax.Syntax;
35   
36    /**
37    * Prints listener event names in a format useful for testing and debugging.
38    *
39    * @version $Id: ff1f34d0595850e79d67a942d9515331728aae47 $
40    * @since 1.8RC1
41    */
 
42    public class EventsChainingRenderer extends AbstractChainingPrintRenderer
43    {
 
44  496 toggle public EventsChainingRenderer(ListenerChain listenerChain)
45    {
46  496 setListenerChain(listenerChain);
47    }
48   
49    // Events
50   
51    /**
52    * {@inheritDoc}
53    *
54    * @since 3.0M2
55    */
 
56  496 toggle @Override
57    public void beginDocument(MetaData metadata)
58    {
59  496 getPrinter().println("beginDocument" + serializeParameters(metadata.getMetaData()));
60    }
61   
62    /**
63    * {@inheritDoc}
64    *
65    * @since 3.0M2
66    */
 
67  496 toggle @Override
68    public void endDocument(MetaData metadata)
69    {
70  496 getPrinter().print("endDocument" + serializeParameters(metadata.getMetaData()));
71    }
72   
 
73  128 toggle @Override
74    public void beginGroup(Map<String, String> parameters)
75    {
76  128 getPrinter().println("beginGroup" + serializeParameters(parameters));
77    }
78   
 
79  128 toggle @Override
80    public void endGroup(Map<String, String> parameters)
81    {
82  128 getPrinter().println("endGroup" + serializeParameters(parameters));
83    }
84   
 
85  299 toggle @Override
86    public void beginFormat(Format format, Map<String, String> parameters)
87    {
88  299 getPrinter().println("beginFormat [" + format + "]" + serializeParameters(parameters));
89    }
90   
 
91  299 toggle @Override
92    public void endFormat(Format format, Map<String, String> parameters)
93    {
94  299 getPrinter().println("endFormat [" + format + "]" + serializeParameters(parameters));
95    }
96   
 
97  442 toggle @Override
98    public void beginParagraph(Map<String, String> parameters)
99    {
100  442 getPrinter().println("beginParagraph" + serializeParameters(parameters));
101    }
102   
 
103  442 toggle @Override
104    public void endParagraph(Map<String, String> parameters)
105    {
106  442 getPrinter().println("endParagraph" + serializeParameters(parameters));
107    }
108   
 
109  218 toggle @Override
110    public void onNewLine()
111    {
112  218 getPrinter().println("onNewLine");
113    }
114   
 
115  177 toggle @Override
116    public void beginLink(ResourceReference reference, boolean freestanding, Map<String, String> parameters)
117    {
118  177 getPrinter().println(
119    "beginLink [" + reference + "] [" + freestanding + "]" + serializeParameters(parameters));
120    }
121   
 
122  177 toggle @Override
123    public void endLink(ResourceReference reference, boolean freestanding, Map<String, String> parameters)
124    {
125  177 getPrinter().println(
126    "endLink [" + reference + "] [" + freestanding + "]" + serializeParameters(parameters));
127    }
128   
 
129  29 toggle @Override
130    public void onMacro(String id, Map<String, String> parameters, String content, boolean inline)
131    {
132  29 printMacroData("onMacro", id, parameters, content, inline);
133    }
134   
 
135  122 toggle @Override
136    public void beginSection(Map<String, String> parameters)
137    {
138  122 getPrinter().println("beginSection" + serializeParameters(parameters));
139    }
140   
 
141  106 toggle @Override
142    public void beginHeader(HeaderLevel level, String id, Map<String, String> parameters)
143    {
144  106 getPrinter().println("beginHeader [" + level + ", " + id + "]" + serializeParameters(parameters));
145    }
146   
 
147  122 toggle @Override
148    public void endSection(Map<String, String> parameters)
149    {
150  122 getPrinter().println("endSection" + serializeParameters(parameters));
151    }
152   
 
153  106 toggle @Override
154    public void endHeader(HeaderLevel level, String id, Map<String, String> parameters)
155    {
156  106 getPrinter().println("endHeader [" + level + ", " + id + "]" + serializeParameters(parameters));
157    }
158   
 
159  1960 toggle @Override
160    public void onWord(String word)
161    {
162  1960 getPrinter().println("onWord [" + getEscaped(word) + "]");
163    }
164   
 
165  118 toggle @Override
166    public void beginList(ListType type, Map<String, String> parameters)
167    {
168  118 getPrinter().println("beginList [" + type + "]" + serializeParameters(parameters));
169    }
170   
 
171  157 toggle @Override
172    public void beginListItem()
173    {
174  157 getPrinter().println("beginListItem");
175    }
176   
 
177  118 toggle @Override
178    public void endList(ListType type, Map<String, String> parameters)
179    {
180  118 getPrinter().println("endList [" + type + "]" + serializeParameters(parameters));
181    }
182   
 
183  157 toggle @Override
184    public void endListItem()
185    {
186  157 getPrinter().println("endListItem");
187    }
188   
 
189  1162 toggle @Override
190    public void onSpace()
191    {
192  1162 getPrinter().println("onSpace");
193    }
194   
 
195  813 toggle @Override
196    public void onSpecialSymbol(char symbol)
197    {
198  813 getPrinter().println("onSpecialSymbol [" + getEscaped(Character.toString(symbol)) + "]");
199    }
200   
 
201  16 toggle @Override
202    public void onRawText(String text, Syntax syntax)
203    {
204  16 getPrinter().println("onRawText [" + text + "] [" + syntax.toIdString() + "]");
205    }
206   
 
207  175 toggle @Override
208    public void beginMacroMarker(String name, Map<String, String> parameters, String content, boolean isInline)
209    {
210  175 printMacroData("beginMacroMarker", name, parameters, content, isInline);
211    }
212   
 
213  175 toggle @Override
214    public void endMacroMarker(String name, Map<String, String> parameters, String content, boolean isInline)
215    {
216  175 printMacroData("endMacroMarker", name, parameters, content, isInline);
217    }
218   
219    /**
220    * {@inheritDoc}
221    *
222    * @since 3.0M2
223    */
 
224  1 toggle @Override
225    public void beginMetaData(MetaData metadata)
226    {
227  1 getPrinter().println("beginMetaData" + serializeParameters(metadata.getMetaData()));
228    }
229   
230    /**
231    * {@inheritDoc}
232    *
233    * @since 3.0M2
234    */
 
235  1 toggle @Override
236    public void endMetaData(MetaData metadata)
237    {
238  1 getPrinter().println("endMetaData" + serializeParameters(metadata.getMetaData()));
239    }
240   
 
241  3 toggle @Override
242    public void onId(String name)
243    {
244  3 getPrinter().println("onId [" + name + "]");
245    }
246   
 
247  14 toggle @Override
248    public void onHorizontalLine(Map<String, String> parameters)
249    {
250  14 getPrinter().println("onHorizontalLine" + serializeParameters(parameters));
251    }
252   
 
253  14 toggle @Override
254    public void onEmptyLines(int count)
255    {
256  14 getPrinter().println("onEmptyLines [" + count + "]");
257    }
258   
 
259  42 toggle @Override
260    public void onVerbatim(String content, boolean inline, Map<String, String> parameters)
261    {
262  42 getPrinter().println(
263    "onVerbatim [" + content + "] [" + inline + "]" + serializeParameters(parameters));
264    }
265   
266    /**
267    * {@inheritDoc}
268    *
269    * @since 2.0RC1
270    */
 
271  37 toggle @Override
272    public void beginDefinitionList(Map<String, String> parameters)
273    {
274  37 getPrinter().println("beginDefinitionList" + serializeParameters(parameters));
275    }
276   
277    /**
278    * {@inheritDoc}
279    *
280    * @since 2.0RC1
281    */
 
282  37 toggle @Override
283    public void endDefinitionList(Map<String, String> parameters)
284    {
285  37 getPrinter().println("endDefinitionList" + serializeParameters(parameters));
286    }
287   
 
288  24 toggle @Override
289    public void beginDefinitionTerm()
290    {
291  24 getPrinter().println("beginDefinitionTerm");
292    }
293   
 
294  32 toggle @Override
295    public void beginDefinitionDescription()
296    {
297  32 getPrinter().println("beginDefinitionDescription");
298    }
299   
 
300  24 toggle @Override
301    public void endDefinitionTerm()
302    {
303  24 getPrinter().println("endDefinitionTerm");
304    }
305   
 
306  32 toggle @Override
307    public void endDefinitionDescription()
308    {
309  32 getPrinter().println("endDefinitionDescription");
310    }
311   
 
312  15 toggle @Override
313    public void beginQuotation(Map<String, String> parameters)
314    {
315  15 getPrinter().println("beginQuotation" + serializeParameters(parameters));
316    }
317   
 
318  15 toggle @Override
319    public void endQuotation(Map<String, String> parameters)
320    {
321  15 getPrinter().println("endQuotation" + serializeParameters(parameters));
322    }
323   
 
324  27 toggle @Override
325    public void beginQuotationLine()
326    {
327  27 getPrinter().println("beginQuotationLine");
328    }
329   
 
330  27 toggle @Override
331    public void endQuotationLine()
332    {
333  27 getPrinter().println("endQuotationLine");
334    }
335   
 
336  29 toggle @Override
337