1. Project Clover database Tue Dec 20 2016 21:24:09 CET
  2. Package org.xwiki.rendering.macro.toc

File TocMacroParameters.java

 

Coverage histogram

../../../../../img/srcFileCovDistChart10.png
0% of files have more coverage

Code metrics

0
10
9
2
158
61
9
0.9
1.11
4.5
1

Classes

Class Line # Actions
TocMacroParameters 32 10 0% 9 0
1.0100%
TocMacroParameters.Scope 37 0 - 0 0
-1.0 -
 

Contributing tests

This file is covered by 20 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.macro.toc;
21   
22    import javax.validation.constraints.Min;
23   
24    import org.xwiki.properties.annotation.PropertyDescription;
25   
26    /**
27    * Parameters for the {@link org.xwiki.rendering.internal.macro.toc.TocMacro} Macro.
28    *
29    * @version $Id: d9bd8987cc8b95fe524e56a0ee5cad9799a4a7f4 $
30    * @since 1.6M1
31    */
 
32    public class TocMacroParameters
33    {
34    /**
35    * @version $Id: d9bd8987cc8b95fe524e56a0ee5cad9799a4a7f4 $
36    */
 
37    public enum Scope
38    {
39    /**
40    * List section starting where macro block is located in the XDOM.
41    */
42    LOCAL,
43   
44    /**
45    * List the sections of the whole page.
46    */
47    PAGE
48    }
49   
50    /**
51    * The minimum section level. For example if 2 then level 1 sections will not be listed.
52    */
53    @Min(1)
54    private int start = 1;
55   
56    /**
57    * Indicate if the start has been set or if it has the default value.
58    */
59    private boolean customStart;
60   
61    /**
62    * The maximum section level. For example if 3 then all section levels from 4 will not be listed.
63    */
64    @Min(1)
65    private int depth = 6;
66   
67    /**
68    * If local only section in the current scope will be listed. For example if the macro is written in a section, only
69    * subsections of this section will be listed.
70    */
71    private Scope scope = Scope.PAGE;
72   
73    /**
74    * If true the section title number is printed.
75    */
76    private boolean numbered;
77   
78    /**
79    * @param start the minimum section level. For example if 2 then level 1 sections will not be listed.
80    */
 
81  9 toggle @PropertyDescription("the minimum section level. For example if 2 then level 1 sections will not be listed")
82    public void setStart(int start)
83    {
84  9 this.start = start;
85  9 this.customStart = true;
86    }
87   
88    /**
89    * @return the minimum section level. For example if 2 then level 1 sections will not be listed.
90    */
 
91  46 toggle public int getStart()
92    {
93  46 return this.start;
94    }
95   
96    /**
97    * @return indicate if the start has been set or if it has the default value.
98    */
 
99  4 toggle public boolean isCustomStart()
100    {
101  4 return this.customStart;
102    }
103   
104    /**
105    * @param depth the maximum section level. For example if 3 then all section levels from 4 will not be listed.
106    */
 
107  8 toggle @PropertyDescription("the maximum section level. "
108    + "For example if 3 then all section levels from 4 will not be listed")
109    public void setDepth(int depth)
110    {
111  8 this.depth = depth;
112    }
113   
114    /**
115    * @return the maximum section level. For example if 3 then all section levels from 4 will not be listed.
116    */
 
117  46 toggle public int getDepth()
118    {
119  46 return this.depth;
120    }
121   
122    /**
123    * @param scope If local only section in the current scope will be listed. For example if the macro is written in a
124    * section, only subsections of this section will be listed.
125    */
 
126  9 toggle @PropertyDescription("if local only section in the current scope will be listed. "
127    + "For example if the macro is written in a section, only subsections of this section will be listed")
128    public void setScope(Scope scope)
129    {
130  9 this.scope = scope;
131    }
132   
133    /**
134    * @return if {@link Scope#LOCAL} only section in the current scope will be listed. For example if the macro is
135    * written in a section, only subsections of this section will be listed.
136    */
 
137  46 toggle public Scope getScope()
138    {
139  46 return this.scope;
140    }
141   
142    /**
143    * @param numbered if true the section title number is printed.
144    */
 
145  7 toggle @PropertyDescription("if true the section title number is printed")
146    public void setNumbered(boolean numbered)
147    {
148  7 this.numbered = numbered;
149    }
150   
151    /**
152    * @return if true the section title number is printed.
153    */
 
154  46 toggle public boolean isNumbered()
155    {
156  46 return this.numbered;
157    }
158    }