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
10   73   7   2
4   40   0.7   5
5     1.4  
1    
 
  ListItemTagHandler       Line # 28 10 0% 7 1 94.7% 0.94736844
 
  (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;
23   
24    /**
25    * @version $Id: caa718c7d7f223de92fda62c109091333c78f341 $
26    * @since 4.0M1
27    */
 
28    public class ListItemTagHandler extends TagHandler
29    {
 
30  309 toggle public ListItemTagHandler()
31    {
32  309 super(true, false, true);
33    }
34   
 
35  618 toggle public ListItemTagHandler(
36    boolean documentContainer,
37    boolean requiresDocument,
38    boolean contentContainer)
39    {
40  618 super(documentContainer, requiresDocument, contentContainer);
41    }
42   
 
43  75 toggle @Override
44    public void begin(XhtmlHandler.TagStack.TagContext context)
45    {
46  75 String markup = context.getParent().getName().equals("ol") ? "#" : "*";
47  75 begin(markup, context);
48    }
49   
 
50  114 toggle protected void begin(String markup, XhtmlHandler.TagStack.TagContext context)
51    {
52  114 StringBuffer listStyles = (StringBuffer) context
53    .getTagStack()
54    .getStackParameter("listStyles");
55  114 listStyles.append(markup);
56  114 context.getScannerContext().beginListItem(listStyles.toString());
57    }
58   
 
59  114 toggle @Override
60    public void end(XhtmlHandler.TagStack.TagContext context)
61    {
62  114 StringBuffer listStyles = (StringBuffer) context
63    .getTagStack()
64    .getStackParameter("listStyles");
65    // We should always have a length greater than 0 but we handle
66    // the case where the user has entered some badly formed HTML
67  114 if (listStyles.length() > 0) {
68  114 listStyles.setLength(listStyles.length() - 1);
69    }
70    // Note: Do not generate an endListItem() event since it'll be generated
71    // automatically by the next element.
72    }
73    }