com.xpn.xwiki.plugin.skinx
Class JsSkinExtensionPlugin

java.lang.Object
  extended by com.xpn.xwiki.plugin.XWikiDefaultPlugin
      extended by com.xpn.xwiki.plugin.skinx.AbstractSkinExtensionPlugin
          extended by com.xpn.xwiki.plugin.skinx.AbstractDocumentSkinExtensionPlugin
              extended by com.xpn.xwiki.plugin.skinx.JsSkinExtensionPlugin
All Implemented Interfaces:
com.xpn.xwiki.plugin.XWikiPluginInterface, org.xwiki.observation.EventListener

public class JsSkinExtensionPlugin
extends AbstractDocumentSkinExtensionPlugin

Skin Extension plugin that allows pulling javascript code stored inside wiki documents as XWiki.JavaScriptExtension objects.

Version:
$Id: 42ccff38d5e9781adfb55387256cbf390d07f4ef $

Field Summary
static String DEFER_DEFAULT_PARAM
          The name of the preference (in the configuration file) specifying what is the default value of the defer, in case nothing is specified in the parameters of this extension.
static String JSX_CLASS_NAME
          The name 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.AbstractSkinExtensionPlugin
contextKey, parametersContextKey
 
Constructor Summary
JsSkinExtensionPlugin(String name, String className, com.xpn.xwiki.XWikiContext context)
          XWiki plugin constructor.
 
Method Summary
 String endParsing(String content, com.xpn.xwiki.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, com.xpn.xwiki.XWikiContext context)
          Abstract method for obtaining a link that points to the actual pulled resource.
 void virtualInit(com.xpn.xwiki.XWikiContext context)
          
 
Methods inherited from class com.xpn.xwiki.plugin.skinx.AbstractDocumentSkinExtensionPlugin
getAlwaysUsedExtensions, getEvents, getExtensionClass, hasPageExtensions, init, onEvent
 
Methods inherited from class com.xpn.xwiki.plugin.skinx.AbstractSkinExtensionPlugin
getImportString, getParameter, getParametersForResource, getParametersMap, getPluginApi, getPulledResources, initializeRequestListIfNeeded, parametersAsQueryString, sanitize, use, use
 
Methods inherited from class com.xpn.xwiki.plugin.XWikiDefaultPlugin
beginParsing, beginRendering, commonTagsHandler, downloadAttachment, endRendering, endRenderingHandler, flushCache, flushCache, getClassName, getName, insidePREHandler, outsidePREHandler, setClassName, setName, startRenderingHandler
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.xwiki.observation.EventListener
getName
 

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

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

DEFER_DEFAULT_PARAM

public static final String DEFER_DEFAULT_PARAM
The name of the preference (in the configuration file) specifying what is the default value of the defer, in case nothing is specified in the parameters of this extension.

See Also:
Constant Field Values
Constructor Detail

JsSkinExtensionPlugin

public JsSkinExtensionPlugin(String name,
                             String className,
                             com.xpn.xwiki.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.XWikiDefaultPlugin(String,String,com.xpn.xwiki.XWikiContext)
Method Detail

virtualInit

public void virtualInit(com.xpn.xwiki.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 interface com.xpn.xwiki.plugin.XWikiPluginInterface
Overrides:
virtualInit in class AbstractDocumentSkinExtensionPlugin
See Also:
XWikiPluginInterface.virtualInit(com.xpn.xwiki.XWikiContext)

getLink

public String getLink(String documentName,
                      com.xpn.xwiki.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 class AbstractSkinExtensionPlugin
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 class AbstractDocumentSkinExtensionPlugin
Returns:
A String representation of the XClass name, in the Space.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 class AbstractDocumentSkinExtensionPlugin
Returns:
The user-friendly name for this type of resource.

endParsing

public String endParsing(String content,
                         com.xpn.xwiki.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 interface com.xpn.xwiki.plugin.XWikiPluginInterface
Overrides:
endParsing in class AbstractDocumentSkinExtensionPlugin
See Also:
AbstractSkinExtensionPlugin.endParsing(String, XWikiContext)


Copyright © 2004-2012 XWiki. All Rights Reserved.