| java.lang.Object org.mortbay.html.Element
All known Subclasses: org.mortbay.html.Include, org.mortbay.html.DefList, org.mortbay.html.Composite, org.mortbay.html.Tag,
Element | abstract public class Element (Code) | | HTML Element.
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.
See Also: Page See Also: Composite version: $Id: Element.java,v 1.10 2005/08/13 00:01:23 gregwilkins Exp $ author: Greg Wilkins |
Constructor Summary | |
public | Element() Default constructor. | public | Element(String attributes) Construct with attributes. |
Method Summary | |
public Element | attribute(String attributes) Add element Attributes.
The attributes are added to the Element attributes (separated with
a space). | public Element | attribute(String attribute, Object value) Add quoted element Attributes and value. | public Element | attribute(String attribute, long value) Add quoted element Attributes and value. | public String | attributes() | public Element | attributes(String attributes) Add element Attributes.
The attributes are added to the Element attributes (separated with
a space). | public Element | bgColor(String color) set BGCOLOR.
Convenience method equivalent to attribute("bgcolor",color). | public Element | bottom() Bottom align.
Convenience method equivalent to attribute("valign","bottom"). | public Element | center() Center.
Convenience method equivalent to attribute("align","center"). | public Element | color(String color) set color.
Convenience method equivalent to attribute("color",color). | public Element | cssClass(String c) set CSS CLASS. | public Element | cssID(String id) set CSS ID. | public Element | height(int h) set height.
Convenience method equivalent to attribute("height",h). | public Element | height(String h) set height.
Convenience method equivalent to attribute("height",h). | public int | height() | public Element | left() left justify.
Convenience method equivalent to attribute("align","left"). | public Element | middle() Middle align.
Convenience method equivalent to attribute("valign","middle"). | public Element | right() right justify.
Convenience method equivalent to attribute("align","right"). | public Element | setAttributesFrom(Element e) Set attributes from another Element. | public Element | size(int s) set size.
Convenience method equivalent to attribute("size",s). | public Element | size(String s) set size.
Convenience method equivalent to attribute("size",s). | public int | size() | public Element | style(String style) set Style. | public String | toString() Convert Element to String. | public Element | top() Top align.
Convenience method equivalent to attribute("valign","top"). | public Element | width(int w) set width.
Convenience method equivalent to attribute("width",w). | public Element | width(String w) set width.
Convenience method equivalent to attribute("width",w). | public int | width() | abstract public void | write(Writer out) Write element to a Writer.
This abstract method is called by the Page or other containing
Element to write the HTML for this element. | public void | write(OutputStream out) Write Element to an OutputStream. | public void | write(OutputStream out, String encoding) Write Element to an OutputStream. |
noAttributesALIGNLEFTRIGHTCENTERVALIGNTOPBOTTOMMIDDLEWIDTHHEIGHTSIZECOLORBGCOLORSTYLECLASSID | final public static String noAttributesALIGNLEFTRIGHTCENTERVALIGNTOPBOTTOMMIDDLEWIDTHHEIGHTSIZECOLORBGCOLORSTYLECLASSID(Code) | | |
Element | public Element()(Code) | | Default constructor.
|
Element | public Element(String attributes)(Code) | | Construct with attributes.
Parameters: attributes - The initial attributes of the element |
attribute | public Element attribute(String attributes)(Code) | | 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 attributes
Parameters: attributes - String of HTML attributes to add to the element.A null attribute clears the current attributes. This Element so calls can be chained. |
attribute | public Element attribute(String attribute, Object value)(Code) | | Add quoted element Attributes and value.
Parameters: attribute - String of HTML attribute tag Parameters: value - String value of the attribute to be quoted This Element so calls can be chained. |
attribute | public Element attribute(String attribute, long value)(Code) | | Add quoted element Attributes and value.
Parameters: attribute - String of HTML attribute tag Parameters: value - String value of the attribute to be quoted This Element so calls can be chained. |
attributes | public Element attributes(String attributes)(Code) | | 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 attributes
Parameters: attributes - String of HTML attributes to add to the element. This Element so calls can be chained. |
bgColor | public Element bgColor(String color)(Code) | | set BGCOLOR.
Convenience method equivalent to attribute("bgcolor",color). Not
applicable to all Elements.
|
bottom | public Element bottom()(Code) | | Bottom align.
Convenience method equivalent to attribute("valign","bottom"). Not
applicable to all Elements.
|
center | public Element center()(Code) | | Center.
Convenience method equivalent to attribute("align","center"). Not
applicable to all Elements.
|
color | public Element color(String color)(Code) | | set color.
Convenience method equivalent to attribute("color",color). Not
applicable to all Elements.
|
cssID | public Element cssID(String id)(Code) | | set CSS ID.
Convenience method equivalent to attribute("id",id).
|
height | public Element height(int h)(Code) | | set height.
Convenience method equivalent to attribute("height",h). Not
applicable to all Elements.
|
height | public Element height(String h)(Code) | | set height.
Convenience method equivalent to attribute("height",h). Not
applicable to all Elements.
|
height | public int height()(Code) | | |
left | public Element left()(Code) | | left justify.
Convenience method equivalent to attribute("align","left"). Not
applicable to all Elements.
|
middle | public Element middle()(Code) | | Middle align.
Convenience method equivalent to attribute("valign","middle"). Not
applicable to all Elements.
|
right | public Element right()(Code) | | right justify.
Convenience method equivalent to attribute("align","right"). Not
applicable to all Elements.
|
setAttributesFrom | public Element setAttributesFrom(Element e)(Code) | | Set attributes from another Element.
Parameters: e - Element This Element |
size | public Element size(int s)(Code) | | set size.
Convenience method equivalent to attribute("size",s). Not
applicable to all Elements.
|
size | public Element size(String s)(Code) | | set size.
Convenience method equivalent to attribute("size",s). Not
applicable to all Elements.
|
style | public Element style(String style)(Code) | | set Style.
Convenience method equivalent to attribute("style",style).
|
toString | public String toString()(Code) | | Convert Element to String.
Uses write() to convert the HTML Element to a string.
String of the HTML element |
top | public Element top()(Code) | | Top align.
Convenience method equivalent to attribute("valign","top"). Not
applicable to all Elements.
|
width | public Element width(int w)(Code) | | set width.
Convenience method equivalent to attribute("width",w). Not
applicable to all Elements.
|
width | public Element width(String w)(Code) | | set width.
Convenience method equivalent to attribute("width",w). Not
applicable to all Elements.
|
write | abstract public void write(Writer out) throws IOException(Code) | | Write element to a Writer.
This abstract method is called by the Page or other containing
Element to write the HTML for this element. This must be implemented
by the derived Element classes.
Parameters: out - Writer to write the element to. |
write | public void write(OutputStream out) throws IOException(Code) | | Write Element to an OutputStream.
Calls print(Writer) and checks errors
Elements that override this method should also override
write(Writer) to avoid infinite recursion.
Parameters: out - OutputStream to write the element to. |
write | public void write(OutputStream out, String encoding) throws IOException(Code) | | Write Element to an OutputStream.
Calls print(Writer) and checks errors
Elements that override this method should also override
write(Writer) to avoid infinite recursion.
Parameters: out - OutputStream to write the element to. |
|
|