1. Project Clover database Tue Dec 20 2016 21:24:09 CET
  2. Package org.xwiki.rendering.listener.chaining

File EventType.java

 

Coverage histogram

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

Code metrics

0
63
63
1
645
438
63
1
1
63
1

Classes

Class Line # Actions
EventType 38 63 0% 63 10
0.920634992.1%
 

Contributing tests

This file is covered by 484 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.listener.chaining;
21   
22    import java.util.Map;
23   
24    import org.xwiki.rendering.listener.Format;
25    import org.xwiki.rendering.listener.HeaderLevel;
26    import org.xwiki.rendering.listener.ListType;
27    import org.xwiki.rendering.listener.Listener;
28    import org.xwiki.rendering.listener.MetaData;
29    import org.xwiki.rendering.listener.reference.ResourceReference;
30    import org.xwiki.rendering.syntax.Syntax;
31   
32    /**
33    * Stores event types and offers a way to call a stored event.
34    *
35    * @version $Id: 378dc8de5257dae4608a98ba2f01396fd5c8bf92 $
36    * @since 1.8RC1
37    */
 
38    public enum EventType
39    {
40    /**
41    * @see Listener#beginDocument(org.xwiki.rendering.listener.MetaData)
42    */
43    BEGIN_DOCUMENT {
 
44  429 toggle @Override
45    public void fireEvent(Listener listener, Object[] eventParameters)
46    {
47  429 listener.beginDocument((MetaData) eventParameters[0]);
48    }
49    },
50    /**
51    * @see Listener#endDocument(org.xwiki.rendering.listener.MetaData)
52    */
53    END_DOCUMENT {
 
54  644 toggle @Override
55    public void fireEvent(Listener listener, Object[] eventParameters)
56    {
57  644 listener.endDocument((MetaData) eventParameters[0]);
58    }
59    },
60    /**
61    * @see Listener#beginGroup(java.util.Map)
62    */
63    BEGIN_GROUP {
 
64  29 toggle @Override
65    public void fireEvent(Listener listener, Object[] eventParameters)
66    {
67  29 listener.beginGroup((Map<String, String>) eventParameters[0]);
68    }
69    },
70    /**
71    * @see Listener#endGroup(java.util.Map)
72    */
73    END_GROUP {
 
74  29 toggle @Override
75    public void fireEvent(Listener listener, Object[] eventParameters)
76    {
77  29 listener.endGroup((Map<String, String>) eventParameters[0]);
78    }
79   
 
80  0 toggle @Override
81    public boolean isInlineEnd()
82    {
83  0 return true;
84    }
85    },
86    /**
87    * @see Listener#beginParagraph(java.util.Map)
88    */
89    BEGIN_PARAGRAPH {
 
90  424 toggle @Override
91    public void fireEvent(Listener listener, Object[] eventParameters)
92    {
93  424 listener.beginParagraph((Map<String, String>) eventParameters[0]);
94    }
95    },
96    /**
97    * @see Listener#endParagraph(java.util.Map)
98    */
99    END_PARAGRAPH {
 
100  421 toggle @Override
101    public void fireEvent(Listener listener, Object[] eventParameters)
102    {
103  421 listener.endParagraph((Map<String, String>) eventParameters[0]);
104    }
105   
 
106  1 toggle @Override
107    public boolean isInlineEnd()
108    {
109  1 return true;
110    }
111    },
112    /**
113    * @see Listener#beginDefinitionList(java.util.Map)
114    */
115    BEGIN_DEFINITION_LIST {
 
116  22 toggle @Override
117    public void fireEvent(Listener listener, Object[] eventParameters)
118    {
119  22 listener.beginDefinitionList((Map<String, String>) eventParameters[0]);
120    }
121   
 
122  0 toggle @Override
123    public boolean isInlineEnd()
124    {
125    // This is because for nested definition lists, the event after a definition list item content is a new
126    // definition list
127  0 return true;
128    }
129    },
130    /**
131    * @see Listener#endDefinitionList(java.util.Map)
132    */
133    END_DEFINITION_LIST {
 
134  22 toggle @Override
135    public void fireEvent(Listener listener, Object[] eventParameters)
136    {
137  22 listener.endDefinitionList((Map<String, String>) eventParameters[0]);
138    }
139    },
140    /**
141    * @see Listener#beginDefinitionTerm()
142    */
143    BEGIN_DEFINITION_TERM {
 
144  17 toggle @Override
145    public void fireEvent(Listener listener, Object[] eventParameters)
146    {
147  17 listener.beginDefinitionTerm();
148    }
149    },
150    /**
151    * @see Listener#endDefinitionTerm()
152    */
153    END_DEFINITION_TERM {
 
154  17 toggle @Override
155    public void fireEvent(Listener listener, Object[] eventParameters)
156    {
157  17 listener.endDefinitionTerm();
158    }
159   
 
160  1 toggle @Override
161    public boolean isInlineEnd()
162    {
163  1 return true;
164    }
165    },
166    /**
167    * @see Listener#beginDefinitionDescription()
168    */
169    BEGIN_DEFINITION_DESCRIPTION {
 
170  21 toggle @Override
171    public void fireEvent(Listener listener, Object[] eventParameters)
172    {
173  21 listener.beginDefinitionDescription();
174    }
175    },
176    /**
177    * @see Listener#endDefinitionDescription()
178    */
179    END_DEFINITION_DESCRIPTION {
 
180  21 toggle @Override
181    public void fireEvent(Listener listener, Object[] eventParameters)
182    {
183  21 listener.endDefinitionDescription();
184    }
185   
 
186  1 toggle @Override
187    public boolean isInlineEnd()
188    {
189  1 return true;
190    }
191    },
192    /**
193    * @see Listener#beginFormat(org.xwiki.rendering.listener.Format, java.util.Map)
194    */
195    BEGIN_FORMAT {
 
196  184 toggle @Override
197    public void fireEvent(Listener listener, Object[] eventParameters)
198    {
199  184 listener.beginFormat((Format) eventParameters[0], (Map<String, String>) eventParameters[1]);
200    }
201    },
202    /**
203    * @see Listener#endFormat(org.xwiki.rendering.listener.Format, java.util.Map)
204    */
205    END_FORMAT {
 
206  184 toggle @Override
207    public void fireEvent(Listener listener, Object[] eventParameters)
208    {
209  184 listener.endFormat((Format) eventParameters[0], (Map<String, String>) eventParameters[1]);
210    }
211    },
212    /**
213    * @see Listener#beginHeader(org.xwiki.rendering.listener.HeaderLevel, String, java.util.Map)
214    */
215    BEGIN_HEADER {
 
216  60 toggle @Override
217    public void fireEvent(Listener listener, Object[] eventParameters)
218    {
219  60 listener.beginHeader((HeaderLevel) eventParameters[0], (String) eventParameters[1],
220    (Map<String, String>) eventParameters[2]);
221    }
222    },
223    /**
224    * @see Listener#endHeader(org.xwiki.rendering.listener.HeaderLevel, String, java.util.Map)
225    */
226    END_HEADER {
 
227  60 toggle @Override
228    public void fireEvent(Listener listener, Object[] eventParameters)
229    {
230  60 listener.endHeader((HeaderLevel) eventParameters[0], (String) eventParameters[1],
231    (Map<String, String>) eventParameters[2]);
232    }
233    },
234    /**
235    * @see Listener#beginLink(org.xwiki.rendering.listener.reference.ResourceReference, boolean, java.util.Map)
236    */
237    BEGIN_LINK {
 
238  178 toggle @Override
239    public void fireEvent(Listener listener, Object[] eventParameters)
240    {
241  178 listener.beginLink((ResourceReference) eventParameters[0], (Boolean) eventParameters[1],
242    (Map<String, String>) eventParameters[2]);
243    }
244    },
245    /**
246    * @see Listener#endLink(org.xwiki.rendering.listener.reference.ResourceReference, boolean, java.util.Map)
247    */
248    END_LINK {
 
249  176 toggle @Override
250    public void fireEvent(Listener listener, Object[] eventParameters)
251    {
252  176 listener.endLink((ResourceReference) eventParameters[0], (Boolean) eventParameters[1],
253    (Map<String, String>) eventParameters[2]);
254    }
255    },
256    /**
257    * @see Listener#beginList(org.xwiki.rendering.listener.ListType, java.util.Map)
258    */
259    BEGIN_LIST {
 
260  64 toggle @Override
261    public void fireEvent(Listener listener, Object[] eventParameters)
262    {
263  64 listener.beginList((ListType) eventParameters[0], (Map<String, String>) eventParameters[1]);
264    }
265   
 
266  1 toggle @Override
267    public boolean isInlineEnd()
268    {
269    // This is because for nested lists, the event after list item content is a new list
270  1 return true;
271    }
272    },
273    /**
274    * @see Listener#endList(org.xwiki.rendering.listener.ListType, java.util.Map)
275    */
276    END_LIST {
 
277  64 toggle @Override
278    public void fireEvent(Listener listener, Object[] eventParameters)
279    {
280  64 listener.endList((ListType) eventParameters[0], (Map<String, String>) eventParameters[1]);
281    }
282    },
283    /**
284    * @see org.xwiki.rendering.listener.Listener#beginListItem()
285    */
286    BEGIN_LIST_ITEM {
 
287  94 toggle @Override
288    public void fireEvent(Listener listener, Object[] eventParameters)
289    {
290  94 listener.beginListItem();
291    }
292    },
293    /**
294    * @see org.xwiki.rendering.listener.Listener#endListItem()
295    */
296    END_LIST_ITEM {
 
297  94 toggle @Override
298    public void fireEvent(Listener listener, Object[] eventParameters)
299    {
300  94 listener.endListItem();
301    }
302   
 
303  1 toggle @Override
304    public boolean isInlineEnd()
305    {
306  1 return true;
307    }
308    },
309    /**
310    * @see Listener#beginMacroMarker(String, java.util.Map, String, boolean)
311    */
312    BEGIN_MACRO_MARKER {
 
313  47 toggle @Override
314    public void fireEvent(Listener listener, Object[] eventParameters)
315    {
316  47 listener.beginMacroMarker((String) eventParameters[0], (Map<String, String>) eventParameters[1],
317    (String) eventParameters[2], (Boolean) eventParameters[3]);
318    }
319    },
320    /**
321    * @see Listener#endMacroMarker(String, java.util.Map, String, boolean)
322    */
323    END_MACRO_MARKER {
 
324  47 toggle @Override
325    public void fireEvent(Listener listener, Object[] eventParameters)
326    {
327  47 listener.endMacroMarker((String) eventParameters[0], (Map<String, String>) eventParameters[1],
328    (String) eventParameters[2], (Boolean) eventParameters[3]);
329    }
330    },
331    /**
332    * @see Listener#beginQuotation(java.util.Map)
333    */
334    BEGIN_QUOTATION {
 
335  11 toggle @Override
336    public void fireEvent(Listener listener, Object[] eventParameters)
337    {
338  11 listener.beginQuotation((Map<String, String>) eventParameters[0]);
339    }
340   
 
341  0 toggle @Override
342    public boolean isInlineEnd()
343    {
344    // This is because for nested quotations, the event after a quotation line is a new quotation
345  0 return true;
346    }
347    },
348    /**
349    * @see Listener#endQuotation(java.util.Map)
350    */
351    END_QUOTATION {
 
352  11 toggle @Override
353    public void fireEvent(Listener listener, Object[] eventParameters)
354    {
355  11 listener.endQuotation((Map<String, String>) eventParameters[0]);
356    }
357    },
358    /**
359    * @see org.xwiki.rendering.listener.Listener#beginQuotationLine()
360    */
361    BEGIN_QUOTATION_LINE {
 
362  17 toggle @Override
363    public void fireEvent(Listener listener, Object[] eventParameters)
364    {
365  17 listener.beginQuotationLine();
366    }
367    },
368    /**
369    * @see org.xwiki.rendering.listener.Listener#endQuotationLine()
370    */
371    END_QUOTATION_LINE {
 
372  17 toggle @Override
373    public void fireEvent(Listener listener, Object[] eventParameters)
374    {
375  17 listener.endQuotationLine();
376    }
377   
 
378  1 toggle @Override