org.apache.ecs
Class Element

java.lang.Object
  |
  +--org.apache.ecs.Element
Direct Known Subclasses:
ElementAttributes

public abstract class Element
extends java.lang.Object
implements ElementFactory, AttributeRegistry

This class implements the ElementFactory.

Version:
$Id: Element.java,v 1.1.1.1 1999/04/20 01:18:57 jonbolt Exp $
Author:
Stephan Nagy, Jon S. Stevens

Field Summary
private  Filter attribute_filter
          Filter to use to escape attribute input
private  int case_type
          Default value to set case type
private  java.lang.String codeset
          What codeset are we going to use the default is 8859_1
private  java.util.Hashtable element
          Where to get the element definition from
private  boolean end_element
          Does this element need a closing tag?
private  java.lang.String end_modifier
          What the end modifier should be
private  boolean end_modifier_defined
          What the modifier should be...optimization variable
private  Filter filter
          Filter to use to escape input
private  boolean filter_attribute_state
          Should we filter the value of the element attributes
private  boolean filter_state
          Should we filter the value of <>VALUE</>
protected static java.lang.String NO_ATTRIBUTE_VALUE
          Does this element attribute value need a =""?
private  java.lang.String start_modifier
          What the start modifier should be
private  boolean start_modifier_defined
          What the modifier should be...optimization variable
private static java.lang.String VERSION
          Version number for codebase
 
Constructor Summary
Element()
          Base class for defining all elements.
 
Method Summary
 void addAttribute(java.lang.String attribute_name, java.lang.Object attribute_value)
          Add an attribute to the element.
protected  java.lang.String alterCase(java.lang.String value)
          Alter the case of this element so that it is rendered according to whatever the value of case_type is.
protected  boolean getAttributeFilterState()
          Find out if we want to filter the elements attributes or not.
 int getCase()
          Find out what case the element is supposed to be rendered in.
 java.lang.String getCodeSet()
          Find out what the current codeset is.
protected  java.util.Hashtable getElementHashEntry()
          Get the Hashtable representation of an element.
 java.lang.String getEndModifier()
          What is the element modifier for this tag.
private  boolean getEndModifierDefined()
          Modifier optimization
 Filter getFilter()
          Get the filter that is currently in use.
 boolean getFilterState()
          get the filter state of the element.
 java.lang.String getHtmlElementType()
          Find out what type of element this is.
 boolean getNeedClosingTag()
          Determine if this element needs to be closed.
 java.lang.String getStartModifier()
          What is the element modifier for this tag.
private  boolean getStartModifierDefined()
          Modifier optimization
 java.lang.String getVersion()
          What version of htmlGen is this?
 boolean hasAttribute(java.lang.String attribute)
           
 void output(java.io.OutputStream out)
          Add the element to the designated OutputStream.
 void output(java.io.PrintWriter pw)
          Add element to the designated PrintWriter.
 void removeAttribute(java.lang.String attribute_name)
           
 Element removeEndModifier()
          Remove the element modifier for this tag.
 Element removeStartModifier()
          Remove the element modifier for this tag.
 Element setAttributeFilter(Filter attribute_filter)
          Set up a new filter for all element attributes.
 Element setAttributeFilterState(boolean filter_attribute_state)
          Tell the element if we want to filter its attriubtes.
 void setCase(int case_type)
          Determine what case the html element should be rendered.
 void setCodeSet(java.lang.String codeset)
          Determine what codeset should be used.
 Element setEndModifier(java.lang.String modifier)
          Set the element modifier the default is no modifier.
private  void setEndModifierDefined(boolean val)
          Modifier optimization
 void setFilter(Filter filter)
          Override the default filter with a user supplied filter.
 void setFilterState(boolean filter_state)
          set the filter state of the element.
 void setHtmlElementType(java.lang.String html_element)
          Determine what type of element this is A,BR,EM,ACRONYM
 Element setModifier(java.lang.String modifier)
          Set the element modifier the default is no modifier.
 Element setModifier(java.lang.String start_modifier, java.lang.String end_modifier)
          Set the element modifier the default is no modifier.
 void setNeedClosingTag(boolean close)
          Does this element need a closing tag.
 Element setStartModifier(java.lang.String modifier)
          Set the element modifier the default is no modifier.
private  void setStartModifierDefined(boolean val)
          Modifier optimization
 java.lang.String toString()
          Override toString() method to print something meaningful
 java.lang.String toString(java.lang.String codeset)
          Override toString(encode) method to print something meaningful
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, wait, wait, wait
 

Field Detail

filter

private Filter filter
Filter to use to escape input

attribute_filter

private Filter attribute_filter
Filter to use to escape attribute input

filter_state

private boolean filter_state
Should we filter the value of <>VALUE</>

filter_attribute_state

private boolean filter_attribute_state
Should we filter the value of the element attributes

VERSION

private static final java.lang.String VERSION
Version number for codebase

case_type

private int case_type
Default value to set case type

element

private java.util.Hashtable element
Where to get the element definition from

end_element

private boolean end_element
Does this element need a closing tag?

NO_ATTRIBUTE_VALUE

protected static final java.lang.String NO_ATTRIBUTE_VALUE
Does this element attribute value need a =""?

codeset

private java.lang.String codeset
What codeset are we going to use the default is 8859_1

