|
Forward Computing and Control Pty. Ltd. WebStringTemplate V1.5.0 2004/1/7 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.antlr.stringtemplate.StringTemplate
au.com.forward.webstringtemplate.WebStringTemplate
A WebStringTemplate.
This class holds both the page template and the data map.
See the documentation for details of its use.
Nested Class Summary |
Nested classes inherited from class java.util.Map |
java.util.Map.Entry |
Field Summary | |
static java.lang.String |
DATA_CSS_FILE_PATH
The name of the default HTML data map style file (dataStyle.css). |
static java.lang.String |
DATA_CSS_NAME
The name of the default HTML data map style resource (dataStyle.css). |
static int |
DEFAULT_BUFFER_SIZE
Default buffer size, 8192 |
static int |
DEFAULT_MAX_DEPTH
Default recursion level (3) used when writing out the HTML data map. |
static java.util.logging.Logger |
logger
The Java Logger for this class |
static java.lang.String |
OUTPUT_BUFFER_SIZE
The name of the attibute (wst.bufferSize) that sets the output buffer size for this template |
static java.lang.String |
OUTPUT_DATA_DEFINITION_FLAG
The name of the attribute (wst.outputDataDefinition) that controls writing out the attribute map as a HTML data definition map. |
static java.lang.String |
OUTPUT_MAX_DEPTH
The name of the attribute (wst.outputDataDefinition.maxDepth) that sets the recursion depth when writing out the HTML data map. |
static java.lang.String |
OUTPUT_SHOW_ALL_FLAG
The name of the attribute (wst.outputDataDefinition.showAll) that controls if all attributes should be output. |
static java.lang.String |
OUTPUT_SHOW_FILTERS_FLAG
The name of the attribute (wst.outputDataDefinition.showFilters) that controls if all the filter class name used for this string should be output before the string. |
static java.lang.String |
VERSION
The version number - 1.5 |
static java.lang.String |
VERSION_DATE
The version date 22th Jan. 2004 |
static java.lang.String |
WST_ATTRIBUTE_START
Description of the Field |
static java.lang.String |
WST_COMMENT_ENDING
The attribute name ending (.comment) that signifies an attribute comment (case insensitive). |
Constructor Summary | |
WebStringTemplate(WebStringTemplateGroup group)
Create a blank template with no pattern and an empty attribute data map |
|
WebStringTemplate(WebStringTemplateGroup group,
java.util.Map initialValues)
Create a blank template with this data map of values |
|
WebStringTemplate(WebStringTemplateGroup group,
java.lang.String template)
Create an anonymous template with no name, but with a group |
Method Summary | |
void |
addAttribute(java.lang.String name,
java.lang.Object value)
Adds an attribute for this template data map. |
java.lang.String |
attributeHashtableToHTML(java.util.Map table,
java.lang.String title,
java.lang.String styleSheetPath)
Outputs the template data map as a HTML data map. |
void |
attributeHashtableToHTML(java.util.Map table,
java.lang.String title,
java.lang.String styleSheetPath,
int maxLevel,
java.io.Writer out)
Outputs the template data map as a HTML data map. |
void |
clear()
Removes all mappings from this template data map. |
boolean |
containsKey(java.lang.Object key)
Returns true if this template data map contains a mapping for the specified key. |
boolean |
containsValue(java.lang.Object value)
Returns true if this template data map maps one or more keys to the specified value. |
java.lang.Object |
convertToArrayList(java.lang.Object value)
Convert value to arrayList if needed. |
java.lang.String |
convertToString(java.lang.Object obj)
Convert to string and trim leading and trailing spaces |
static java.lang.String |
dataEscape(java.lang.String input)
Replaces non-ascii chars with unicode escapes and replaces in data output with , wrapps the whole in |
java.util.Set |
entrySet()
Returns a set view of the mappings contained in this template data map. |
java.lang.Object |
get(java.lang.Object key)
Returns the value to which this template data map maps the specified key. |
java.lang.Object |
get(StringTemplate self,
java.lang.String attribute)
Resolve an attribute reference. |
java.lang.Object |
getAttribute(java.lang.String name)
Gets the attribute value from this WebStringTemplate object. |
java.lang.String |
getNameForPath()
Gets the nameForPath attribute of the WebStringTemplate object |
int |
getOutputBufferSize()
The buffer size of the internal StringBuffer is controlled by the wst.buffersize attribute or set to
8192 bytes if this attribute is missing or not an integer. |
WebStringTemplateGroup |
getWebStringTemplateGroup()
Gets the group of this WebStringTemplate. |
boolean |
isEmpty()
Returns true if this template data map contains no key-value mappings. |
java.util.Set |
keySet()
Returns a set view of the keys contained in this template data map. |
static java.lang.String |
loadConvert(java.lang.String theString)
Converts encoded \uxxxx to unicode chars matches saveConvert in WebStringTemplate |
java.lang.Object |
put(java.lang.Object attributeName,
java.lang.Object value)
Associates the specified value with the specified attribute name in this template data map. |
void |
putAll(java.util.Map t)
Copies all of the mappings from the specified map to this map. |
java.lang.Object |
remove(java.lang.Object key)
Removes the mapping for this key from this template data map if it is present. |
void |
setAttribute(java.lang.String name,
java.lang.Object value)
Set an attribute. |
void |
setGroup(StringTemplateGroup group)
Sets the group of this WebStringTemplate |
void |
setTemplate(java.lang.String template)
un-encode Unicode characters before passing to StringTemplate |
void |
setWebStringTemplateGroup(WebStringTemplateGroup group)
Sets the group of this WebStringTemplate |
int |
size()
Returns the number of key-value mappings in this template data map. |
boolean |
skipThisAttibute(java.lang.String attributeName)
Is this attribute name to be skipped when outputting the HTML data map. |
boolean |
skipThisClass(java.lang.String className)
Should this class be skipped when output the values of the data map. |
boolean |
skipThisMethod(java.lang.String methodName)
Should this method be skipped when doing object introspection. |
boolean |
testObjectTrue(java.lang.Object a)
Tests if an object is not false. |
java.lang.String |
toString()
Output this template, using the current attribute data map. |
java.util.Collection |
values()
Returns a collection view of the values contained in this template data map. |
java.lang.Object |
wrapWithFilter(java.lang.Object value,
IWSTFilter filter)
Wrap an object with the given filter, but only if the object is not already wrapped. |
void |
write(java.io.Writer out)
Output this template, using the current attribute data map. |
Methods inherited from class org.antlr.stringtemplate.StringTemplate |
checkForTrouble, debug, error, error, getArgumentContext, getArgumentsAST, getAttributes, getChunks, getErrorListener, getGroup, getInstanceOf, getInstanceOfWithAttributes, getName, getTemplate, getTemplateID, inLintMode, isDebugMode, removeAttribute, reset, setArgumentContext, setArgumentsAST, setAttributes, setDebugMode, setEnclosingInstance, setErrorListener, setLintMode, setName, toDebugString, warning |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface java.util.Map |
equals, hashCode |
Field Detail |
public static final java.util.logging.Logger logger
public static final java.lang.String VERSION
public static final java.lang.String VERSION_DATE
public static final java.lang.String WST_ATTRIBUTE_START
public static final java.lang.String OUTPUT_BUFFER_SIZE
public static final java.lang.String OUTPUT_DATA_DEFINITION_FLAG
public static final java.lang.String OUTPUT_MAX_DEPTH
wst.outputDataDefinition
is not false.
public static final java.lang.String OUTPUT_SHOW_ALL_FLAG
wst.outputDataDefinition
is not false.
public static final java.lang.String OUTPUT_SHOW_FILTERS_FLAG
wst.outputDataDefinition
is not false.
public static final java.lang.String WST_COMMENT_ENDING
public static final java.lang.String DATA_CSS_NAME
public static final java.lang.String DATA_CSS_FILE_PATH
public static final int DEFAULT_MAX_DEPTH
public static final int DEFAULT_BUFFER_SIZE
Constructor Detail |
public WebStringTemplate(WebStringTemplateGroup group)
group
- the group to attach this template to. Must be a WebStringTemplateGroup
*public WebStringTemplate(WebStringTemplateGroup group, java.util.Map initialValues)
group
- the group to attach this template to. Must be a WebStringTemplateGroup
*initialValues
- the data map of values. No check is made that this map
has valid keys.public WebStringTemplate(WebStringTemplateGroup group, java.lang.String template)
group
- the group to attach this template to. Must
be a WebStringTemplateGroup
template
- the template as a String
java.lang.IllegalArgumentException
- if group null or not a WebStringTemplateGroup
Method Detail |
public void setGroup(StringTemplateGroup group)
setGroup
in class StringTemplate
group
- The new group. Must be a WebStringTemplateGroup
. Cannot be null.
java.lang.IllegalArgumentException
- if group null or not a WebStringTemplateGroup
public WebStringTemplateGroup getWebStringTemplateGroup()
WebStringTemplateGroup
WebStringTemplateGroup
public void setWebStringTemplateGroup(WebStringTemplateGroup group)
group
- The new group. Cannot be null.
java.lang.IllegalArgumentException
- if group nullpublic void setAttribute(java.lang.String name, java.lang.Object value)
setAttribute
in class StringTemplate
name
- The attribute namevalue
- The new attribute valuepublic java.lang.Object getAttribute(java.lang.String name)
get(this,name)
getAttribute
in class StringTemplate
name
- the attribute key
public java.lang.Object get(StringTemplate self, java.lang.String attribute)
get
in class StringTemplate
self
- the StringTemplate to look in firstattribute
- the attribute key
public java.lang.String getNameForPath()
public void setTemplate(java.lang.String template)
setTemplate
in class StringTemplate
template
- The new template valuepublic java.lang.Object get(java.lang.Object key)
get
in interface java.util.Map
key
- the String key whose associated value is to be
returned.
java.lang.ClassCastException
- if the key is not a String.containsKey(Object)
public java.lang.Object put(java.lang.Object attributeName, java.lang.Object value)
If the attribute name ends in .extension, look for assocaited filter. If a
filter is found then strip the extension and wrap value in the filter, only
if it not already wrapped.
names that start with wst. are control attributes and are not check for
filter extensions.
put
in interface java.util.Map
attributeName
- the name of this of this value.value
- value to be associated with this attribute
name.
java.lang.ClassCastException
- if the attributeName is not a String.
java.lang.IllegalArgumentException
- if the key is not a valid attributeName
(i.e [. | _ | alpha][. | _ | alpha | digit]* )public int size()
size
in interface java.util.Map
public boolean isEmpty()
isEmpty
in interface java.util.Map
public boolean containsKey(java.lang.Object key)
containsKey
in interface java.util.Map
key
- the String key whose presence in this map is to
be tested.
java.lang.ClassCastException
- if the key is not a String.public boolean containsValue(java.lang.Object value)
containsValue
in interface java.util.Map
value
- value whose presence in this map is to be
tested.
java.lang.NullPointerException
- if the value is null .public java.lang.Object remove(java.lang.Object key)
Returns the value to which the map previously associated the key, or null if the map contained no mapping for this key. The map will not contain a mapping for the specified key once the call returns.
remove
in interface java.util.Map
key
- the String key whose mapping is to be removed
from the map.
java.lang.ClassCastException
- if the key is not a String.
java.lang.NullPointerException
- if the key is null .public void putAll(java.util.Map t)
putAll
in interface java.util.Map
t
- map to put
java.lang.UnsupportedOperationException
- if the putAll method is
called.public void clear()
clear
in interface java.util.Map
public java.util.Set keySet()
keySet
in interface java.util.Map
public java.util.Collection values()
values
in interface java.util.Map
public java.util.Set entrySet()
Map.Entry
. The set
is backed by the map, so changes to the map are reflected in the set, and
vice-versa. If the map is modified while an iteration over the set is in
progress, the results of the iteration are undefined. The set supports
element removal, which removes the corresponding mapping from the map, via
the Iterator.remove , Set.remove , removeAll ,
retainAll and clear operations. It does not support the
add or addAll operations.
entrySet
in interface java.util.Map
public boolean testObjectTrue(java.lang.Object a)
testObjectTrue
in class StringTemplate
a
- the object to test
public java.lang.Object wrapWithFilter(java.lang.Object value, IWSTFilter filter)
value
- the object to wrapfilter
- the fiter to wrap it in, if it is not already wrapped. If
null use the filter returned by WebStringTemplateGroup.getDefaultFilter()
.
public java.lang.String convertToString(java.lang.Object obj)
convertToString
in class StringTemplate
obj
- the object to convert
public java.lang.Object convertToArrayList(java.lang.Object value)
convertToArrayList
in class StringTemplate
value
- the object to convert
WebStringTemplateGroup.getDefaultFilter()
, , unless the element was
already wrapped.public void addAttribute(java.lang.String name, java.lang.Object value)
name
- The name of this attributevalue
- the value associated with this attribute
name. Null values are saved as ""
java.lang.NullPointerException
- if name is null
IllegalArguementException
- if the name does not match [. | _ |
alpha][. | _ | alpha | digit]*public static java.lang.String dataEscape(java.lang.String input)
input
- the string to escape
public static java.lang.String loadConvert(java.lang.String theString)
theString
- the string to convert
public java.lang.String attributeHashtableToHTML(java.util.Map table, java.lang.String title, java.lang.String styleSheetPath)
The output is controlled by the wst.outputDataDefinition.showAll
and wst.outputDataDefinition.maxDepth
settings.
table
- the template data map to output. (Should work for any
map.)styleSheetPath
- the style sheet path for an external stylesheet or
null to embed the default one in the output file.title
- the title of the HTML output page
public void attributeHashtableToHTML(java.util.Map table, java.lang.String title, java.lang.String styleSheetPath, int maxLevel, java.io.Writer out) throws java.io.IOException
The output is controlled by the wst.outputDataDefinition.showAll
setting.
table
- the template data map to output. (Should work for
any map.)styleSheetPath
- the style sheet path for an external stylesheet or
null to embed the default one in the output file.title
- the title of the HTML output pagemaxLevel
- the maximum depth to recurse to when outputting.out
- Description of the Parameter
java.io.IOException
- Description of the Exceptionpublic boolean skipThisMethod(java.lang.String methodName)
methodName
- the name of the method
public boolean skipThisClass(java.lang.String className)
className
- the string class name of this object.
public boolean skipThisAttibute(java.lang.String attributeName)
attributeName
- the attribute name.
public java.lang.String toString()
wst.outputDataDefinition
is not false then instead of processing the
template, output the attributes as a HTML page.
toString
in class StringTemplate
write(java.io.Writer)
or attributeHashtableToHTML()
public int getOutputBufferSize()
wst.buffersize
attribute or set to
8192 bytes if this attribute is missing or not an integer.
public void write(java.io.Writer out) throws java.io.IOException
wst.outputDataDefinition
is not false then instead of processing the
template, output the attributes as a HTML page.
write
in class StringTemplate
out
- Description of the Parameter
java.io.IOException
- Description of the Exception
|
Forward Computing and Control Pty. Ltd. WebStringTemplate V1.5.0 2004/1/7 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |