Clover Coverage Report - XWiki Rendering - Parent POM 4.0-SNAPSHOT (Aggregated)
Coverage timestamp: Mon Mar 12 2012 18:03:13 CET
../../../../img/srcFileCovDistChart8.png 68% of files have more coverage
13   127   9   1.44
0   52   0.69   9
9     1  
1    
 
  HeaderBlock       Line # 32 13 0% 9 5 77.3% 0.77272725
 
  (89)
 
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.block;
21   
22    import java.util.List;
23    import java.util.Map;
24   
25    import org.xwiki.rendering.listener.Listener;
26    import org.xwiki.rendering.listener.HeaderLevel;
27   
28    /**
29    * @version $Id$
30    * @since 1.5M2
31    */
 
32    public class HeaderBlock extends AbstractBlock
33    {
34    /**
35    * The level of the header.
36    */
37    private HeaderLevel level;
38   
39    /**
40    * The id of the header.
41    */
42    private String id;
43   
44    /**
45    * @param childBlocks the children of the header.
46    * @param level the level of the header
47    */
 
48  3 toggle public HeaderBlock(List<Block> childBlocks, HeaderLevel level)
49    {
50  3 super(childBlocks);
51   
52  3 this.level = level;
53    }
54   
55    /**
56    * @param childBlocks the children of the header.
57    * @param level the level of the header
58    * @param parameters the parameters of the header
59    */
 
60  240 toggle public HeaderBlock(List<Block> childBlocks, HeaderLevel level, Map<String, String> parameters)
61    {
62  240 super(childBlocks, parameters);
63   
64  240 this.level = level;
65    }
66   
67    /**
68    * @param childBlocks the children of the header.
69    * @param level the level of the header
70    * @param id the id of the header.
71    */
 
72  0 toggle public HeaderBlock(List<Block> childBlocks, HeaderLevel level, String id)
73    {
74  0 this(childBlocks, level);
75   
76  0 this.id = id;
77    }
78   
79    /**
80    * @param childBlocks the children of the header.
81    * @param level the level of the header
82    * @param parameters the parameters of the header
83    * @param id the id of the header.
84    */
 
85  240 toggle public HeaderBlock(List<Block> childBlocks, HeaderLevel level, Map<String, String> parameters, String id)
86    {
87  240 this(childBlocks, level, parameters);
88   
89  240 this.id = id;
90    }
91   
92    /**
93    * @return the level of the header
94    */
 
95  524 toggle public HeaderLevel getLevel()
96    {
97  524 return this.level;
98    }
99   
100    /**
101    * @return the id of the header.
102    */
 
103  522 toggle public String getId()
104    {
105  522 return this.id;
106    }
107   
108    /**
109    * @return the {@link SectionBlock} corresponding to this header
110    */
 
111  0 toggle public SectionBlock getSection()
112    {
113  0 return (SectionBlock) getParent();
114    }
115   
 
116  240 toggle @Override
117    public void before(Listener listener)
118    {
119  240 listener.beginHeader(getLevel(), getId(), getParameters());
120    }
121   
 
122  240 toggle @Override
123    public void after(Listener listener)
124    {
125  240 listener.endHeader(getLevel(), getId(), getParameters());
126    }
127    }