Package com.xpn.xwiki.plugin.skinx
Class JsSkinExtensionPlugin
- java.lang.Object
-
- com.xpn.xwiki.plugin.XWikiDefaultPlugin
-
- com.xpn.xwiki.plugin.skinx.AbstractSkinExtensionPlugin
-
- com.xpn.xwiki.plugin.skinx.AbstractDocumentSkinExtensionPlugin
-
- com.xpn.xwiki.plugin.skinx.JsSkinExtensionPlugin
-
- All Implemented Interfaces:
com.xpn.xwiki.internal.cache.rendering.RenderingCacheAware
,XWikiPluginInterface
,org.xwiki.observation.EventListener
public class JsSkinExtensionPlugin extends AbstractDocumentSkinExtensionPlugin
Skin Extension plugin that allows pulling javascript code stored inside wiki documents asXWiki.JavaScriptExtension
objects.- Version:
- $Id: 8a894b7b0f9489d32ca4ef3b77389b927f33e809 $
-
-
Field Summary
Fields Modifier and Type Field Description static String
JSX_CLASS_NAME
The name of the XClass storing the code for this type of extensions.static org.xwiki.model.reference.LocalDocumentReference
JSX_CLASS_REFERENCE
The local reference of the XClass storing the code for this type of extensions.static String
PLUGIN_NAME
The identifier for this plugin; used for accessing the plugin from velocity, and as the action returning the extension content.-
Fields inherited from class com.xpn.xwiki.plugin.skinx.AbstractDocumentSkinExtensionPlugin
LOGGER
-
Fields inherited from class com.xpn.xwiki.plugin.skinx.AbstractSkinExtensionPlugin
contextKey, DEFER_DEFAULT_PARAM, parametersContextKey, QUERY_PARAMETER_DELIMITER
-
-
Constructor Summary
Constructors Constructor Description JsSkinExtensionPlugin(String name, String className, XWikiContext context)
XWiki plugin constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
endParsing(String content, XWikiContext context)
protected String
getExtensionClassName()
The name of the XClass which holds extensions of this type.protected String
getExtensionName()
A user-friendly name for this type of resource, used in the auto-generated class document.String
getLink(String documentName, XWikiContext context)
Abstract method for obtaining a link that points to the actual pulled resource.void
virtualInit(XWikiContext context)
-
Methods inherited from class com.xpn.xwiki.plugin.skinx.AbstractDocumentSkinExtensionPlugin
getAlwaysUsedExtensions, getAlwaysUsedExtensions, getDocumentSkinExtensionURL, getEvents, getExtensionClass, hasPageExtensions, init, isAccessible, isAccessible, onEvent, use
-
Methods inherited from class com.xpn.xwiki.plugin.skinx.AbstractSkinExtensionPlugin
getCacheResources, getCurrentDocumentReferenceResolver, getDefaultEntityReferenceSerializer, getImportString, getLink, getParameter, getParametersForResource, getParametersMap, getPluginApi, getPulledResources, getSkinExtensionAsync, initializeRequestListIfNeeded, parametersAsQueryString, restoreCacheResources, sanitize, use
-
Methods inherited from class com.xpn.xwiki.plugin.XWikiDefaultPlugin
beginParsing, beginRendering, commonTagsHandler, downloadAttachment, endRendering, endRenderingHandler, flushCache, flushCache, getClassName, getLocalization, getName, insidePREHandler, localizePlainOrKey, outsidePREHandler, setClassName, setName, startRenderingHandler
-
-
-
-
Field Detail
-
JSX_CLASS_NAME
public static final String JSX_CLASS_NAME
The name of the XClass storing the code for this type of extensions.- See Also:
- Constant Field Values
-
JSX_CLASS_REFERENCE
public static final org.xwiki.model.reference.LocalDocumentReference JSX_CLASS_REFERENCE
The local reference of the XClass storing the code for this type of extensions.
-
PLUGIN_NAME
public static final String PLUGIN_NAME
The identifier for this plugin; used for accessing the plugin from velocity, and as the action returning the extension content.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
JsSkinExtensionPlugin
public JsSkinExtensionPlugin(String name, String className, XWikiContext context)
XWiki plugin constructor.- Parameters:
name
- The name of the plugin, which can be used for retrieving the plugin API from velocity. Unused.className
- The canonical classname of the plugin. Unused.context
- The current request context.- See Also:
XWikiDefaultPlugin(String, String, com.xpn.xwiki.XWikiContext)
-
-
Method Detail
-
virtualInit
public void virtualInit(XWikiContext context)
Create/update the XClass corresponding to this kind of extension in this virtual wiki.
We must override this method since the plugin manager only calls it for classes that provide their own implementation, and not an inherited one.
- Specified by:
virtualInit
in interfaceXWikiPluginInterface
- Overrides:
virtualInit
in classAbstractDocumentSkinExtensionPlugin
- See Also:
XWikiPluginInterface.virtualInit(com.xpn.xwiki.XWikiContext)
-
getLink
public String getLink(String documentName, XWikiContext context)
Description copied from class:AbstractSkinExtensionPlugin
Abstract method for obtaining a link that points to the actual pulled resource. Each type of resource has its own format for the link, for example Javascript uses<script src="/path/to/Document">
, while CSS uses<link rel="stylesheet" href="/path/to/Document">
(the actual syntax is longer, this is just a simplified example).- Specified by:
getLink
in classAbstractSkinExtensionPlugin
- Parameters:
documentName
- the name of the wiki document holding the resource.context
- the current request context, needed to access the URLFactory.- Returns:
- A
String
representation of the linking element that should be printed in the generated HTML.
-
getExtensionClassName
protected String getExtensionClassName()
Description copied from class:AbstractDocumentSkinExtensionPlugin
The name of the XClass which holds extensions of this type.- Specified by:
getExtensionClassName
in classAbstractDocumentSkinExtensionPlugin
- Returns:
- A
String
representation of the XClass name, in theSpace.Document
format.
-
getExtensionName
protected String getExtensionName()
Description copied from class:AbstractDocumentSkinExtensionPlugin
A user-friendly name for this type of resource, used in the auto-generated class document.- Specified by:
getExtensionName
in classAbstractDocumentSkinExtensionPlugin
- Returns:
- The user-friendly name for this type of resource.
-
endParsing
public String endParsing(String content, XWikiContext context)
At the end of the request, insert the links to the pulled resources in the response, in the place marked by an XML comment of the format
<!-- canonical.plugin.classname -->
.We must override this method since the plugin manager only calls it for classes that provide their own implementation, and not an inherited one.
We must override this method since the plugin manager only calls it for classes that provide their own implementation, and not an inherited one.
- Specified by:
endParsing
in interfaceXWikiPluginInterface
- Overrides:
endParsing
in classAbstractDocumentSkinExtensionPlugin
- See Also:
AbstractSkinExtensionPlugin.endParsing(String, XWikiContext)
-
-