1. Project Clover database Tue Dec 20 2016 21:24:09 CET
  2. Package org.xwiki.lesscss.internal.colortheme.converter

File DefaultLESSColorThemeConverter.java

 

Coverage histogram

../../../../../../img/srcFileCovDistChart9.png
38% of files have more coverage

Code metrics

0
6
5
1
89
53
5
0.83
1.2
5
1

Classes

Class Line # Actions
DefaultLESSColorThemeConverter 43 6 0% 5 2
0.818181881.8%
 

Contributing tests

This file is covered by 1 test. .

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.lesscss.internal.colortheme.converter;
21   
22    import javax.inject.Inject;
23    import javax.inject.Singleton;
24   
25    import org.xwiki.component.annotation.Component;
26    import org.xwiki.component.phase.Initializable;
27    import org.xwiki.component.phase.InitializationException;
28    import org.xwiki.lesscss.compiler.LESSCompilerException;
29    import org.xwiki.lesscss.internal.cache.AbstractCachedCompiler;
30    import org.xwiki.lesscss.internal.cache.ColorThemeCache;
31    import org.xwiki.lesscss.internal.colortheme.ColorTheme;
32    import org.xwiki.lesscss.internal.colortheme.LESSColorThemeConverter;
33    import org.xwiki.lesscss.resources.LESSResourceReferenceFactory;
34   
35    /**
36    * Default implementation of {@link org.xwiki.lesscss.internal.colortheme.LESSColorThemeConverter}.
37    *
38    * @since 7.0RC1
39    * @version $Id: f75e27e0bfbb9e41cc872bed92eaa32277f00add $
40    */
41    @Component
42    @Singleton
 
43    public class DefaultLESSColorThemeConverter extends AbstractCachedCompiler<ColorTheme>
44    implements LESSColorThemeConverter, Initializable
45    {
46    private static final ColorTheme EMPTY_COLOR_THEME = new ColorTheme();
47   
48    @Inject
49    private ColorThemeCache cache;
50   
51    @Inject
52    private CachedLESSColorThemeConverter cachedLESSColorThemeConverter;
53   
54    @Inject
55    private LESSResourceReferenceFactory lessResourceReferenceFactory;
56   
 
57  30 toggle @Override
58    public void initialize() throws InitializationException
59    {
60  30 super.cache = cache;
61  30 super.compiler = cachedLESSColorThemeConverter;
62    }
63   
 
64  2078 toggle @Override
65    public ColorTheme getColorThemeFromSkinFile(String fileName, boolean force) throws LESSCompilerException
66    {
67  2079 return super.getResult(lessResourceReferenceFactory.createReferenceForSkinFile(fileName), false, true, force);
68    }
69   
 
70  1 toggle @Override
71    public ColorTheme getColorThemeFromSkinFile(String fileName, String skin, boolean force)
72    throws LESSCompilerException
73    {
74  1 return super.getResult(lessResourceReferenceFactory.createReferenceForSkinFile(fileName), false, true, skin,
75    force);
76    }
77   
 
78  2080 toggle @Override
79    protected ColorTheme cloneResult(ColorTheme toClone)
80    {
81  2080 return new ColorTheme(toClone);
82    }
83   
 
84  0 toggle @Override
85    protected ColorTheme exceptionAsResult(LESSCompilerException exception)
86    {
87  0 return EMPTY_COLOR_THEME;
88    }
89    }