Expresso 5-6

com.jcorporate.expresso.services.html
Class HtmlElement

java.lang.Object
  extended bycom.jcorporate.expresso.services.html.HtmlElement
Direct Known Subclasses:
Break, Button, Cell, CheckBox, DropDown, FileInput, Form, HiddenField, List, ListItem, Page, Paragraph, Radio, ReportPage, Row, StackTrace, Table, Text, TextArea, TextField

public abstract class HtmlElement
extends Object

Base class for all of the HTML elements on a page

Version:
$Revision: 1.12 $ $Date: 2004/11/17 20:48:18 $
Author:
Michael Nash

Field Summary
protected  Hashtable attributes
           
protected  Vector contents
           
protected  String cSSClass
           
protected  String cSSID
           
 
Constructor Summary
HtmlElement()
          Constructor
HtmlElement(HtmlElement newElement)
          Constructor Create the element with the given element as it's contents
HtmlElement(String elementName)
          Constructor Create an element with a name
 
Method Summary
 void add(HtmlElement newElement)
          Add a new element to this element's contents
protected  void display(OutputStream out)
          Alternate display method using an output stream
protected abstract  void display(PrintWriter out, int depth)
          Display the element to the client Each HtmlElement must implement this method
protected  void finalize()
          See if the object has been displayed
 Object getAttribute(String attribName)
          Get an attribute from this element
 int getContentCount()
          Return the count of contents in this item
 String getCSSClass()
           
 String getName()
          Return the name of this element
protected  void padWithTabs(PrintWriter out, int count)
          Pad the output with particular nesting tabs supplies in essence source formatting.
 void setAttribute(String attribName, Object attribValue)
          Set an attribute for this element
 void setCSSClass(String className)
           
 void setCSSID(String id)
           
protected  void setDisplayed()
          Mark this object as having been displayed
 void setName(String newName)
          Set the name of this element
protected  void setParent(HtmlElement newParent)
          Set the parent of this element to the named element
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

contents

protected Vector contents

cSSClass

protected String cSSClass

cSSID

protected String cSSID

attributes

protected Hashtable attributes
Constructor Detail

HtmlElement

public HtmlElement()
            throws HtmlException
Constructor

Throws:
HtmlException - If the superclass constructor fails

HtmlElement

public HtmlElement(HtmlElement newElement)
            throws HtmlException
Constructor Create the element with the given element as it's contents

Parameters:
newElement - Element to use as contents of this new element
Throws:
HtmlException - If the element cannot be used or the paramter is invalid

HtmlElement

public HtmlElement(String elementName)
            throws HtmlException
Constructor Create an element with a name

Parameters:
elementName - The name of the new element
Throws:
HtmlException - If the element cannot be created
Method Detail

add

public void add(HtmlElement newElement)
         throws HtmlException
Add a new element to this element's contents

Parameters:
newElement - Element to be added
Throws:
HtmlException - If the element cannot be added

display

protected void display(OutputStream out)
                throws HtmlException
Alternate display method using an output stream

Parameters:
out - Outputstream to use to display to the client
Throws:
HtmlException - If the element (or it's contents) cannot be displayed

display

protected abstract void display(PrintWriter out,
                                int depth)
                         throws HtmlException
Display the element to the client Each HtmlElement must implement this method

Parameters:
out - PrintWriter to display to the client
depth - the number of tabs to indent
Throws:
HtmlException - If the element (or it's contents) cannot be displayed

finalize

protected void finalize()
                 throws HtmlException
See if the object has been displayed

Throws:
HtmlException - if the object has never been displayed

getAttribute

public Object getAttribute(String attribName)
                    throws HtmlException
Get an attribute from this element

Parameters:
attribName - Name of the attribute to be set
Returns:
Value of the attribute
Throws:
HtmlException - If the attribute cannot be retrieved

getContentCount

public int getContentCount()
Return the count of contents in this item

Returns:
integer

getCSSClass

public String getCSSClass()
Returns:
CSS class

getName

public String getName()
               throws HtmlException
Return the name of this element

Returns:
String The name
Throws:
HtmlException - If the name cannot be accessed or the object has itself as a parent

padWithTabs

protected void padWithTabs(PrintWriter out,
                           int count)
Pad the output with particular nesting tabs supplies in essence source formatting.

Parameters:
out - the output stream
count - the number of tabs to display

setAttribute

public void setAttribute(String attribName,
                         Object attribValue)
                  throws HtmlException
Set an attribute for this element

Parameters:
attribName - Name of the attribute to be set
attribValue - Value of the attribute to be set
Throws:
HtmlException - If the attribute cannot be set

setCSSClass

public void setCSSClass(String className)
Parameters:
className - the CSS class name

setCSSID

public void setCSSID(String id)
Parameters:
id - the CSS id

setDisplayed

protected void setDisplayed()
                     throws HtmlException
Mark this object as having been displayed

Throws:
HtmlException - If the object has already been displayed

setName

public void setName(String newName)
             throws HtmlException
Set the name of this element

Parameters:
newName - The new name
Throws:
HtmlException - If the name cannot be set

setParent

protected void setParent(HtmlElement newParent)
                  throws HtmlException
Set the parent of this element to the named element

Parameters:
newParent - The new parent element of this element
Throws:
HtmlException - If the given element cannot be used as a parent or the parameter is invalid

Expresso 5-6

Please see www.jcorporate.com for information about new Expresso releases.