1. Project Clover database Tue Dec 20 2016 21:24:09 CET
  2. Package com.xpn.xwiki.plugin.skinx

File SkinExtensionPluginApi.java

 

Coverage histogram

../../../../../img/srcFileCovDistChart8.png
54% of files have more coverage

Code metrics

0
4
4
1
91
23
4
1
1
4
1

Classes

Class Line # Actions
SkinExtensionPluginApi 35 4 0% 4 2
0.7575%
 

Contributing tests

No tests hitting this source file were found.

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   
21    package com.xpn.xwiki.plugin.skinx;
22   
23    import java.util.Map;
24   
25    import com.xpn.xwiki.XWikiContext;
26    import com.xpn.xwiki.plugin.PluginApi;
27   
28    /**
29    * API for the SkinExtension Plugin.
30    *
31    * @see PluginApi
32    * @see AbstractSkinExtensionPlugin
33    * @version $Id: c589ccdf583f1f07bbdd9976ac40b820f3aabeb1 $
34    */
 
35    public class SkinExtensionPluginApi extends PluginApi<AbstractSkinExtensionPlugin>
36    {
37    /**
38    * XWiki Plugin API constructor.
39    *
40    * @param plugin The wrapped plugin.
41    * @param context The current request context.
42    * @see PluginApi#PluginApi(com.xpn.xwiki.plugin.XWikiPluginInterface, XWikiContext)
43    */
 
44  21569 toggle public SkinExtensionPluginApi(AbstractSkinExtensionPlugin plugin, XWikiContext context)
45    {
46  21569 super(plugin, context);
47    }
48   
49    /**
50    * Mark a resource as used in the current result. A resource is registered only once per request, further calls will
51    * not result in additional links, even if it is pulled with different parameters.
52    *
53    * @param resource The name of the resource to pull.
54    * @see AbstractSkinExtensionPlugin#use(String, XWikiContext)
55    */
 
56  3856 toggle public void use(String resource)
57    {
58  3856 this.getProtectedPlugin().use(resource, getXWikiContext());
59    }
60   
61    /**
62    * Mark a skin extension document as used in the current result, together with some parameters. How the parameters
63    * are used, depends on the type of resource being pulled. For example, JS and CSS extensions use the parameters in
64    * the resulting URL, while Link extensions use the parameters as attributes of the link tag. A resource is
65    * registered only once per request, further calls will not result in additional links, even if it is pulled with
66    * different parameters. If more than one calls per request are made, the parameters used are the ones from the last
67    * call (or none, if the last call did not specify any parameters).
68    *
69    * @param resource The name of the resource to pull.
70    * @param parameters The parameters for this resource.
71    * @see AbstractSkinExtensionPlugin#use(String, Map, XWikiContext)
72    */
 
73  8793 toggle public void use(String resource, Map<String, Object> parameters)
74    {
75  8793 this.getProtectedPlugin().use(resource, parameters, getXWikiContext());
76    }
77   
78    /**
79    * Composes and returns the links to the resources pulled in the current request. This method is called at the end
80    * of each request, once for each type of resource (subclass), and the result is placed in the generated XHTML.
81    *
82    * @return a XHMTL fragment with all extensions imports statements for this request. This includes both extensions
83    * that are defined as being "used always" and "on demand" extensions explicitly requested for this page.
84    * Always used extensions are always, before on demand extensions, so that on demand extensions can override
85    * more general elements in the always used ones.
86    */
 
87  0 toggle public String getImportString()
88    {
89  0 return this.getProtectedPlugin().getImportString(getXWikiContext());
90    }
91    }