|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.shale.clay.config.beans.ComponentConfigBean org.apache.shale.clay.config.beans.TemplateConfigBean
public class TemplateConfigBean
The second type of top-level object pool. This implementation
is designed to provide Tapestry like template composition. The
top-level ComponentBean
is materialized from a HTML fragment
where HTML elements are bound to meta components defined in the
XML configuration files and cached by an instance of ComponentConfigBean
Nested Class Summary |
---|
Nested classes/interfaces inherited from class org.apache.shale.clay.config.beans.ComponentConfigBean |
---|
ComponentConfigBean.WatchDog, ComponentConfigBean.XmlConfigDef |
Nested classes/interfaces inherited from interface org.apache.shale.clay.config.beans.ConfigBean |
---|
ConfigBean.ConfigDefinition |
Field Summary |
---|
Fields inherited from class org.apache.shale.clay.config.beans.ComponentConfigBean |
---|
context, displayElements, isWatchDogOn, messages, NAMING_CONTAINER_TYPES, parser, suffixes, watchDogs |
Constructor Summary | |
---|---|
TemplateConfigBean()
|
Method Summary | |
---|---|
protected void |
clear(String watchDogName)
If the watchDogName equals
the ComponentBean that defines the selected
template, remove it. |
ComponentBean |
getElement(String templateName)
Returns a ComponentBean that is materialized
using a HTML template fragment. |
protected ComponentBean |
getTopLevelElement(String jsfid)
Returns the root metadata component that is used to add to the component tree. |
int |
getWeight()
Returns an integer value use to order the registered ConfigBean instances
with the ConfigBeanFactory . |
void |
init(ServletContext context)
The HTML templates are loaded on-demand. |
protected void |
loadConfigFiles()
This is an overridden method called from the init method. |
void |
optimizeTree(ComponentBean root)
Recursively walks down the graph of meta-data ComponentBean 's
looking at the children of the root . |
boolean |
refresh(boolean forceReload)
If the forceReload is true ,
the displayElements cache is invalidated. |
boolean |
validMoniker(String id)
Overrides the super call to change the condition of the filter. |
Methods inherited from class org.apache.shale.clay.config.beans.ComponentConfigBean |
---|
addChild, assignParent, checkCircularInheritance, checkTree, checkTree, compareTo, describeRelationships, destroy, getAssociations, getConfigDefinitions, getGeneralizations, getServletContext, isDesigntime, isNamingContainer, realizingInheritance, realizingInheritance, resolveInheritance, setDesigntime, unassignParent |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public TemplateConfigBean()
Method Detail |
---|
public ComponentBean getElement(String templateName)
Returns a ComponentBean
that is materialized
using a HTML template fragment. The templateName
is the name of the file relative to the context root of the
web application
getElement
in interface ConfigBean
getElement
in class ComponentConfigBean
templateName
- name of the markup template
templateName
public int getWeight()
Returns an integer value use to order the registered ConfigBean
instances
with the ConfigBeanFactory
.
getWeight
in interface ConfigBean
getWeight
in class ComponentConfigBean
1
public boolean validMoniker(String id)
Overrides the super call to change the condition of the filter. This
ConfigBean
can create components where the id end in the suffix
defined in the web deployment descriptor as a initialization parameter with
the name defined by Globals.CLAY_HTML_TEMPLATE_SUFFIX
Or, using
the default defined by Globals.CLAY_DEFAULT_HTML_TEMPLATE_SUFFIX
validMoniker
in interface ConfigBean
validMoniker
in class ComponentConfigBean
id
- jsfid
true
if the jsfid
can be handled hereprotected void loadConfigFiles()
This is an overridden method called from the init method.
It loads an instance of the ClayTemplateParser
and
establishes a Map collection to hold the resource
ComponentConfigBean.WatchDog
's.
loadConfigFiles
in class ComponentConfigBean
public void init(ServletContext context)
The HTML templates are loaded on-demand. Override this method forcing the auto
load option on. The XML configuration files are only effected by the
auto-reload-clay-files
initialization parameter.
init
in interface ConfigBean
init
in class ComponentConfigBean
context
- web container servlet contextprotected void clear(String watchDogName)
If the watchDogName
equals
the ComponentBean
that defines the selected
template, remove it.
clear
in class ComponentConfigBean
watchDogName
- grouping of template filespublic boolean refresh(boolean forceReload)
If the forceReload
is true
,
the displayElements
cache is invalidated.
A true
value is returned if cache has
been cleared.
refresh
in interface ConfigBean
refresh
in class ComponentConfigBean
forceReload
- invalidate the cache flag
true
if the templates were reloadedprotected ComponentBean getTopLevelElement(String jsfid)
Returns the root metadata component that is used to add to the component
tree. It locates the ComponentBean
using the jsfid
attribute as the key. A call to the ConfigBeanFactory
locates the
correct ConfigBean
used to find the ComponentBean
.
getTopLevelElement
in class ComponentConfigBean
jsfid
- parent id of a config bean
public void optimizeTree(ComponentBean root)
Recursively walks down the graph of meta-data ComponentBean
's
looking at the children of the root
. Adjacent
children that are both verbatim
component
definitions are merged. If there is only one child and
the child and root nodes are both verbatim
definitions, the child is merged up to the root.
root
- top config bean that represents a markup template
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |