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

File IconSet.java

 

Coverage histogram

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

Code metrics

0
18
18
1
206
88
18
1
1
18
1

Classes

Class Line # Actions
IconSet 33 18 0% 18 0
1.0100%
 

Contributing tests

This file is covered by 33 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.icon;
21   
22    import java.util.ArrayList;
23    import java.util.HashMap;
24    import java.util.List;
25    import java.util.Map;
26   
27    /**
28    * A collection of icons, with some properties to display them.
29    *
30    * @since 6.2M1
31    * @version $Id: c03a0129e5ed188c6759c267db7b6263f09539df $
32    */
 
33    public class IconSet
34    {
35    private String name;
36   
37    private Map<String, Icon> iconMap = new HashMap<>();
38   
39    private String css;
40   
41    private String ssx;
42   
43    private String jsx;
44   
45    private String renderWiki;
46   
47    private String renderHTML;
48   
49    private IconType type;
50   
51    /**
52    * Constructor.
53    * @param name name of the icon set
54    */
 
55  66 toggle public IconSet(String name)
56    {
57  66 this.name = name;
58    }
59   
60    /**
61    * @param name name of the icon to get
62    * @return the icon corresponding to the given name
63    */
 
64  2720 toggle public Icon getIcon(String name)
65    {
66  2720 return iconMap.get(name);
67    }
68   
69    /**
70    * Add an icon to the icon set.
71    * @param name name of the icon
72    * @param icon the icon to add
73    */
 
74  31920 toggle public void addIcon(String name, Icon icon)
75    {
76  31920 iconMap.put(name, icon);
77    }
78   
79    /**
80    * @return the name of the icon set
81    */
 
82  5 toggle public String getName()
83    {
84  5 return name;
85    }
86   
87    /**
88    * Set the name of the icon set.
89    * @param name the name to set
90    */
 
91  1 toggle public void setName(String name)
92    {
93  1 this.name = name;
94    }
95   
96    /**
97    * @return the URL of a CSS file to enable to display this icon set properly, or null if it is not necessary
98    */
 
99  2686 toggle public String getCss()
100    {
101  2686 return css;
102    }
103   
104    /**
105    * Set the URL of a CSS file to enable to display this icon set properly.
106    * @param css URL of the CSS file (it can contains velocity code).
107    */
 
108  4 toggle public void setCss(String css)
109    {
110  4 this.css = css;
111    }
112   
113    /**
114    * @return the name of a SSX document to enable to display this icon set properly, or null if it is not necessary
115    */
 
116  2694 toggle public String getSsx()
117    {
118  2694 return ssx;
119    }
120   
121    /**
122    * Set the page name of a SSX document to enable to display the icon set properly.
123    * @param ssx the SSX document name
124    */
 
125  5 toggle public void setSsx(String ssx)
126    {
127  5 this.ssx = ssx;
128    }
129   
130    /**
131    * @return the name of a JSX document to enable to display this icon set properly, or null if it is not necessary
132    */
 
133  2694 toggle public String getJsx()
134    {
135  2694 return jsx;
136    }
137   
138    /**
139    * Set the page name of a JSX document to enable to display the icon set properly.
140    * @param jsx the JSX document name
141    */
 
142  5 toggle public void setJsx(String jsx)
143    {
144  5 this.jsx = jsx;
145    }
146   
147    /**
148    * @return the wiki code (containing velocity), to display an icon from this set.
149    */
 
150  149 toggle public String getRenderWiki()
151    {
152  149 return renderWiki;
153    }
154   
155    /**
156    * Set the wiki code (containing velocity) to display an icon from this set.
157    * @param renderWiki wiki code to set
158    */
 
159  34 toggle public void setRenderWiki(String renderWiki)
160    {
161  34 this.renderWiki = renderWiki;
162    }
163   
164    /**
165    * @return the HTML code (containing velocity) to display an icon from this set
166    */
 
167  2537 toggle public String getRenderHTML()
168    {
169  2537 return renderHTML;
170    }
171   
172    /**
173    * Set the HTML code (containing velocity) to display an icon from this set.
174    * @param renderHTML the HTML code to set
175    */
 
176  33 toggle public void setRenderHTML(String renderHTML)
177    {
178  33 this.renderHTML = renderHTML;
179    }
180   
181    /**
182    * @return the type of icons that contains this set
183    */
 
184  2 toggle public IconType getType()
185    {
186  2 return type;
187    }
188   
189    /**
190    * Set the type of icons that contains this set.
191    * @param type type to set
192    */
 
193  32 toggle public void setType(IconType type)
194    {
195  32 this.type = type;
196    }
197   
198    /**
199    * @return the list of names of all icons
200    * @since 6.4M1
201    */
 
202  2 toggle public List<String> getIconNames()
203    {
204  2 return new ArrayList<>(iconMap.keySet());
205    }
206    }