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 (root != null) // TODO MDM - It happens.... but how? Ah! Need to acquire tree lock when // removing panels. { 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(); } } }