org.mortbay.html
public abstract class Element extends Object
This abstract class is the base for all HTML Elements. The feature of an abstract HTML Element is that it can be added to HTML Pages, HTML Composites and several other HTML Elements derivations. Elements may also have attributes set, which are handled by the derived Element.
Version: $Id: Element.java,v 1.10 2005/08/13 00:01:23 gregwilkins Exp $
Field Summary | |
---|---|
static String | ALIGN |
protected Hashtable | attributeMap |
static String | BGCOLOR |
static String | BOTTOM |
static String | CENTER |
static String | CLASS |
static String | COLOR |
static String | HEIGHT |
static String | ID |
static String | LEFT |
static String | MIDDLE |
static String | noAttributes |
static String | RIGHT |
static String | SIZE |
static String | STYLE |
static String | TOP |
static String | VALIGN |
static String | WIDTH |
Constructor Summary | |
---|---|
Element() Default constructor. | |
Element(String attributes) Construct with attributes. |
Method Summary | |
---|---|
Element | attribute(String attributes) Add element Attributes.
|
Element | attribute(String attribute, Object value) Add quoted element Attributes and value. |
Element | attribute(String attribute, long value) Add quoted element Attributes and value. |
String | attributes() |
Element | attributes(String attributes) Add element Attributes.
|
Element | bgColor(String color) set BGCOLOR.
|
Element | bottom() Bottom align.
|
Element | center() Center.
|
Element | color(String color) set color.
|
Element | cssClass(String c) set CSS CLASS. |
Element | cssID(String id) set CSS ID.
|
Element | height(int h) set height.
|
Element | height(String h) set height.
|
int | height() |
Element | left() left justify.
|
Element | middle() Middle align.
|
Element | right() right justify.
|
Element | setAttributesFrom(Element e) Set attributes from another Element. |
Element | size(int s) set size.
|
Element | size(String s) set size.
|
int | size() |
Element | style(String style) set Style.
|
Element | top() Top align.
|
String | toString() Convert Element to String.
|
Element | width(int w) set width.
|
Element | width(String w) set width.
|
int | width() |
abstract void | write(Writer out) Write element to a Writer.
|
void | write(OutputStream out) Write Element to an OutputStream.
|
void | write(OutputStream out, String encoding) Write Element to an OutputStream.
|
Parameters: attributes The initial attributes of the element
Parameters: attributes String of HTML attributes to add to the element. A null attribute clears the current attributes.
Returns: This Element so calls can be chained.
Parameters: attribute String of HTML attribute tag value String value of the attribute to be quoted
Returns: This Element so calls can be chained.
Parameters: attribute String of HTML attribute tag value String value of the attribute to be quoted
Returns: This Element so calls can be chained.
Deprecated: Use attribute(String).
Add element Attributes. The attributes are added to the Element attributes (separated with a space). The attributes are available to the derived class in the protected member String attributesParameters: attributes String of HTML attributes to add to the element.
Returns: This Element so calls can be chained.
Parameters: e Element
Returns: This Element
Returns: String of the HTML element
Parameters: out Writer to write the element to.
Parameters: out OutputStream to write the element to.
Parameters: out OutputStream to write the element to.