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

java.lang.Object
  extended by org.apache.shale.clay.parser.builder.Builder
      extended by org.apache.shale.clay.parser.builder.VerbatimBuilder
          extended by org.apache.shale.clay.parser.builder.CommentBuilder
Direct Known Subclasses:
IgnoreBuilder

public class CommentBuilder
extends VerbatimBuilder

This Builder will render a HTML Node as an HTML comment. All nodes under the comment will be concatenated as their original raw text value within the HTML document.


Field Summary
 
Fields inherited from class org.apache.shale.clay.parser.builder.Builder
messages
 
Constructor Summary
CommentBuilder()
           
 
Method Summary
protected  void captureComment(Node node, StringBuffer commentBody)
          Recursively traverses the children of the HTML Node concatenating the raw text of each Token into the commentBody.
protected  void encodeBegin(Node node, ElementBean target, ComponentBean root)
          The super implementation is invoked to build a target ElementBean.
protected  void encodeEnd(Node node, ElementBean target, ComponentBean root)
          This override cancels the super implementation.
protected  boolean getBuildNodeBody(Node node, ElementBean target)
          This method is overridden to return a true value indicating that this Builder will handle child nodes under the associated HTML Node.
 
Methods inherited from class org.apache.shale.clay.parser.builder.VerbatimBuilder
assignAttributes, getComponentType, getJsfid
 
Methods inherited from class org.apache.shale.clay.parser.builder.Builder
assignNode, createAttribute, createElement, encode, encodeChildren, getBuilder, getRenderId, isChildrenAllowed
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CommentBuilder

public CommentBuilder()
Method Detail

getBuildNodeBody

protected boolean getBuildNodeBody(Node node,
                                   ElementBean target)

This method is overridden to return a true value indicating that this Builder will handle child nodes under the associated HTML Node. This method can easily be confused with the isChildrenAllowed() method of the super class Builder. The distinction is that the isChildrenAllowed() method signifies that the associated JSF component supports children components. This method signifies that this builder will handle building child nodes similarly to the jsf component's getRendersChildren() method.

Overrides:
getBuildNodeBody in class Builder
Parameters:
node - markup
target - child config bean
Returns:
true

encodeBegin

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

The super implementation is invoked to build a target ElementBean. The body of the comment is constructed by capturing the text of all child HTML nodes within the comment body.

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

captureComment

protected void captureComment(Node node,
                              StringBuffer commentBody)

Recursively traverses the children of the HTML Node concatenating the raw text of each Token into the commentBody.

Parameters:
node - markup
commentBody - concatenated child node's raw text

encodeEnd

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

This override cancels the super implementation. The overridden method handles the ending comment tag, "-->".

Overrides:
encodeEnd in class VerbatimBuilder
Parameters:
node - markup
target - child config bean
root - parent config bean


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