1. Project Clover database Sat Feb 2 2019 06:45:20 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
105
61
1
512
375
73
0.7
1.72
61
1.2

Classes

Class Line # Actions
EventsChainingRenderer 42 105 0% 73 6
0.968085196.8%
 

Contributing tests

This file is covered by 526 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: 321b49a9e5c0cdd0ca04af75921e1d0bec707727 $
40    * @since 1.8RC1
41    */
 
42    public class EventsChainingRenderer extends AbstractChainingPrintRenderer
43    {
 
44  529 toggle public EventsChainingRenderer(ListenerChain listenerChain)
45    {
46  529 setListenerChain(listenerChain);
47    }
48   
49    // Events
50   
51    /**
52    * {@inheritDoc}
53    *
54    * @since 3.0M2
55    */
 
56  528 toggle @Override
57    public void beginDocument(MetaData metadata)
58    {
59  528 getPrinter().println("beginDocument" + serializeParameters(metadata.getMetaData()));
60    }
61   
62    /**
63    * {@inheritDoc}
64    *
65    * @since 3.0M2
66    */
 
67  528 toggle @Override
68    public void endDocument(MetaData metadata)
69    {
70  528 getPrinter().print("endDocument" + serializeParameters(metadata.getMetaData()));
71    }
72   
 
73  139 toggle @Override
74    public void beginGroup(Map<String, String> parameters)
75    {
76  139 getPrinter().println("beginGroup" + serializeParameters(parameters));
77    }
78   
 
79  139 toggle @Override
80    public void endGroup(Map<String, String> parameters)
81    {
82  139 getPrinter().println("endGroup" + serializeParameters(parameters));
83    }
84   
 
85  362 toggle @Override
86    public void beginFormat(Format format, Map<String, String> parameters)
87    {
88  362 getPrinter().println("beginFormat [" + format + "]" + serializeParameters(parameters));
89    }
90   
 
91  362 toggle @Override
92    public void endFormat(Format format, Map<String, String> parameters)
93    {
94  362 getPrinter().println("endFormat [" + format + "]" + serializeParameters(parameters));
95    }
96   
 
97  463 toggle @Override
98    public void beginParagraph(Map<String, String> parameters)
99    {
100  463 getPrinter().println("beginParagraph" + serializeParameters(parameters));
101    }
102   
 
103  463 toggle @Override
104    public void endParagraph(Map<String, String> parameters)
105    {
106  463 getPrinter().println("endParagraph" + serializeParameters(parameters));
107    }
108   
 
109  290 toggle @Override
110    public void onNewLine()
111    {
112  290 getPrinter().println("onNewLine");
113    }
114   
 
115  169 toggle @Override
116    public void beginLink(ResourceReference reference, boolean freestanding, Map<String, String> parameters)
117    {
118  169 getPrinter().println("beginLink [" + reference + "] [" + freestanding + "]" + serializeParameters(parameters));
119    }
120   
 
121  169 toggle @Override
122    public void endLink(ResourceReference reference, boolean freestanding, Map<String, String> parameters)
123    {
124  169 getPrinter().println("endLink [" + reference + "] [" + freestanding + "]" + serializeParameters(parameters));
125    }
126   
 
127  34 toggle @Override
128    public void onMacro(String id, Map<String, String> parameters, String content, boolean inline)
129    {
130  34 printMacroData("onMacro", id, parameters, content, inline);
131    }
132   
 
133  124 toggle @Override
134    public void beginSection(Map<String, String> parameters)
135    {
136  124 getPrinter().println("beginSection" + serializeParameters(parameters));
137    }
138   
 
139  108 toggle @Override
140    public void beginHeader(HeaderLevel level, String id, Map<String, String> parameters)
141    {
142  108 getPrinter().println("beginHeader [" + level + ", " + id + "]" + serializeParameters(parameters));
143    }
144   
 
145  124 toggle @Override
146    public void endSection(Map<String, String> parameters)
147    {
148  124 getPrinter().println("endSection" + serializeParameters(parameters));
149    }
150   
 
151  108 toggle @Override
152    public void endHeader(HeaderLevel level, String id, Map<String, String> parameters)
153    {
154  108 getPrinter().println("endHeader [" + level + ", " + id + "]" + serializeParameters(parameters));
155    }
156   
 
157  2406 toggle @Override
158    public void onWord(String word)
159    {
160  2406 getPrinter().println("onWord [" + getEscaped(word) + "]");
161    }
162   
 
163  120 toggle @Override
164    public void beginList(ListType type, Map<String, String> parameters)
165    {
166  120 getPrinter().println("beginList [" + type + "]" + serializeParameters(parameters));
167    }
168   
 
169  0 toggle @Override
170    public void beginListItem()
171    {
172  0 getPrinter().println("beginListItem");
173    }
174   
 
175  159 toggle @Override
176    public void beginListItem(Map<String, String> parameters)
177    {
178  159 getPrinter().println("beginListItem" + serializeParameters(parameters));
179    }
180   
 
181  120 toggle @Override
182    public void endList(ListType type, Map<String, String> parameters)
183    {
184  120 getPrinter().println("endList [" + type + "]" + serializeParameters(parameters));
185    }
186   
 
187  0 toggle @Override
188    public void endListItem()
189    {
190  0 getPrinter().println("endListItem");
191    }
192   
 
193  159 toggle @Override
194    public void endListItem(Map<String, String> parameters)
195    {
196  159 getPrinter().println("endListItem" + serializeParameters(parameters));
197    }
198   
 
199  1504 toggle @Override
200    public void onSpace()
201    {
202  1504 getPrinter().println("onSpace");
203    }
204   
 
205  1197 toggle @Override
206    public void onSpecialSymbol(char symbol)
207    {
208  1197 getPrinter().println("onSpecialSymbol [" + getEscaped(Character.toString(symbol)) + "]");
209    }
210   
 
211  16 toggle @Override
212    public void onRawText(String text, Syntax syntax)
213    {
214  16 getPrinter().println("onRawText [" + text + "] [" + syntax.toIdString() + "]");
215    }
216   
 
217  203 toggle @Override
218    public void beginMacroMarker(String name, Map<String, String> parameters, String content, boolean isInline)
219    {
220  203 printMacroData("beginMacroMarker", name, parameters, content, isInline);
221    }
222   
 
223  203 toggle @Override
224    public void endMacroMarker(String name, Map<String, String> parameters, String content, boolean isInline)
225    {
226  203 printMacroData("endMacroMarker", name, parameters, content, isInline);
227    }
228   
229    /**
230    * {@inheritDoc}
231    *
232    * @since 3.0M2
233    */
 
234  31 toggle @Override
235    public void beginMetaData(MetaData metadata)
236    {
237  31 getPrinter().println("beginMetaData" + serializeParameters(metadata.getMetaData()));
238    }
239   
240    /**
241    * {@inheritDoc}
242    *
243    * @since 3.0M2
244    */
 
245  31 toggle @Override
246    public void endMetaData(MetaData metadata)