Search in sources :

Example 1 with StyledTextParser

use of limelight.ui.text.StyledTextParser in project limelight by slagyr.

the class TextPanel method buildLines.

public synchronized void buildLines() {
    consumableArea = panel.getChildConsumableBounds();
    lines = new LinkedList<TextLayout>();
    if (text != null && text.length() > 0) {
        StyledTextParser parser = new StyledTextParser();
        textChunks = parser.parse(text);
        final Scene root = getRoot();
        if (// TODO MDM - It happens.... but how?  Ah!  Need to acquire tree lock when removing panels.
        root != null) {
            Map<String, RichStyle> styleMap = root.getStyles();
            for (StyledText styledText : textChunks) styledText.setupStyles(styleMap, getStyle(), this);
            // TODO MDM StyleObservers may cause a memory leak.  Styles keep track of panels that are no longer used?
            addLines();
        }
    }
}
Also used : StyledText(limelight.ui.text.StyledText) RichStyle(limelight.styles.RichStyle) StyledTextParser(limelight.ui.text.StyledTextParser) AttributedString(java.text.AttributedString) TextLayout(java.awt.font.TextLayout)

Aggregations

TextLayout (java.awt.font.TextLayout)1 AttributedString (java.text.AttributedString)1 RichStyle (limelight.styles.RichStyle)1 StyledText (limelight.ui.text.StyledText)1 StyledTextParser (limelight.ui.text.StyledTextParser)1