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

File BoxMacroParameters.java

 

Coverage histogram

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

Code metrics

0
10
10
1
153
60
10
1
1
10
1

Classes

Class Line # Actions
BoxMacroParameters 35 10 0% 10 0
1.0100%
 

Contributing tests

This file is covered by 38 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.box;
21   
22    import java.util.List;
23   
24    import org.apache.commons.lang3.StringUtils;
25    import org.xwiki.properties.annotation.PropertyDescription;
26    import org.xwiki.properties.annotation.PropertyHidden;
27    import org.xwiki.rendering.block.Block;
28    import org.xwiki.rendering.listener.reference.ResourceReference;
29   
30    /**
31    * Parameters for the Box macro.
32    *
33    * @version $Id: 3bbf5e3072ba30a893206bc3871f1f93520ed1a3 $
34    */
 
35    public class BoxMacroParameters
36    {
37    /**
38    * @see #getCssClass()
39    */
40    private String cssClass = StringUtils.EMPTY;
41   
42    /**
43    * @see #getTitle()
44    */
45    private String title = StringUtils.EMPTY;
46   
47    /**
48    * @see #getImage()
49    */
50    private ResourceReference imageReference;
51   
52    /**
53    * @see #getWidth()
54    */
55    private String width = StringUtils.EMPTY;
56   
57    /**
58    * @see #getTitle()
59    */
60    private List<? extends Block> blockTitle;
61   
62    /**
63    * Optionally, the title can contain a list of Blocks, for more flexibility, instead of storing only ordinary text.
64    *
65    * @return the title represented as a list of Blocks
66    */
 
67  195 toggle public List<? extends Block> getBlockTitle()
68    {
69  195 return this.blockTitle;
70    }
71   
72    /**
73    * @param blockTitle - refer to {@link #getBlockTitle()}
74    */
 
75  4 toggle @PropertyHidden
76    public void setBlockTitle(List<? extends Block> blockTitle)
77    {
78  4 this.blockTitle = blockTitle;
79    }
80   
81    /**
82    * @return the title to be displayed in the message box. Note that it can contain content in the current syntax and
83    * that text which will be parsed and rendered as any syntax content
84    */
 
85  248 toggle public String getTitle()
86    {
87  248 return this.title;
88    }
89   
90    /**
91    * @param title refer to {@link #getTitle()}
92    */
 
93  133 toggle @PropertyDescription("the title which is to be displayed in the message box")
94    public void setTitle(String title)
95    {
96  133 this.title = title;
97    }
98   
99    /**
100    * @return the reference to the image to display in the message box.
101    */
 
102  248 toggle public ResourceReference getImage()
103    {
104  248 return this.imageReference;
105    }
106   
107    /**
108    * @param imageReference see {@link #getImage()}
109    */
 
110  5 toggle @PropertyDescription("the reference to the image to display in the message box")
111    public void setImage(ResourceReference imageReference)
112    {
113  5 this.imageReference = imageReference;
114    }
115   
116    /**
117    * @return an optional {@code class} parameter value to use when rendering the Box. The XHTML renderer for example
118    * uses it on the surrounding {@code SPAN} (in case the box is used inline) or on the surrounding
119    * {@code DIV} (in case the box is used standalone). This allows the user to provide CSS to style the box
120    * according to his needs. Example: {@code cssClass="mybox"}. If not specified, the
121    * {@code BoxMacro.getClassProperty()} is used to provide a default one.
122    */
 
123  248 toggle public String getCssClass()
124    {
125  248 return this.cssClass;
126    }
127   
128    /**
129    * @param cssClass refer to {@link BoxMacroParameters#getCssClass()}
130    */
 
131  154 toggle @PropertyDescription("A CSS class to add to the box element")
132    public void setCssClass(String cssClass)
133    {
134  154 this.cssClass = cssClass;
135    }
136   
137    /**
138    * @return an optional width to enforce as an inline style on the DIV element the box will be formed of.
139    */
 
140  249 toggle public String getWidth()
141    {
142  249 return this.width;
143    }
144   
145    /**
146    * @param width refer to {@link BoxMacroParameters#getWidth()}
147    */
 
148  1 toggle @PropertyDescription("An optional width for the box, expressed in px or %")
149    public void setWidth(String width)
150    {
151  1 this.width = width;
152    }
153    }