1. Project Clover database Sat Feb 2 2019 06:45:20 CET
  2. Package org.xwiki.rendering.internal.renderer.xwiki20

File ListItemStackingInlineContentChainingListener.java

 

Coverage histogram

../../../../../../img/srcFileCovDistChart8.png
56% of files have more coverage

Code metrics

2
13
7
1
87
47
8
0.62
1.86
7
1.14

Classes

Class Line # Actions
ListItemStackingInlineContentChainingListener 33 13 0% 8 6
0.7272727572.7%
 

Contributing tests

This file is covered by 28 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.xwiki20;
21   
22    import java.util.Map;
23   
24    import org.xwiki.rendering.listener.chaining.ListenerChain;
25   
26    /**
27    * Stack list item blocks until there's some standalone elements or the {@link #endListItem(Map)} (Map)} event is called
28    * which marks the end of the handling of the list item content.
29    *
30    * @version $Id: 7a1429e69f70823ebada48e6156c302e3e1710cd $
31    * @since 10.5RC1
32    */
 
33    public class ListItemStackingInlineContentChainingListener extends AbstractStackingInlineContentChainingListener
34    {
35    private int listItemDepth;
36   
37    /**
38    * @param listenerChain the listener chain to save
39    */
 
40  104 toggle public ListItemStackingInlineContentChainingListener(ListenerChain listenerChain)
41    {
42  104 super(listenerChain);
43    }
44   
 
45  153 toggle @Override
46    public void beginListItem(Map<String, String> parameters)
47    {
48  153 handleBeginListItem();
49  153 super.beginListItem(parameters);
50    }
51   
 
52  0 toggle @Override
53    public void beginListItem()
54    {
55  0 handleBeginListItem();
56  0 super.beginListItem();
57    }
58   
 
59  308 toggle @Override
60    public void endListItem()
61    {
62  308 super.endListItem();
63  308 handleEndListItem();
64    }
65   
 
66  0 toggle @Override
67    public void endListItem(Map<String, String> parameters)
68    {
69  0 super.endListItem(parameters);
70  0 handleEndListItem();
71    }
72   
 
73  153 toggle private void handleBeginListItem()
74    {
75  153 this.listItemDepth++;
76    }
77   
 
78  308 toggle private void handleEndListItem()
79    {
80    // Should we stop stacking?
81  308 if (this.listItemDepth == 0) {
82  172 stopStacking();
83    } else {
84  136 this.listItemDepth--;
85    }
86    }
87    }