Package net.sf.jasperreports.engine.util
Class JRStyledTextParser
java.lang.Object
net.sf.jasperreports.engine.util.JRStyledTextParser
- All Implemented Interfaces:
ErrorHandler
- Author:
- Teodor Danciu (teodord@users.sourceforge.net)
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionvoid
void
static JRStyledTextParser
Return a cached instance.static Locale
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.static void
void
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.write
(JRStyledText styledText) Outputs a styled text String given a styled text instance.write
(JRStyledText styledText, int startIndex, int endIndex) Outputs the String representation of a styled text chunk.void
writeChunk
(StyledTextWriteContext context, StringBuilder sb, Map<AttributedCharacterIterator.Attribute, Object> parentAttrs, Map<AttributedCharacterIterator.Attribute, Object> attrs, String chunk)
-
Method Details
-
getInstance
Return a cached instance.- Returns:
- a cached instance
-
setLocale
-
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 attributestext
- the (either styled or unstyled) textisStyledText
- flag indicating that the text is styledlocale
- the locale for the text- Returns:
- a styled text object
-
write
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 attributesiterator
- iterator of styled text attributestext
- the text- Returns:
- the String styled text representation
-
write
Outputs the String representation of a styled text chunk.- Parameters:
styledText
- the styled textstartIndex
- the start indexendIndex
- the end index- Returns:
- the String styled text representation of the chunk delimited by the start index and the end index
- See Also:
-
writeChunk
public void writeChunk(StyledTextWriteContext context, StringBuilder sb, Map<AttributedCharacterIterator.Attribute, Object> parentAttrs, Map<AttributedCharacterIterator.Attribute, Object> attrs, String chunk) -
error
- Specified by:
error
in interfaceErrorHandler
-
fatalError
- Specified by:
fatalError
in interfaceErrorHandler
-
warning
- Specified by:
warning
in interfaceErrorHandler
-