org.apache.shale.clay.parser.builder
Class ElementBuilder

java.lang.Object
  extended by org.apache.shale.clay.parser.builder.Builder
      extended by org.apache.shale.clay.parser.builder.ElementBuilder
Direct Known Subclasses:
JsfDefaultBuilder

public class ElementBuilder
extends Builder

This class handles building the ElementBean's from the html markup resembling the <attributes> node in the clay DTD, http://shale.apache.org/dtds/clay-config_1_0.dtd.


Field Summary
 
Fields inherited from class org.apache.shale.clay.parser.builder.Builder
messages
 
Constructor Summary
ElementBuilder()
           
 
Method Summary
protected  void addActionListener(Node node, ElementBean target)
          Adds an ActionListenerBean to the target ElementBean using the Node as the input source.
protected  void addAttributes(Node attributesNode, ComponentBean target)
          Looks for <set/> nodes within a <attributes> node and converting them to AttributeBean's on the target ComponentBean.
protected  void addConverter(Node node, ElementBean target)
          Adds a ConverterBean to the target ElementBean using the Node as the input source.
protected  void addSymbols(Node symbolsNode, ElementBean target)
          Adds markup symbols to the target ElementBean.
protected  void addValidator(Node node, ElementBean target)
          Adds a ValidatorBean to the target ElementBean using the Node as the input source.
protected  void addValueChangeListener(Node node, ElementBean target)
          Adds a ActionListenerBean to the target ElementBean using the Node as the input source.
protected  void assignNode(Node node, ElementBean target)
           This method resolves the jsfid attribute for an HTML element to a component definition in the XML configuration files.
 ElementBean createElement(Node node)
          This method is overridden to look for a renderId attribute in the Node.
protected  void encodeBegin(Node node, ElementBean target, ComponentBean root)
          Handles converting markup resembling the <element> node in the clay DTD, http://shale.apache.org/dtds/clay-config_1_0.dtd, to the target ElementBean.
protected  String getComponentType(Node node)
          Returns the componentType from the target HTML Node.
protected  String getJsfid(Node node)
          Returns the jsfid from the target HTML Node.
 boolean isChildrenAllowed()
           This override returns true indicating that the from JSF component can have children.
protected  boolean isNodeWhitespace(Node node)
          Test the value of the node and returns true if the value is only whitespace.
protected  void realizeComponent(Node node, ComponentBean target)
          Realizes the inheritance of the target ComponentBean and and then applies attributes that are optionally nested under the node.
 
Methods inherited from class org.apache.shale.clay.parser.builder.Builder
assignAttributes, createAttribute, encode, encodeChildren, encodeEnd, getBuilder, getBuildNodeBody, getRenderId
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ElementBuilder

public ElementBuilder()
Method Detail

getJsfid

protected String getJsfid(Node node)

Returns the jsfid from the target HTML Node.

Specified by:
getJsfid in class Builder
Parameters:
node - markup
Returns:
jsfid

getComponentType

protected String getComponentType(Node node)

Returns the componentType from the target HTML Node.

Specified by:
getComponentType in class Builder
Parameters:
node - markup
Returns:
component type

addConverter

protected void addConverter(Node node,
                            ElementBean target)

Adds a ConverterBean to the target ElementBean using the Node as the input source.

Parameters:
node - markup
target - child config bean

addValidator

protected void addValidator(Node node,
                            ElementBean target)

Adds a ValidatorBean to the target ElementBean using the Node as the input source.

Parameters:
node - markup
target - child config bean

addActionListener

protected void addActionListener(Node node,
                                 ElementBean target)

Adds an ActionListenerBean to the target ElementBean using the Node as the input source.

Parameters:
node - markup
target - child config bean

addValueChangeListener

protected void addValueChangeListener(Node node,
                                      ElementBean target)

Adds a ActionListenerBean to the target ElementBean using the Node as the input source.

Parameters:
node - markup
target - child config bean

realizeComponent

protected void realizeComponent(Node node,
                                ComponentBean target)

Realizes the inheritance of the target ComponentBean and and then applies attributes that are optionally nested under the node.

Parameters:
node - markup
target - child config bean

addAttributes

protected void addAttributes(Node attributesNode,
                             ComponentBean target)

Looks for <set/> nodes within a <attributes> node and converting them to AttributeBean's on the target ComponentBean.

Parameters:
attributesNode - markup
target - child config bean

addSymbols

protected void addSymbols(Node symbolsNode,
                          ElementBean target)

Adds markup symbols to the target ElementBean.

Parameters:
symbolsNode - markup
target - child config bean

encodeBegin

protected void encodeBegin(Node node,
                           ElementBean target,
                           ComponentBean root)

Handles converting markup resembling the <element> node in the clay DTD, http://shale.apache.org/dtds/clay-config_1_0.dtd, to the target ElementBean.

Overrides:
encodeBegin in class Builder
Parameters:
node - markup
target - child config bean
root - parent config bean

createElement

public ElementBean createElement(Node node)

This method is overridden to look for a renderId attribute in the Node. If one exists, it is applied to the target ElementBean. The super class Builder generates a unique id by default. The clay namespace HTML nodes can override the renderId to allow overridding of nested elements.

Overrides:
createElement in class Builder
Parameters:
node - markup
Returns:
config bean

isChildrenAllowed

public boolean isChildrenAllowed()

This override returns true indicating that the from JSF component can have children.

Overrides:
isChildrenAllowed in class Builder
Returns:
true

assignNode

protected void assignNode(Node node,
                          ElementBean target)

This method resolves the jsfid attribute for an HTML element to a component definition in the XML configuration files.

Overrides:
assignNode in class Builder
Parameters:
node - markup
target - child config bean

isNodeWhitespace

protected boolean isNodeWhitespace(Node node)

Test the value of the node and returns true if the value is only whitespace.

Parameters:
node - markup node
Returns:
true if value of the node is only whitespace


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