org.peaseplate.internal.chunk
Class WithBlock

java.lang.Object
  extended by org.peaseplate.chunk.AbstractChunk
      extended by org.peaseplate.chunk.AbstractBlock
          extended by org.peaseplate.internal.chunk.WithBlock
All Implemented Interfaces:
BlockHead, Chunk, ExpandableBlock

public final class WithBlock
extends AbstractBlock
implements ExpandableBlock


Constructor Summary
WithBlock(TemplateLocator locator, int line, int column, ICommand command)
           
 
Method Summary
 void addExpansion(BlockExpansion chunk)
          Add the specified chunk as expansion to this block.
 ICommand getCommand()
           
 boolean isEssential()
          Returns true if the chunk is essential, false otherwise.
 boolean isVisible()
          Returns true if the chunk is visible, false otherwise.
 void render(BuildContext context, java.io.Writer writer)
          Renders the chunk to the specified writer using the specified template context.
 java.lang.String toString()
          Returns a meaningful representation of this chunk
 
Methods inherited from class org.peaseplate.chunk.AbstractBlock
getBlock, renderBlock, setBlock
 
Methods inherited from class org.peaseplate.chunk.AbstractChunk
getColumn, getLine, getLocator
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.peaseplate.chunk.BlockHead
getBlock, renderBlock, setBlock
 
Methods inherited from interface org.peaseplate.chunk.Chunk
getColumn, getLine, getLocator
 

Constructor Detail

WithBlock

public WithBlock(TemplateLocator locator,
                 int line,
                 int column,
                 ICommand command)
Method Detail

getCommand

public ICommand getCommand()

addExpansion

public void addExpansion(BlockExpansion chunk)
                  throws TemplateException
Description copied from interface: ExpandableBlock
Add the specified chunk as expansion to this block.

Specified by:
addExpansion in interface ExpandableBlock
Parameters:
chunk - the chunk
Throws:
TemplateException - if the block does not like the specified chunk
See Also:
ExpandableBlock.addExpansion(org.peaseplate.chunk.BlockExpansion)

isVisible

public boolean isVisible()
Description copied from interface: Chunk
Returns true if the chunk is visible, false otherwise. A content chunk with only white spaces in it, is by definition not visible and not essential. It only gets essential if it's the only thing in the line.

Specified by:
isVisible in interface Chunk
Returns:
true if visible, false otherwise
See Also:
Chunk.isVisible()

isEssential

public boolean isEssential()
Description copied from interface: Chunk
Returns true if the chunk is essential, false otherwise. A code chunk is by default essential, a content chunk not if it contains just spaces.

Specified by:
isEssential in interface Chunk
Returns:
true if essential, false otherwise
See Also:
Chunk.isEssential()

render

public void render(BuildContext context,
                   java.io.Writer writer)
            throws TemplateException,
                   java.io.IOException
Description copied from interface: Chunk
Renders the chunk to the specified writer using the specified template context.

Specified by:
render in interface Chunk
Parameters:
context - the context
writer - the writer
Throws:
TemplateException - on occasion
java.io.IOException - on occasion
See Also:
Chunk.render(BuildContext, java.io.Writer)

toString

public java.lang.String toString()
Description copied from interface: Chunk
Returns a meaningful representation of this chunk

Specified by:
toString in interface Chunk
Overrides:
toString in class AbstractBlock
Returns:
a meaningful representation of this chunk
See Also:
Object.toString()


Copyright © 2008. All Rights Reserved.