Class JRStyledText

  • All Implemented Interfaces:
    java.lang.Cloneable

    public class JRStyledText
    extends java.lang.Object
    implements java.lang.Cloneable
    Author:
    Teodor Danciu (teodord@users.sourceforge.net)
    • Field Detail

      • EXCEPTION_MESSAGE_KEY_CANNOT_COPY_CHARACTERS

        public static final java.lang.String EXCEPTION_MESSAGE_KEY_CANNOT_COPY_CHARACTERS
        See Also:
        Constant Field Values
      • PROPERTY_AWT_IGNORE_MISSING_FONT

        public static final java.lang.String PROPERTY_AWT_IGNORE_MISSING_FONT
        See Also:
        Constant Field Values
      • PROPERTY_AWT_SUPERSCRIPT_FIX_ENABLED

        public static final java.lang.String PROPERTY_AWT_SUPERSCRIPT_FIX_ENABLED
        See Also:
        Constant Field Values
    • Constructor Detail

      • JRStyledText

        public JRStyledText()
      • JRStyledText

        public JRStyledText​(java.util.Locale locale)
      • JRStyledText

        public JRStyledText​(java.util.Locale locale,
                            java.lang.String text)
      • JRStyledText

        public JRStyledText​(java.util.Locale locale,
                            java.lang.String text,
                            java.util.Map<java.text.AttributedCharacterIterator.Attribute,​java.lang.Object> globalAttributes)
      • JRStyledText

        public JRStyledText​(java.util.Locale locale,
                            java.lang.String text,
                            java.util.Map<java.text.AttributedCharacterIterator.Attribute,​java.lang.Object> globalAttributes,
                            java.util.List<JRStyledText.Run> runs)
    • Method Detail

      • append

        public void append​(java.lang.String text)
      • length

        public int length()
      • getText

        public java.lang.String getText()
      • getLocale

        public java.util.Locale getLocale()
      • getAttributedString

        public java.text.AttributedString getAttributedString()
      • getAwtAttributedString

        public java.text.AttributedString getAwtAttributedString​(JasperReportsContext jasperReportsContext,
                                                                 boolean ignoreMissingFont)
        Returns an attributed string that contains the AWT font attribute, as the font is actually loaded.
      • setGlobalAttributes

        public void setGlobalAttributes​(java.util.Map<java.text.AttributedCharacterIterator.Attribute,​java.lang.Object> attributes)
      • getGlobalAttributes

        public java.util.Map<java.text.AttributedCharacterIterator.Attribute,​java.lang.Object> getGlobalAttributes()
      • clone

        protected java.lang.Object clone()
                                  throws java.lang.CloneNotSupportedException
        Overrides:
        clone in class java.lang.Object
        Throws:
        java.lang.CloneNotSupportedException
      • cloneAttributesMap

        protected static java.util.Map<java.text.AttributedCharacterIterator.Attribute,​java.lang.Object> cloneAttributesMap​(java.util.Map<java.text.AttributedCharacterIterator.Attribute,​java.lang.Object> attributes)
      • cloneText

        public JRStyledText cloneText()
        Clones this object.
        Returns:
        a clone of this object
      • insert

        public void insert​(java.lang.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 insert
        offsets - the incremental offsets of the positions at which to insert the string