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.
Modifier and Type | Field and Description |
---|---|
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 and Description |
---|
Element()
Default constructor.
|
Element(String attributes)
Construct with attributes.
|
Modifier and Type | Method and Description |
---|---|
Element |
attribute(String attributes)
Add element Attributes.
|
Element |
attribute(String attribute,
long value)
Add quoted element Attributes and value.
|
Element |
attribute(String attribute,
Object value)
Add quoted element Attributes and value.
|
String |
attributes() |
Element |
attributes(String attributes)
Deprecated.
Use attribute(String).
|
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.
|
int |
height() |
Element |
height(int h)
set height.
|
Element |
height(String h)
set height.
|
Element |
left()
left justify.
|
Element |
middle()
Middle align.
|
Element |
right()
right justify.
|
Element |
setAttributesFrom(Element e)
Set attributes from another Element.
|
int |
size() |
Element |
size(int s)
set size.
|
Element |
size(String s)
set size.
|
Element |
style(String style)
set Style.
|
Element |
top()
Top align.
|
String |
toString()
Convert Element to String.
|
int |
width() |
Element |
width(int w)
set width.
|
Element |
width(String w)
set width.
|
void |
write(OutputStream out)
Write Element to an OutputStream.
|
void |
write(OutputStream out,
String encoding)
Write Element to an OutputStream.
|
abstract void |
write(Writer out)
Write element to a Writer.
|
public static final String noAttributes
public static final String ALIGN
public static final String LEFT
public static final String RIGHT
public static final String CENTER
public static final String VALIGN
public static final String TOP
public static final String BOTTOM
public static final String MIDDLE
public static final String WIDTH
public static final String HEIGHT
public static final String SIZE
public static final String COLOR
public static final String BGCOLOR
public static final String STYLE
public static final String CLASS
public static final String ID
protected Hashtable attributeMap
public Element()
public Element(String attributes)
attributes
- The initial attributes of the elementpublic abstract void write(Writer out) throws IOException
out
- Writer to write the element to.IOException
public void write(OutputStream out) throws IOException
out
- OutputStream to write the element to.IOException
public void write(OutputStream out, String encoding) throws IOException
out
- OutputStream to write the element to.IOException
public String attributes()
public Element attributes(String attributes)
attributes
- String of HTML attributes to add to the element.public Element setAttributesFrom(Element e)
e
- Elementpublic Element attribute(String attributes)
attributes
- String of HTML attributes to add to the element.
A null attribute clears the current attributes.public Element attribute(String attribute, Object value)
attribute
- String of HTML attribute tagvalue
- String value of the attribute to be quotedpublic Element attribute(String attribute, long value)
attribute
- String of HTML attribute tagvalue
- String value of the attribute to be quotedpublic String toString()
public Element left()
public Element right()
public Element center()
public Element top()
public Element bottom()
public Element middle()
public Element width(int w)
public Element width(String w)
public int width()
public Element height(int h)
public Element height(String h)
public int height()
public Element size(int s)
public Element size(String s)
public int size()
public Element color(String color)
public Element bgColor(String color)
public Element cssID(String id)
Copyright © 2013. All Rights Reserved.