Clover Coverage Report - XWiki Rendering - Parent POM 4.0-SNAPSHOT (Aggregated)
Coverage timestamp: Mon Mar 12 2012 18:03:13 CET
../../../../../img/srcFileCovDistChart7.png 76% of files have more coverage
7   69   5   1.4
0   30   0.71   5
5     1  
1    
 
  GroupStateChainingListener       Line # 33 7 0% 5 4 66.7% 0.6666667
 
  (326)
 
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    /**
25    * Provides information on whether we're inside a group. Note that this listener is separated from the
26    * {@link org.xwiki.rendering.listener.chaining.BlockStateChainingListener} class because we don't want this listener to
27    * be stackable (since we need to create new instance of stackable listeners to reset states when we encounter
28    * a begin group event but we also need to know we're inside a group).
29    *
30    * @version $Id: 617cb6a834ede7a9a963aa213edf32547895e60e $
31    * @since 1.8.3
32    */
 
33    public class GroupStateChainingListener extends AbstractChainingListener
34    {
35    private int groupDepth;
36   
 
37  346 toggle public GroupStateChainingListener(ListenerChain listenerChain)
38    {
39  346 setListenerChain(listenerChain);
40    }
41   
 
42  0 toggle public int getDocumentDepth()
43    {
44  0 return this.groupDepth;
45    }
46   
 
47  0 toggle public boolean isInGroup()
48    {
49  0 return this.groupDepth > 0;
50    }
51   
52    // Events
53   
 
54  33 toggle @Override
55    public void beginGroup(Map<String, String> parameters)
56    {
57  33 ++this.groupDepth;
58   
59  33 super.beginGroup(parameters);
60    }
61   
 
62  33 toggle @Override
63    public void endGroup(Map<String, String> parameters)
64    {
65  33 super.endGroup(parameters);
66   
67  33 --this.groupDepth;
68    }
69    }