org.apache.shale.clay.component
Class Clay

java.lang.Object
  extended by javax.faces.component.UIComponent
      extended by javax.faces.component.UIComponentBase
          extended by org.apache.shale.clay.component.Clay
All Implemented Interfaces:
javax.faces.component.StateHolder

public class Clay
extends javax.faces.component.UIComponentBase

This component grafts a subview onto the current JSF view.


Constructor Summary
Clay()
           
 
Method Summary
 void encodeBegin(javax.faces.context.FacesContext context)
           This is where the clay component loads the root ComponentBean by calling the getRootElement() method or while invoking the shapeValidator callback event.
 void encodeChildren(javax.faces.context.FacesContext context)
           Called by JSF, this method delegates to recursiveRenderChildren.
 void encodeEnd(javax.faces.context.FacesContext context)
           Called by JSF, this method simply emits a logging statement if tracing is enabled.
protected  Catalog getCatalog()
           Loads the chains config using the resource defined by config file Globals.CLAY_RESOURCE_NAME.
 String getClayJsfid()
           Returns the unique identifier used to build the component subtree.
protected  ComponentBean getDisplayElementRoot()
           Returns the root ComponentBean used to build the clay subtree component.
 String getFamily()
           
 String getJsfid()
           Returns the unique identifier used to build the component subtree.
 String getManagedBeanName()
           Returns the logical bean name that replaces any occurance of "@managed-bean-name" within a binding expression.
 boolean getRendersChildren()
          Returns true indicating that this component renders it's children.
protected  ComponentBean getRootElement()
           Returns the root metadata component that is used to add to the component tree.
 String getShapeValidator()
           Retuns the validator signature event that is invoked when the component metadata is retrieved.
 Map getSymbols()
          Returns the symbol table for the component.
protected  void recursiveRenderChildren(javax.faces.component.UIComponent child, javax.faces.context.FacesContext context)
           Recursively invokes the rendering of the sub component tree.
 void restoreState(javax.faces.context.FacesContext context, Object obj)
           Restores a component's state.
 Object saveState(javax.faces.context.FacesContext context)
           Saves a component's state.
 void setClayJsfid(String jsfid)
           Sets the unique identifier used to build the component subtree.
protected  void setDisplayElementRoot(ComponentBean displayElementRoot)
           Sets the root ComponentBean used to build the clay subtree component.
 void setJsfid(String jsfid)
           Sets the unique identifier used to build the component subtree.
 void setManagedBeanName(String mbeanMnemonic)
           Sets the logical bean name that replaces any occurrences of "@managed-bean-name" within a binding expression.
 void setShapeValidator(String loadShapeAction)
           Sets the validator signature event that is invoked when the component metadata is retrieved.
 
Methods inherited from class javax.faces.component.UIComponentBase
addFacesListener, broadcast, decode, findComponent, getAttributes, getChildCount, getChildren, getClientId, getFacesContext, getFacesListeners, getFacet, getFacets, getFacetsAndChildren, getId, getParent, getRenderer, getRendererType, getValueBinding, isRendered, isTransient, processDecodes, processRestoreState, processSaveState, processUpdates, processValidators, queueEvent, removeFacesListener, restoreAttachedState, saveAttachedState, setId, setParent, setRendered, setRendererType, setTransient, setValueBinding
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Clay

public Clay()
Method Detail

getSymbols

public Map getSymbols()

Returns the symbol table for the component.

Returns:
Map of SymbolBean

getCatalog

protected Catalog getCatalog()
                      throws Exception

Loads the chains config using the resource defined by config file Globals.CLAY_RESOURCE_NAME. These chain commands are used to build the clay component subtree from a root ComponentBean obtained for a ConfigBean instance from the ConfigBeanFactory.

Returns:
Catalog instance of a catalog defined by catalog Globals.CLAY_CATALOG_NAME
Throws:
Exception - loading catalog

getJsfid

public String getJsfid()

Returns the unique identifier used to build the component subtree.

Returns:
jsfid

setJsfid

public void setJsfid(String jsfid)

Sets the unique identifier used to build the component subtree.

Parameters:
jsfid - root identifier of the sub tree

