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

File AbstractLESSSource.java

 

Coverage histogram

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

Code metrics

2
8
2
1
67
27
3
0.38
4
2
1.5

Classes

Class Line # Actions
AbstractLESSSource 34 8 0% 3 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.lesscss.internal.compiler.less4j;
21   
22    import org.xwiki.skin.Resource;
23    import org.xwiki.skin.Skin;
24    import org.xwiki.template.TemplateManager;
25   
26    import com.github.sommeri.less4j.LessSource;
27   
28    /**
29    * Abstract implementation of LessSource that looks for relative sources in the skin templates.
30    *
31    * @version $Id: 8dacb862294f878ef232139185d319ddc0d42076 $
32    * @since 7.0RC1
33    */
 
34    public abstract class AbstractLESSSource extends LessSource
35    {
36    protected TemplateManager templateManager;
37   
38    protected Skin skin;
39   
40    private String folder;
41   
42    /**
43    * Default constructor.
44    * @param templateManager the template manager component
45    * @param skin the skin holding the templates
46    * @param folder the folder in which the template is located
47    */
 
48  3335 toggle public AbstractLESSSource(TemplateManager templateManager, Skin skin, String folder)
49    {
50  3335 this.templateManager = templateManager;
51  3335 this.skin = skin;
52  3335 this.folder = folder;
53    }
54   
 
55  3299 toggle @Override
56    public LessSource relativeSource(String filename) throws FileNotFound
57    {
58  3299 String template = folder + "/" + filename;
59  3299 Resource resource = skin.getResource(template);
60  3299 if (resource != null) {
61  3297 return new TemplateLESSSource(templateManager, skin, template);
62    }
63   
64    // The file has not been found
65  2 throw new FileNotFound();
66    }
67    }