Experimenting with TextFlow from JavaFX8


I’ve spend tonight doing some experiments with combining the org.eclipse.text-Support and JavaFXs new TextFlow which allows to one to render complex texts. The result of this 3 hours is astonishing! I have a working SourceViewer (please note it is ONLY a viewer without editing support!).

Here are some screenshots:
screen_1

screen_2

screen_3

I’ve recorded a small video so that you can see it in action:

The scrolling performance is great but you’ll notice that the initial rendering of big files (> 10.000 lines) takes some time. So while this is Ok for a prototype time has to be spend on the performance for a real world app (I also hope there are optimization possibilities in JavaFX itself), adding editing needs logic to only modify parts of the TextFlow model but I hope I can find some time to give it a try.

About these ads

8 Responses to “Experimenting with TextFlow from JavaFX8”

  1. Nice Tom! The initial time you see is not rendering time (as rendering is limited by clipping, which I’m assuming the scrollview provides). The time is in analyzing the text and generating the glyphs. If you ever implement editing this will be a major problem too as the TextFlow will re-analyze the entire text every key stroke. The design we used in Orion (and Eclipse) is to have a text model object (and an annotation model for the styles) for backing store and only to set the visible text in the TextFlow. One way to do that is to use one TextFlow per line of text. That makes you view virtual, so it doesn’t matter how huge you document is, the performance will be the same.

  2. Very nice. What kind of JavaFX control is behind the SourceViewer?

Trackbacks/Pingbacks

  1. JavaFX links of the week, February 18 // JavaFX News, Demos and Insight // FX Experience - February 17, 2013

    [...] Schindl also blogged this week about experimenting with the new JavaFX rich text support coming in JavaFX 8.0. He has essentially built a working source code viewer (with proper syntax [...]

  2. Speeding up TextFlow for JavaFX8 (by a factor of ~100) | Tomsondev Blog - February 19, 2013

    [...] at the end of last week I blogged about my experiments to get a styled text viewer for (java) source using the new TextFlow-Support in JavaFX8, I did a short screencast and there you noticed that for [...]

  3. Interview with Tom Schindl // JavaFX News, Demos and Insight // FX Experience - February 22, 2013

    [...] it is you’ve been working on? In the last week I’ve been working on a StyledTextArea (Blog 1, Blog 2, Blog 3). Developers interact with such a control day by day when using their favorite IDE [...]

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 714 other followers

%d bloggers like this: