Project Wonder 2.0

er.extensions
Class ERXSimpleHTMLFormatter

java.lang.Object
  extended byjava.text.Format
      extended byer.extensions.ERXSimpleHTMLFormatter
All Implemented Interfaces:
Cloneable, Serializable

public class ERXSimpleHTMLFormatter
extends Format

This is a simple class for converting ASCII strings to HTML and vice versa. In the current implementation, all this class does is convert newlines to HTML breaks and tab characters to HTML <spacer> tags.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class java.text.Format
Format.Field
 
Field Summary
static ERXLogger log
          logging support
 
Constructor Summary
ERXSimpleHTMLFormatter()
           
 
Method Summary
 String applyFormat(Object anObject)
          Applies the HTML formatting to a given string object replacing ASCII formatting with HTML formatting.
 StringBuffer format(Object object, StringBuffer buffer, FieldPosition fp)
          The FieldPosition is not important, so this method just calls applyFormat and appends that string to the buffer.
static ERXSimpleHTMLFormatter formatter()
          Method used to retrieve the shared instance of the html formatter.
 String htmlStringFromString(String aString)
          Converts an ASCII string into an HTML string.
protected static String HTMLTab()
          Simple method used to get the url to the spacer gif s.gif from the WOResourceManager.
 Object parseObject(String inString)
          Converts an HTML string into an ASCII string.
 Object parseObject(String string, ParsePosition p)
          Converts an HTML string into an ASCII string starting from a given parse position.
 String stringForObjectValue(Object anObject)
          Accessor method used to convert an ASCII string into an HTML string.
 
Methods inherited from class java.text.Format
clone, format, formatToCharacterIterator
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

public static final ERXLogger log
logging support

Constructor Detail

ERXSimpleHTMLFormatter

public ERXSimpleHTMLFormatter()
Method Detail

HTMLTab

protected static String HTMLTab()
Simple method used to get the url to the spacer gif s.gif from the WOResourceManager.

Returns:
url to the space gif image set in an image ref

formatter

public static ERXSimpleHTMLFormatter formatter()
Method used to retrieve the shared instance of the html formatter.

Returns:
shared instance of the html formatter

htmlStringFromString

public String htmlStringFromString(String aString)
Converts an ASCII string into an HTML string.

Parameters:
aString - to be converted
Returns:
html-ified string

format

public StringBuffer format(Object object,
                           StringBuffer buffer,
                           FieldPosition fp)
The FieldPosition is not important, so this method just calls applyFormat and appends that string to the buffer.

Parameters:
object - to be formatted
buffer - to have the formatted object appended to
fp - ignored parameter
Returns:
buffer after having the format appended to it.

applyFormat

public String applyFormat(Object anObject)
                   throws IllegalArgumentException
Applies the HTML formatting to a given string object replacing ASCII formatting with HTML formatting.

Parameters:
anObject - to have the formatting applied to
Returns:
formatted object
Throws:
IllegalArgumentException

parseObject

public Object parseObject(String inString)
                   throws ParseException
Converts an HTML string into an ASCII string.

Parameters:
inString - HTML string
Returns:
ASCII-fied string
Throws:
ParseException

parseObject

public Object parseObject(String string,
                          ParsePosition p)
Converts an HTML string into an ASCII string starting from a given parse position.

Parameters:
string - HTML string
p - current parsing position
Returns:
ASCII representation of the string

stringForObjectValue

public String stringForObjectValue(Object anObject)
                            throws IllegalArgumentException
Accessor method used to convert an ASCII string into an HTML string.

Parameters:
anObject - string to convert
Throws:
IllegalArgumentException

Last updated: Do, Dez 9, 2004 • 12:46 PM CET

Copyright © 2002 – 2004 Project Wonder.