public class Box extends ElementContainer
{
private Table border;
private Table body;
private ElementContainer text;  // or private TD text;

public Box()
{
border = new Table()
.set...
body = new Table()
.set...
.addElement( 
new TR()
.addElement(
new TD()  // or text
.addElement(text) ) );

border
.addElement( 
new TR()
.addElement(
new TD()  // or text
.addElement(body) ) );

this.addElement(border);
}

public set BorderColor(...)
{
    border.setBgColor(...)
}

public setBgColor(...)
{
body.setBgColor(...)
}

public addElement(...)
{
text.addElement(...);
}

}


----- Original Message ----- 
From: John Ky <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, February 06, 2000 7:01 PM
Subject: Composite Elements


> Hi list:
> 
> Is it possible to build composite elements using ECS?
> 
> For example:
> 
> If my HTML files contain many of these:
> 
> <table border=0 cellpadding=1 cellspacing=0 bgcolor=black><tr><td>
> <table border=0 cellpadding=1 cellspacing=0 bgcolor=white><tr><td>
>         <!-- Add text here -->
> </td></tr></table>
> </td></tr></table>
> 
> I want to be able to define a class Box so that it can produce the above
> HTML using the following code:
> 
> new Box()
>     .setBorderColor("black")
>     .setBGColor("white")
>     .addElement("<!-- Add text here -->");
> 
> Essentially, I want the Box Composite element to act within Java as
> a normal element, yet produce many nested HTML elements.
> 
> Can ECS do this, or is it possible to extend ECS to do this sort of
> thing?
> 
> Thanks.
> 
> John.
> 
> 
> __________________________________________________
> Do You Yahoo!?
> Talk to your friends online with Yahoo! Messenger.
> http://im.yahoo.com
> 
> 
> --
> ------------------------------------------------------------
> To subscribe:        [EMAIL PROTECTED]
> To unsubscribe:      [EMAIL PROTECTED]
> Archives and Other:  <http://java.apache.org/main/mail.html>
> Problems?:           [EMAIL PROTECTED]
> 



--
------------------------------------------------------------
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
Archives and Other:  <http://java.apache.org/main/mail.html>
Problems?:           [EMAIL PROTECTED]

Reply via email to