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

File DefaultIconTransformationConfiguration.java

 

Coverage histogram

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

Code metrics

0
21
3
1
82
46
3
0.14
7
3
1

Classes

Class Line # Actions
DefaultIconTransformationConfiguration 39 21 0% 3 2
0.916666791.7%
 

Contributing tests

This file is covered by 4 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.internal.transformation.icon;
21   
22    import java.util.Properties;
23   
24    import javax.inject.Singleton;
25   
26    import org.xwiki.component.annotation.Component;
27    import org.xwiki.component.phase.Initializable;
28    import org.xwiki.component.phase.InitializationException;
29    import org.xwiki.rendering.transformation.icon.IconTransformationConfiguration;
30   
31    /**
32    * All configuration options for the Icon transformation.
33    *
34    * @version $Id: 491d1bd52b22fa5a4c0a1e5456dd0e451843e6cd $
35    * @since 2.6RC1
36    */
37    @Component
38    @Singleton
 
39    public class DefaultIconTransformationConfiguration implements IconTransformationConfiguration, Initializable
40    {
41    /**
42    * Default Mappings.
43    */
44    private Properties mappings = new Properties();
45   
 
46  35 toggle @Override
47    public void initialize() throws InitializationException
48    {
49    // Default Mappings
50  35 this.mappings.setProperty(":)", "emoticon_smile");
51  35 this.mappings.setProperty(":(", "emoticon_unhappy");
52  35 this.mappings.setProperty(":P", "emoticon_tongue");
53  35 this.mappings.setProperty(":D", "emoticon_grin");
54  35 this.mappings.setProperty(";)", "emoticon_wink");
55  35 this.mappings.setProperty("(y)", "thumb_up");
56  35 this.mappings.setProperty("(n)", "thumb_down");
57  35 this.mappings.setProperty("(i)", "information");
58  35 this.mappings.setProperty("(/)", "accept");
59  35 this.mappings.setProperty("(x)", "cancel");
60  35 this.mappings.setProperty("(!)", "error");
61  35 this.mappings.setProperty("(+)", "add");
62  35 this.mappings.setProperty("(-)", "delete");
63  35 this.mappings.setProperty("(?)", "help");
64  35 this.mappings.setProperty("(on)", "lightbulb");
65  35 this.mappings.setProperty("(off)", "lightbulb_off");
66  35 this.mappings.setProperty("(*)", "star");
67    }
68   
 
69  35 toggle @Override
70    public Properties getMappings()
71    {
72  35 Properties properties = new Properties();
73  35 properties.putAll(this.mappings);
74  35 return properties;
75    }
76   
 
77  0 toggle @Override
78    public void addMapping(String iconCharacters, String iconName)
79    {
80  0 this.mappings.setProperty(iconCharacters, iconName);
81    }
82    }