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
7   71   5   1.75
2   34   0.71   4
4     1.25  
1    
 
  ListTagHandler       Line # 28 7 0% 5 0 100% 1.0
 
  (219)
 
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.xhtml.handler;
21   
22    import org.xwiki.rendering.wikimodel.xhtml.impl.XhtmlHandler.TagStack.TagContext;
23   
24    /**
25    * @version $Id: 477ac52bdb2c59f218eee025c22722ee72e1b9c8 $
26    * @since 4.0M1
27    */
 
28    public class ListTagHandler extends TagHandler
29    {
 
30  309 toggle public ListTagHandler()
31    {
32  309 super(false, true, false);
33    }
34   
 
35  154 toggle @Override
36    public boolean isBlockHandler(TagContext context)
37    {
38    // A new list is considered a block element only if the parent is not a
39    // list item since nested lists
40    // are not new block elements
41  154 return !(context.getParent().getName().equals("li")
42    || context.getParent().getName().equals("dd") || context
43    .getParent()
44    .getName()
45    .equals("dt"));
46    }
47   
 
48  77 toggle @Override
49    protected void begin(TagContext context)
50    {
51  77 sendEmptyLines(context);
52    // We only send a new list event if we're not already inside a list.
53  77 context.getScannerContext().beginList(context.getParams());
54    }
55   
 
56  77 toggle @Override
57    protected void end(TagContext context)
58    {
59    // We only need to close the list if we're on the last list item.
60    // Note that we need to close the list explicitely and not wait for the
61    // next element to close it
62    // since the next element could be an implicit paragraph.
63    // For example: <html><ul><li>item</li></ul>a</html>
64  77 StringBuffer listStyles = (StringBuffer) context
65    .getTagStack()
66    .getStackParameter("listStyles");
67  77 if (listStyles.length() == 0) {
68  51 context.getScannerContext().endList();
69    }
70    }
71    }