net.sf.jasperreports.engine.util
Class JRStyledTextParser

java.lang.Object
  extended by net.sf.jasperreports.engine.util.JRStyledTextParser
All Implemented Interfaces:
ErrorHandler

public class JRStyledTextParser
extends Object
implements ErrorHandler

Version:
$Id: JRStyledTextParser.java 5180 2012-03-29 13:23:12Z teodord $
Author:
Teodor Danciu (teodord@users.sourceforge.net)

Method Summary
 void error(SAXParseException e)
           
 void fatalError(SAXParseException e)
           
static JRStyledTextParser getInstance()
          Return a cached instance.
static Locale getLocale()
           
 JRStyledText getStyledText(Map<AttributedCharacterIterator.Attribute,Object> parentAttributes, String text, boolean isStyledText, Locale locale)
          Creates a styled text object by either parsing a styled text String or by wrapping an unstyled String.
 JRStyledText parse(Map<AttributedCharacterIterator.Attribute,Object> attributes, String text, Locale locale)
           
static void setLocale(Locale locale)
           
 void warning(SAXParseException e)
           
 String write(JRStyledText styledText)
          Outputs a styled text String given a styled text instance.
 String write(JRStyledText styledText, int startIndex, int endIndex)
          Outputs the String representation of a styled text chunk.
 String write(Map<AttributedCharacterIterator.Attribute,Object> parentAttrs, AttributedCharacterIterator iterator, String text)
          Outputs a styled text String given a set of element-level styled text attributes and a styled text in the form of a String text and an iterator of style attributes.
 void writeChunk(StringBuffer sbuffer, Map<AttributedCharacterIterator.Attribute,Object> parentAttrs, Map<AttributedCharacterIterator.Attribute,Object> attrs, String chunk)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static JRStyledTextParser getInstance()
Return a cached instance.

Returns:
a cached instance

setLocale

public static void setLocale(Locale locale)

getLocale

public static Locale getLocale()

parse

public JRStyledText parse(Map<AttributedCharacterIterator.Attribute,Object> attributes,
                          String text,
                          Locale locale)
                   throws SAXException
Throws:
SAXException

getStyledText

public JRStyledText getStyledText(Map<AttributedCharacterIterator.Attribute,Object> parentAttributes,
                                  String text,
                                  boolean isStyledText,
                                  Locale locale)
Creates a styled text object by either parsing a styled text String or by wrapping an unstyled String.

Parameters:
parentAttributes - the element-level styled text attributes
text - the (either styled or unstyled) text
isStyledText - flag indicating that the text is styled
locale - the locale for the text
Returns:
a styled text object

write

public String write(JRStyledText styledText)
Outputs a styled text String given a styled text instance.

Parameters:
styledText - the styled text object
Returns:
the String styled text representation

write

public String write(Map<AttributedCharacterIterator.Attribute,Object> parentAttrs,
                    AttributedCharacterIterator iterator,
                    String text)
Outputs a styled text String given a set of element-level styled text attributes and a styled text in the form of a String text and an iterator of style attributes.

Parameters:
parentAttrs - the element-level styled text attributes
iterator - iterator of styled text attributes
text - the text
Returns:
the String styled text representation

write

public String write(JRStyledText styledText,
                    int startIndex,
                    int endIndex)
Outputs the String representation of a styled text chunk.

Parameters:
styledText - the styled text
startIndex - the start index
endIndex - the end index
Returns:
the String styled text representation of the chunk delimited by the start index and the end index
See Also:
write(Map, AttributedCharacterIterator, String)

writeChunk

public void writeChunk(StringBuffer sbuffer,
                       Map<AttributedCharacterIterator.Attribute,Object> parentAttrs,
                       Map<AttributedCharacterIterator.Attribute,Object> attrs,
                       String chunk)

error

public void error(SAXParseException e)
Specified by:
error in interface ErrorHandler

fatalError

public void fatalError(SAXParseException e)
Specified by:
fatalError in interface ErrorHandler

warning

public void warning(SAXParseException e)
Specified by:
warning in interface ErrorHandler


Copyright © 2012. All Rights Reserved.