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

File Gadget.java

 

Coverage histogram

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

Code metrics

0
14
11
1
158
58
11
0.79
1.27
11
1

Classes

Class Line # Actions
Gadget 32 14 0% 11 0
1.0100%
 

Contributing tests

This file is covered by 2 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.dashboard;
21   
22    import java.util.List;
23   
24    import org.xwiki.rendering.block.Block;
25   
26    /**
27    * Abstraction for a gadget to put on a dashboard, to contain its title, content and position.
28    *
29    * @version $Id: 914af736ee7d14cb54a4583a0b7a788b356ad204 $
30    * @since 3.0M3
31    */
 
32    public class Gadget
33    {
34    /**
35    * The identifier of this gadget, to render in the content.
36    */
37    private String id;
38   
39    /**
40    * The title of this gadget.
41    */
42    private List<Block> title;
43   
44    /**
45    * The content of this gadget.
46    */
47    private List<Block> content;
48   
49    /**
50    * The position of this gadget, to be interpreted by the layouter.
51    */
52    private String position;
53   
54    /**
55    * The string source of the title of this gadget, to make it editable further. <br/>
56    * FIXME: this should be passed in a different way, potentially in metadata block attached to the title block. FTM,
57    * to make it backwards compatible, keep it like this.
58    */
59    private String titleSource;
60   
61    /**
62    * Creates a gadget from a title, content and position.
63    *
64    * @param id the id of this gadget
65    * @param title the title of the gadget
66    * @param content the content of the gadget
67    * @param position the position of the gadget
68    */
 
69  28 toggle public Gadget(String id, List<Block> title, List<Block> content, String position)
70    {
71  28 this.setId(id);
72  28 this.setTitle(title);
73  28 this.setContent(content);
74  28 this.setPosition(position);
75    }
76   
77    /**
78    * @return the title
79    */
 
80  26 toggle public List<Block> getTitle()
81    {
82  26 return title;
83    }
84   
85    /**
86    * @param title the title to set
87    */
 
88  28 toggle public void setTitle(List<Block> title)
89    {
90  28 this.title = title;
91    }
92   
93    /**
94    * @return the content
95    */
 
96  44 toggle public List<Block> getContent()
97    {
98  44 return content;
99    }
100   
101    /**
102    * @param content the content to set
103    */
 
104  28 toggle public void setContent(List<Block> content)
105    {
106  28 this.content = content;
107    }
108   
109    /**
110    * @return the position
111    */
 
112  13 toggle public String getPosition()
113    {
114  13 return position;
115    }
116   
117    /**
118    * @param position the position to set
119    */
 
120  28 toggle public void setPosition(String position)
121    {
122  28 this.position = position;
123    }
124   
125    /**
126    * @return the id of this gadget, to render in the content
127    */
 
128  26 toggle public String getId()
129    {
130  26 return id;
131    }
132   
133    /**
134    * @param id the id to set to this gadget
135    */
 
136  28 toggle public void setId(String id)
137    {
138  28 this.id = id;
139    }
140   
141    /**
142    * @return the titleSource
143    * FIXME: this should be passed in a different way, potentially in metadata block attached to the title block. FTM,
144    * to make it backwards compatible, keep it like this.
145    */
 
146  14 toggle public String getTitleSource()
147    {
148  14 return titleSource;
149    }
150   
151    /**
152    * @param titleSource the titleSource to set
153    */
 
154  24 toggle public void setTitleSource(String titleSource)
155    {
156  24 this.titleSource = titleSource;
157    }
158    }