setClayJsfid

public void setClayJsfid(String jsfid)

Sets the unique identifier used to build the component subtree. This property is not accessible from the JSP tag.

Parameters:
jsfid - alias to the jsfid property

getClayJsfid

public String getClayJsfid()

Returns the unique identifier used to build the component subtree. This property is not accessible from the JSP tag.

Returns:
jsfid alias

getShapeValidator

public String getShapeValidator()

Retuns the validator signature event that is invoked when the component metadata is retrieved.

Returns:
method binding expression

setShapeValidator

public void setShapeValidator(String loadShapeAction)

Sets the validator signature event that is invoked when the component metadata is retrieved.

Parameters:
loadShapeAction - method binding expression

getManagedBeanName

public String getManagedBeanName()

Returns the logical bean name that replaces any occurance of "@managed-bean-name" within a binding expression.

Returns:
managed bean name symbol

setManagedBeanName

public void setManagedBeanName(String mbeanMnemonic)

Sets the logical bean name that replaces any occurrences of "@managed-bean-name" within a binding expression.

Parameters:
mbeanMnemonic - managed bean symbol

getRootElement

protected ComponentBean getRootElement()

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.

Returns:
root config bean used to define the subtree

encodeBegin

public void encodeBegin(javax.faces.context.FacesContext context)
                 throws IOException

This is where the clay component loads the root ComponentBean by calling the getRootElement() method or while invoking the shapeValidator callback event. The subtree is created using the Globals.ADD_COMPONENT_COMMAND_NAME from the Globals.CLAY_CATALOG_NAME in the Globals.CLAY_RESOURCE_NAME.

Overrides:
encodeBegin in class javax.faces.component.UIComponentBase
Parameters:
context - faces context
Throws:
IOException - render error

recursiveRenderChildren

protected void recursiveRenderChildren(javax.faces.component.UIComponent child,
                                       javax.faces.context.FacesContext context)
                                throws IOException

Recursively invokes the rendering of the sub component tree.

Parameters:
child - faces component
context - faces context
Throws:
IOException - render error

encodeChildren

public void encodeChildren(javax.faces.context.FacesContext context)
                    throws IOException

Called by JSF, this method delegates to recursiveRenderChildren.

Overrides:
encodeChildren in class javax.faces.component.UIComponentBase
Parameters:
context - faces context
Throws:
IOException - render error

encodeEnd

public void encodeEnd(javax.faces.context.FacesContext context)
               throws IOException

Called by JSF, this method simply emits a logging statement if tracing is enabled.

Overrides:
encodeEnd in class javax.faces.component.UIComponentBase
Parameters:
context - faces context
Throws:
IOException - render error

getDisplayElementRoot

protected ComponentBean getDisplayElementRoot()

Returns the root ComponentBean used to build the clay subtree component.

Returns:
root config bean

setDisplayElementRoot

protected void setDisplayElementRoot(ComponentBean displayElementRoot)

Sets the root ComponentBean used to build the clay subtree component.

Parameters:
displayElementRoot - root config bean

restoreState

public void restoreState(javax.faces.context.FacesContext context,
                         Object obj)

Restores a component's state.

Specified by:
restoreState in interface javax.faces.component.StateHolder
Overrides:
restoreState in class javax.faces.component.UIComponentBase
Parameters:
context - faces context
obj - component state

saveState

public Object saveState(javax.faces.context.FacesContext context)

Saves a component's state.

Specified by:
saveState in interface javax.faces.component.StateHolder
Overrides:
saveState in class javax.faces.component.UIComponentBase
Parameters:
context - faces context
Returns:
subtree state
See Also:
StateHolder.saveState(javax.faces.context.FacesContext)

getRendersChildren

public boolean getRendersChildren()

Returns true indicating that this component renders it's children. That means JSF will invoke encodeChildren() method.

Overrides:
getRendersChildren in class javax.faces.component.UIComponentBase
Returns:
true

getFamily

public String getFamily()
Specified by:
getFamily in class javax.faces.component.UIComponent
Returns:
Returns the component's family.


Copyright © 2004-2007 Apache Software Foundation. All Rights Reserved.