Clover Coverage Report - XWiki Rendering - Parent POM 4.0-SNAPSHOT (Aggregated)
Coverage timestamp: Mon Mar 12 2012 18:03:13 CET
../../../../../img/srcFileCovDistChart10.png 0% of files have more coverage
12   127   10   1.2
0   83   0.83   10
10     1  
1    
 
  WemDocumentTagNotifier       Line # 31 12 0% 10 0 100% 1.0
 
No Tests
 
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.wikimodel.xml;
21   
22    import java.util.Map;
23   
24    import org.xwiki.rendering.wikimodel.IWemListenerDocument;
25    import org.xwiki.rendering.wikimodel.WikiParameters;
26   
27    /**
28    * @version $Id: c614de7c86b202c814db4d0528d7571a3883fb7c $
29    * @since 4.0M1
30    */
 
31    public class WemDocumentTagNotifier extends AbstractTagNotifier
32    implements
33    IWemListenerDocument
34    {
35    private int fSectionDepth;
36   
37    /**
38    * @param listener
39    */
 
40  6 toggle public WemDocumentTagNotifier(ITagListener listener)
41    {
42  6 super(listener);
43    }
44   
 
45  6 toggle public void beginDocument(WikiParameters params)
46    {
47  6 fListener.beginTag(DOCUMENT, tagParams(), userParams(params));
48    }
49   
 
50  3 toggle public void beginHeader(int headerLevel, WikiParameters params)
51    {
52  3 fListener.beginTag(
53    HEADER,
54    tagParams(HEADER_LEVEL, "" + headerLevel),
55    userParams(params));
56    }
57   
 
58  9 toggle public void beginSection(
59    int docLevel,
60    int headerLevel,
61    WikiParameters params)
62    {
63  9 fSectionDepth++;
64  9 fListener.beginTag(
65    SECTION,
66    getSectionParams(docLevel, headerLevel),
67    userParams(params));
68    }
69   
 
70  9 toggle public void beginSectionContent(
71    int docLevel,
72    int headerLevel,
73    WikiParameters params)
74    {
75  9 fListener.beginTag(SECTION_CONTENT, getSectionParams(
76    docLevel,
77    headerLevel), userParams(params));
78    }
79   
 
80  6 toggle public void endDocument(WikiParameters params)
81    {
82  6 fListener.endTag(DOCUMENT, tagParams(), userParams(params));
83    }
84   
 
85  3 toggle public void endHeader(int headerLevel, WikiParameters params)
86    {
87  3 fListener.endTag(
88    HEADER,
89    tagParams(HEADER_LEVEL, "" + headerLevel),
90    userParams(params));
91    }
92   
 
93  9 toggle public void endSection(int docLevel, int headerLevel, WikiParameters params)
94    {
95  9 fListener.endTag(
96    SECTION,
97    getSectionParams(docLevel, headerLevel),
98    userParams(params));
99  9 fSectionDepth--;
100    }
101   
 
102  9 toggle public void endSectionContent(
103    int docLevel,
104    int headerLevel,
105    WikiParameters params)
106    {
107  9 fListener.endTag(SECTION_CONTENT, getSectionParams(
108    docLevel,
109    headerLevel), userParams(params));
110    }
111   
112    /**
113    * @param docLevel
114    * @param headerLevel
115    * @return
116    */
 
117  36 toggle private Map<String, String> getSectionParams(int docLevel, int headerLevel)
118    {
119  36 return tagParams(
120    SECTION_LEVEL,
121    "" + fSectionDepth,
122    SECTION_DOC_LEVEL,
123    "" + docLevel,
124    SECTION_HEADER_LEVEL,
125    "" + headerLevel);
126    }
127    }