com.sun.rave.web.ui.component.util.descriptors
Class LayoutDefinition

java.lang.Object
  extended by com.sun.rave.web.ui.component.util.descriptors.LayoutElementBase
      extended by com.sun.rave.web.ui.component.util.descriptors.LayoutDefinition
All Implemented Interfaces:
LayoutElement, java.io.Serializable

public class LayoutDefinition
extends LayoutElementBase

This represents the top-level LayoutElement, it is the container for every other LayoutElement. By itself, it has no functionality. Its purpose in life is to group all top-level child LayoutElements. LayoutDefintion objects can be registered with the LayoutDefinitionManager. This class does provide a useful method getChildLayoutElementById(FacesContext, String, LayoutElement, UIComponent) which will search recursively for the given child id.

See Also:
Serialized Form

Field Summary
static java.lang.String DECODE
           This is the "type" for handlers to be invoked to handle "decode" functionality for this element.
static java.lang.String STATIC_TEXT_FACTORY_CLASS_NAME
          This is the full class name of the default StaticTextFactory
static java.lang.String STATIC_TEXT_TYPE
          This is a hard-coded LayoutComponent type.
 
Fields inherited from class com.sun.rave.web.ui.component.util.descriptors.LayoutElementBase
AFTER_ENCODE, BEFORE_ENCODE, ENCODE
 
Constructor Summary
LayoutDefinition(java.lang.String id)
          Constructor
 
Method Summary
 void addComponentType(ComponentType type)
          This will add the given ComponentType to the map of registered ComponentTypes.
 void addResource(Resource res)
          This method adds a Resource.
 void decode(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component)
           This decode method invokes any registered DECODE handlers.
protected  boolean encodeThis(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component)
           The LayoutDefinition does not encode anything for itself, this method simply returns true.
 java.lang.Object getAttribute(java.lang.String key)
          Retrieve an attribute by key
static LayoutElement getChildLayoutElementById(javax.faces.context.FacesContext context, java.lang.String id, LayoutElement parent, javax.faces.component.UIComponent parentComponent)
          This method searches for the requested LayoutComponent by id.
 ComponentType getComponentType(java.lang.String typeID)
          Retrieve a ComponentType by typeID
 java.util.List getResources()
          This method returns a List of Resource objects.
 void setAttribute(java.lang.String key, java.lang.Object value)
          Associate the given key with the given Object as an attribute.
 
Methods inherited from class com.sun.rave.web.ui.component.util.descriptors.LayoutElementBase
addChildLayoutElement, createHandlerContext, dispatchHandlers, dispatchHandlers, encode, encodeChild, getChildLayoutElements, getHandlers, getHandlers, getHandlersByTypeMap, getId, getLayoutDefinition, getParent, getUnevaluatedId, resolveValue, setHandlers, setHandlersByTypeMap, setParent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

STATIC_TEXT_TYPE

public static final java.lang.String STATIC_TEXT_TYPE
This is a hard-coded LayoutComponent type. By default it corresponds to com.sun.rave.web.ui.component.util.factories.StaticTextFactory.

See Also:
Constant Field Values

STATIC_TEXT_FACTORY_CLASS_NAME

public static final java.lang.String STATIC_TEXT_FACTORY_CLASS_NAME
This is the full class name of the default StaticTextFactory

See Also:
Constant Field Values

DECODE

public static final java.lang.String DECODE

This is the "type" for handlers to be invoked to handle "decode" functionality for this element.

See Also:
Constant Field Values
Constructor Detail

LayoutDefinition

public LayoutDefinition(java.lang.String id)
Constructor

Method Detail

getComponentType

public ComponentType getComponentType(java.lang.String typeID)
Retrieve a ComponentType by typeID

Parameters:
typeID - The key used to retrieve the ComponentType
Returns:
The requested ComponentType or null

addComponentType

public void addComponentType(ComponentType type)
This will add the given ComponentType to the map of registered ComponentTypes. It will use the ComponentType ID as the key to the Map. This means that if a ComponentType with the same ID had previously been registered, it will be replaced with the ComponentType passed in.

Parameters:
type - The ComponentType.

addResource

public void addResource(Resource res)
This method adds a Resource. These resources should be added to the request scope when this component is used. This is mainly used for ResourceBundles (at this time).

Parameters:
res - The Resource to associate with the LayoutDefinition

getResources

public java.util.List getResources()
This method returns a List of Resource objects.

Returns:
This method returns a List of Resource objects.

getChildLayoutElementById

public static LayoutElement getChildLayoutElementById(javax.faces.context.FacesContext context,
                                                      java.lang.String id,
                                                      LayoutElement parent,
                                                      javax.faces.component.UIComponent parentComponent)
This method searches for the requested LayoutComponent by id.

Parameters:
context - FacesContext
id - id to look for
parent - Search starts from this LayoutElement
parentComponent - Parent UIComponent
Returns:
The matching LayoutElement if found, null otherwise.

getAttribute

public java.lang.Object getAttribute(java.lang.String key)
Retrieve an attribute by key

Parameters:
key - The key used to retrieve the attribute
Returns:
The requested attribute or null

setAttribute

public void setAttribute(java.lang.String key,
                         java.lang.Object value)
Associate the given key with the given Object as an attribute.

Parameters:
key - The key associated with the given object (if this key is already in use, it will replace the previously set attribute object).
value - The Object to store.

encodeThis

protected boolean encodeThis(javax.faces.context.FacesContext context,
                             javax.faces.component.UIComponent component)

The LayoutDefinition does not encode anything for itself, this method simply returns true.

Specified by:
encodeThis in class LayoutElementBase
Parameters:
context - The FacesContext
component - The UIComponent
Returns:
true

decode

public void decode(javax.faces.context.FacesContext context,
                   javax.faces.component.UIComponent component)

This decode method invokes any registered DECODE handlers.

Parameters:
context - The FacesContext
component - The Template