Package net.sf.jasperreports.engine.util
Class JRStyledText
- java.lang.Object
-
- net.sf.jasperreports.engine.util.JRStyledText
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
JRStyledText.Run
-
Field Summary
Fields Modifier and Type Field Description static String
EXCEPTION_MESSAGE_KEY_CANNOT_COPY_CHARACTERS
static String
PROPERTY_AWT_IGNORE_MISSING_FONT
static String
PROPERTY_AWT_SUPERSCRIPT_FIX_ENABLED
-
Constructor Summary
Constructors Constructor Description JRStyledText()
JRStyledText(Locale locale)
JRStyledText(Locale locale, String text)
JRStyledText(Locale locale, String text, Map<AttributedCharacterIterator.Attribute,Object> globalAttributes)
JRStyledText(Locale locale, String text, Map<AttributedCharacterIterator.Attribute,Object> globalAttributes, List<JRStyledText.Run> runs)
-
Method Summary
-
-
-
Field Detail
-
EXCEPTION_MESSAGE_KEY_CANNOT_COPY_CHARACTERS
public static final String EXCEPTION_MESSAGE_KEY_CANNOT_COPY_CHARACTERS
- See Also:
- Constant Field Values
-
PROPERTY_AWT_IGNORE_MISSING_FONT
public static final String PROPERTY_AWT_IGNORE_MISSING_FONT
- See Also:
- Constant Field Values
-
PROPERTY_AWT_SUPERSCRIPT_FIX_ENABLED
public static final String PROPERTY_AWT_SUPERSCRIPT_FIX_ENABLED
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
JRStyledText
public JRStyledText()
-
JRStyledText
public JRStyledText(Locale locale)
-
JRStyledText
public JRStyledText(Locale locale, String text, Map<AttributedCharacterIterator.Attribute,Object> globalAttributes)
-
JRStyledText
public JRStyledText(Locale locale, String text, Map<AttributedCharacterIterator.Attribute,Object> globalAttributes, List<JRStyledText.Run> runs)
-
-
Method Detail
-
append
public void append(String text)
-
addRun
public void addRun(JRStyledText.Run run)
-
length
public int length()
-
getText
public String getText()
-
getLocale
public Locale getLocale()
-
getAttributedString
public AttributedString getAttributedString()
-
consumeText
public void consumeText(StyledTextRunConsumer consumer)
-
getAwtAttributedString
public AttributedString getAwtAttributedString(JasperReportsContext jasperReportsContext, boolean ignoreMissingFont)
Returns an attributed string that contains the AWT font attribute, as the font is actually loaded.
-
getRuns
public List<JRStyledText.Run> getRuns()
-
setGlobalAttributes
public void setGlobalAttributes(Map<AttributedCharacterIterator.Attribute,Object> attributes)
-
getGlobalAttributes
public Map<AttributedCharacterIterator.Attribute,Object> getGlobalAttributes()
-
clone
protected Object clone() throws CloneNotSupportedException
- Overrides:
clone
in classObject
- Throws:
CloneNotSupportedException
-
cloneAttributesMap
protected static Map<AttributedCharacterIterator.Attribute,Object> cloneAttributesMap(Map<AttributedCharacterIterator.Attribute,Object> attributes)
-
cloneText
public JRStyledText cloneText()
Clones this object.- Returns:
- a clone of this object
-
insert
public void insert(String str, short[] offsets)
Inserts a string at specified positions in the styled text.The string is inserted in the style runs located at the insertion positions. If a style run finished right before the insertion position, the string will be part of this run (but not of the runs that start right after the insertion position).
- Parameters:
str
- the string to insertoffsets
- the incremental offsets of the positions at which to insert the string
-
-