Clover Coverage Report - XWiki Rendering - Parent POM 4.0-SNAPSHOT (Aggregated)
Coverage timestamp: Mon Mar 12 2012 18:03:13 CET
../../../../img/srcFileCovDistChart9.png 55% of files have more coverage
11   126   8   1.38
0   49   0.73   8
8     1  
1    
 
  MacroMarkerBlock       Line # 35 11 0% 8 2 89.5% 0.8947368
 
  (109)
 
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   
27    /**
28    * A special block that Macro Blocks generate when they are executed so that it's possible to reconstruct the initial
29    * syntax even after Macros have been executed. For example this is important in a WYSWIYG editor where you want to show
30    * the Macro's rendered result and also let users modify the macro content.
31    *
32    * @version $Id$
33    * @since 1.5M2
34    */
 
35    public class MacroMarkerBlock extends AbstractBlock
36    {
37    /**
38    * The macro name that we are preserving.
39    */
40    private String id;
41   
42    /**
43    * The macro content that we are preserving.
44    */
45    private String content;
46   
47    /**
48    * The macro is located in a inline content (like paragraph, etc.).
49    */
50    private boolean isInline;
51   
52    /**
53    * @param id the name of the macro
54    * @param parameters the parameters of the macro
55    * @param childBlocks the list of children blocks generated by the macro
56    * @param isInline indicate if the macro is located in a inline content (like paragraph, etc.)
57    */
 
58  3 toggle public MacroMarkerBlock(String id, Map<String, String> parameters, List<Block> childBlocks, boolean isInline)
59    {
60  3 this(id, parameters, null, childBlocks, isInline);
61    }
62   
63    /**
64    * @param id the name of the macro
65    * @param parameters the parameters of the macro
66    * @param content the content of the macro. Null if the macro does not have content
67    * @param childBlocks the list of children blocks generated by the macro
68    * @param isInline indicate if the macro is located in a inline content (like paragraph, etc.)
69    */
 
70  1159 toggle public MacroMarkerBlock(String id, Map<String, String> parameters, String content, List<Block> childBlocks,
71    boolean isInline)
72    {
73  1159 super(childBlocks, parameters);
74   
75  1159 this.id = id;
76  1159 this.content = content;
77  1159 this.isInline = isInline;
78    }
79   
80    /**
81    * @return the macro name.
82    * @deprecated since 2.4M1 use {@link #getId()} instead
83    */
 
84  0 toggle @Deprecated
85    public String getName()
86    {
87  0 return getId();
88    }
89   
90    /**
91    * @return the macro identifier.
92    * @since 2.4M1
93    */
 
94  2299 toggle public String getId()
95    {
96  2299 return this.id;
97    }
98   
99    /**
100    * @return the macro content.
101    */
 
102  2296 toggle public String getContent()
103    {
104  2296 return this.content;
105    }
106   
107    /**
108    * @return if true the macro is located in a inline content (like paragraph, etc.).
109    */
 
110  2294 toggle public boolean isInline()
111    {
112  2294 return this.isInline;
113    }
114   
 
115  1147 toggle @Override
116    public void before(Listener listener)
117    {
118  1147 listener.beginMacroMarker(getId(), getParameters(), getContent(), isInline());
119    }
120   
 
121  1147 toggle @Override
122    public void after(Listener listener)
123    {
124  1147 listener.endMacroMarker(getId(), getParameters(), getContent(), isInline());
125    }
126    }