Package com.xpn.xwiki.plugin.skinx
Class CssSkinExtensionPlugin
- 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.CssSkinExtensionPlugin
-
- All Implemented Interfaces:
com.xpn.xwiki.internal.cache.rendering.RenderingCacheAware
,XWikiPluginInterface
,org.xwiki.observation.EventListener
public class CssSkinExtensionPlugin extends AbstractDocumentSkinExtensionPlugin
Skin Extension plugin that allows pulling CSS code stored inside wiki documents asXWiki.StyleSheetExtension
objects.- Version:
- $Id: fab7e51311544f707d45b37cbe8a8dc7bd3ae9fa $
-
-
Field Summary
Fields Modifier and Type Field Description static String
PLUGIN_NAME
The identifier for this plugin; used for accessing the plugin from velocity, and as the action returning the extension content.static String
SSX_CLASS_NAME
The name of the XClass storing the code for this type of extensions.static org.xwiki.model.reference.LocalDocumentReference
SSX_CLASS_REFERENCE
The local reference of the XClass storing the code for this type of extensions.-
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 CssSkinExtensionPlugin(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
-
SSX_CLASS_NAME
public static final String SSX_CLASS_NAME
The name of the XClass storing the code for this type of extensions.- See Also:
- Constant Field Values
-
SSX_CLASS_REFERENCE
public static final org.xwiki.model.reference.LocalDocumentReference SSX_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
-
CssSkinExtensionPlugin
public CssSkinExtensionPlugin(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)
-
-