|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.ecyrd.jspwiki.modules.ModuleManager
com.ecyrd.jspwiki.ui.TemplateManager
public class TemplateManager
This class takes care of managing JSPWiki templates.
Field Summary | |
---|---|
static String |
DEFAULT_TEMPLATE
|
static String |
DIRECTORY
The default directory for the properties. |
protected static org.apache.log4j.Logger |
log
|
static String |
PROPERTYFILE
Name of the file that contains the properties. |
static String |
RESOURCE_INCLUDES
|
static String |
RESOURCE_INLINECSS
Requests inlined CSS. |
static String |
RESOURCE_JSFUNCTION
Requests a JavaScript function to be called during window.onload. |
static String |
RESOURCE_SCRIPT
Requests a script to be loaded. |
static String |
RESOURCE_STYLESHEET
Requests a stylesheet to be inserted. |
Fields inherited from class com.ecyrd.jspwiki.modules.ModuleManager |
---|
PLUGIN_RESOURCE_LOCATION |
Constructor Summary | |
---|---|
TemplateManager(WikiEngine engine,
Properties properties)
|
Method Summary | |
---|---|
static void |
addResourceRequest(WikiContext ctx,
String type,
String resource)
Adds a resource request to the current request context. |
String |
findJSP(javax.servlet.jsp.PageContext pageContext,
String name)
An utility method for finding a JSP page. |
String |
findJSP(javax.servlet.jsp.PageContext pageContext,
String template,
String name)
Attempts to locate a JSP page under the given template. |
static String |
getMarker(String type)
Returns the include resources marker for a given type. |
static String[] |
getResourceRequests(WikiContext ctx,
String type)
Returns resource requests for a particular type. |
static String[] |
getResourceTypes(WikiContext ctx)
returns all those types that have been requested so far. |
String |
getTemplateProperty(WikiContext context,
String key)
Returns a property, as defined in the template. |
Set |
listSkins(javax.servlet.jsp.PageContext pageContext,
String template)
Lists the skins available under this template. |
boolean |
templateExists(String templateName)
Check the existence of a template. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String RESOURCE_JSFUNCTION
public static final String RESOURCE_STYLESHEET
public static final String RESOURCE_SCRIPT
public static final String RESOURCE_INLINECSS
public static final String DIRECTORY
public static final String DEFAULT_TEMPLATE
public static final String PROPERTYFILE
public static final String RESOURCE_INCLUDES
protected static org.apache.log4j.Logger log
Constructor Detail |
---|
public TemplateManager(WikiEngine engine, Properties properties)
Method Detail |
---|
public boolean templateExists(String templateName)
public String findJSP(javax.servlet.jsp.PageContext pageContext, String name)
public String findJSP(javax.servlet.jsp.PageContext pageContext, String template, String name)
pageContext
- The JSP PageContexttemplate
- From which template we should seek initially?name
- Which resource are we looking for (e.g. "ViewTemplate.jsp")
public String getTemplateProperty(WikiContext context, String key)
public Set listSkins(javax.servlet.jsp.PageContext pageContext, String template)
template
-
public static String getMarker(String type)
type
- the marker
public static void addResourceRequest(WikiContext ctx, String type, String resource)
The resources can be of different types. For RESOURCE_SCRIPT and RESOURCE_STYLESHEET this is an URI path to the resource (a script file or an external stylesheet) that needs to be included. For RESOURCE_INLINECSS the resource should be something that can be added between <style></style> in the header file (commonheader.jsp). For RESOURCE_JSFUNCTION it is the name of the Javascript function that should be run at page load.
The IncludeResourceTag inserts code in the template files, which is then filled by the WikiFilter after the request has been rendered but not yet sent to the recipient.
Note that ALL resource requests get rendered, so this method does not check if the request already exists in the resources. Therefore, if you have a plugin which makes a new resource request every time, you'll end up with multiple resource requests rendered. It's thus a good idea to make this request only once during the page life cycle.
ctx
- The current wiki contexttype
- What kind of a request should be added?resource
- The resource to add.public static String[] getResourceRequests(WikiContext ctx, String type)
public static String[] getResourceTypes(WikiContext ctx)
ctx
- the wiki context
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |