SilverStream
Application Server 3.5

com.sssw.shr.page
Interface AgiPageContainer


public interface AgiPageContainer

AgiPageContainer is the base interface for all container classes. A container is a page control that embeds zero or more blocks of HTML. The container may show the content of the blocks any way it likes, including looping over some of them any number of times, hiding or showing some of them, and animating them.

Containers can be nested, just as tables can be nested. However, blocks within a container cannot be nested, just as cells cannot be nested.

Container and block are represented in HTML as table and table cell. In other words, they are represented by the <TABLE> and <TD> tags.

Custom containers generally do not implement AgiPageContainer directly. Rather, they should inherit from one of the four concrete container classes: AgpTable, AgpViewPanel, AgpLayoutPanel or AgpTabPanel. The page designer does not know how to interact with an arbitrary AgiPageContainer class that does not inherit from one of those four. But if a custom container inheriting from one of the four classes is dropped onto a page, the page designer will interact with it like its base class. The simplest way to create a custom container is just to inherit it from AgpTable.

When a container is constructed in loading, objects of type AgpBlock are added to the container through addBlock(). As implemented in SilverStream 2.0, the addBlock method is invoked when a cell is encountered in parsing the HTML.

There is also the concept of "groups" and a corresponding method defined in AgpContainer, addGroup(). Group is the generalized equivalence of table rows and are represented as such.

When the page generator reaches the beginning of the container, generateContainerBeginHTML() is invoked.

Then, it will invoke nextBlock(). The container will return the next block it wants to display. The page generator will invoke generateBlockBeginHTML(), the HTML inside the block, and generateBlockEndHTML(). After that, the generator will invoke nextBlock() again.

When there are no more blocks to generate, the container should return null for nextBlock(). At that point, generateContainerEndHTML() is invoked.


Method Summary
 void addBlock(AgpBlock block)
          Adds a block of type AgpBlock to the container.
 void generateBlockBeginHTML(AgpBlock block, String namespace, Writer writer)
          Invoked when the page generator reaches the beginning of the container.
 void generateBlockEndHTML(AgpBlock block, String namespace, Writer writer)
          Invoked after the next block is processed.
 void generateContainerBeginHTML(String namespace, Writer writer)
          Invoked when the page generator reaches the beginning of the container.
 void generateContainerEndHTML(String namespace, Writer writer)
          Invoked when there are no more blocks to generate.
 AgpBlock nextBlock()
          Invoked when the next block should be displayed.
 

Method Detail

addBlock

public void addBlock(AgpBlock block)
Adds a block of type AgpBlock to the container.
Parameters:
block - the block to add.
Example:
 

generateContainerBeginHTML

public void generateContainerBeginHTML(String namespace,
                                       Writer writer)
                                throws IOException
Invoked when the page generator reaches the beginning of the container.
Parameters:
namespace - a string containing the namespace.
writer - a character output stream.
Example:
 
See Also:
AgiPageContainer.generateBlockEndHTML(AgpBlock block, String namespace, Writer writer)

nextBlock

public AgpBlock nextBlock()
Invoked when the next block should be displayed.
Example:
 

generateBlockBeginHTML

public void generateBlockBeginHTML(AgpBlock block,
                                   String namespace,
                                   Writer writer)
                            throws IOException
Invoked when the page generator reaches the beginning of the container.
Parameters:
block - a block to invoke.
namespace - a string containing the namespace.
writer - a character output stream.
Example:
 
See Also:
AgiPageContainer.generateBlockEndHTML(AgpBlock block, String namespace, Writer writer)

generateBlockEndHTML

public void generateBlockEndHTML(AgpBlock block,
                                 String namespace,
                                 Writer writer)
                          throws IOException
Invoked after the next block is processed.
Parameters:
block - a block to invoke.
namespace - a string containing the namespace.
writer - a character output stream.
Example:
 
See Also:
AgiPageContainer.generateBlockBeginHTML(AgpBlock block, String namespace, Writer writer)

generateContainerEndHTML

public void generateContainerEndHTML(String namespace,
                                     Writer writer)
                              throws IOException
Invoked when there are no more blocks to generate.
Parameters:
namespace - a string containing the namespace.
writer - a character output stream.
Example:
 
See Also:
AgiPageContainer.generateContainerBeginHTML(String namespace, Writer writer)

SilverStream
Application Server 3.5