start_modifier

private java.lang.String start_modifier
What the start modifier should be

end_modifier

private java.lang.String end_modifier
What the end modifier should be

start_modifier_defined

private boolean start_modifier_defined
What the modifier should be...optimization variable

end_modifier_defined

private boolean end_modifier_defined
What the modifier should be...optimization variable
Constructor Detail

Element

public Element()
Base class for defining all elements.
Method Detail

getElementHashEntry

protected java.util.Hashtable getElementHashEntry()
Get the Hashtable representation of an element.

setModifier

public Element setModifier(java.lang.String modifier)
Set the element modifier the default is no modifier.
Parameters:
modifier - the modifier for the element a ? would result
in <? ?>

setStartModifier

public Element setStartModifier(java.lang.String modifier)
Set the element modifier the default is no modifier.
Parameters:
modifier - the modifier for the element a ? would result
in <? >

setEndModifier

public Element setEndModifier(java.lang.String modifier)
Set the element modifier the default is no modifier.
Parameters:
modifier - the modifier for the element a ? would result
in < ?>

getAttributeFilterState

protected boolean getAttributeFilterState()
Find out if we want to filter the elements attributes or not.

setAttributeFilterState

public Element setAttributeFilterState(boolean filter_attribute_state)
Tell the element if we want to filter its attriubtes.
Parameters:
filter_attribute_state - do we want to filter the attributes of this element?

setAttributeFilter

public Element setAttributeFilter(Filter attribute_filter)
Set up a new filter for all element attributes.
Parameters:
Filter - the filter we want to use for element attributes. By
default it is the same as is used for the value of the tag. It is assumed
that if you create a new filter you must want to use it.

setModifier

public Element setModifier(java.lang.String start_modifier,
                           java.lang.String end_modifier)
Set the element modifier the default is no modifier.
Parameters:
modifier - the modifier for the element a ? would result
in <? ?>

getStartModifier

public java.lang.String getStartModifier()
What is the element modifier for this tag.

getEndModifier

public java.lang.String getEndModifier()
What is the element modifier for this tag.

removeStartModifier

public Element removeStartModifier()
Remove the element modifier for this tag.

removeEndModifier

public Element removeEndModifier()
Remove the element modifier for this tag.

setStartModifierDefined

private void setStartModifierDefined(boolean val)
Modifier optimization

setEndModifierDefined

private void setEndModifierDefined(boolean val)
Modifier optimization

getStartModifierDefined

private boolean getStartModifierDefined()
Modifier optimization

getEndModifierDefined

private boolean getEndModifierDefined()
Modifier optimization

addAttribute

public void addAttribute(java.lang.String attribute_name,
                         java.lang.Object attribute_value)
Add an attribute to the element.
Specified by:
addAttribute in interface AttributeRegistry

removeAttribute

public void removeAttribute(java.lang.String attribute_name)
Specified by:
removeAttribute in interface AttributeRegistry

hasAttribute

public boolean hasAttribute(java.lang.String attribute)
Specified by:
hasAttribute in interface AttributeRegistry

setFilter

public void setFilter(Filter filter)
Override the default filter with a user supplied filter.

setFilterState

public void setFilterState(boolean filter_state)
set the filter state of the element.
Parameters:
filter_state - (true|false) do we want to use a filter? default true;

getFilterState

public boolean getFilterState()
get the filter state of the element.

getFilter

public Filter getFilter()
Get the filter that is currently in use.

getVersion

public java.lang.String getVersion()
What version of htmlGen is this?
Specified by:
getVersion in interface ElementFactory

setCase

public void setCase(int case_type)
Determine what case the html element should be rendered. Default is MIXEDCASE
Specified by:
setCase in interface ElementFactory

getCase

public int getCase()
Find out what case the element is supposed to be rendered in.
Specified by:
getCase in interface ElementFactory

setHtmlElementType

public void setHtmlElementType(java.lang.String html_element)
Determine what type of element this is A,BR,EM,ACRONYM
Specified by:
setHtmlElementType in interface ElementFactory

getHtmlElementType

public java.lang.String getHtmlElementType()
Find out what type of element this is.
Specified by:
getHtmlElementType in interface ElementFactory

setCodeSet

public void setCodeSet(java.lang.String codeset)
Determine what codeset should be used.

getCodeSet

public java.lang.String getCodeSet()
Find out what the current codeset is.

setNeedClosingTag

public void setNeedClosingTag(boolean close)
Does this element need a closing tag. Default is true
Specified by:
setNeedClosingTag in interface ElementFactory

getNeedClosingTag

public boolean getNeedClosingTag()
Determine if this element needs to be closed.
Specified by:
getNeedClosingTag in interface ElementFactory

alterCase

protected java.lang.String alterCase(java.lang.String value)
Alter the case of this element so that it is rendered according to whatever the value of case_type is. Default is MIXEDCASE

toString

public final java.lang.String toString()
Override toString() method to print something meaningful
Overrides:
toString in class java.lang.Object

toString

public final java.lang.String toString(java.lang.String codeset)
Override toString(encode) method to print something meaningful

output

public void output(java.io.OutputStream out)
Add the element to the designated OutputStream.

output

public void output(java.io.PrintWriter pw)
Add element to the designated PrintWriter.