Richtextfx: EventHandlerHelper.install( no longer available

Created on 14 Jul 2016  路  10Comments  路  Source: FXMisc/RichTextFX

Hi there,

in several examples EventHandlerHelper.install( is used. What is the replacement?

Thanks,
Michael

All 10 comments

Ok,

        Nodes.addInputMap(codeArea, sequence(
                consume(keyPressed(TAB), e -> codeArea.replaceSelection("    "))
        ));

seems to do the trick. See issue #86

Yes, that should do it.
The sequence() part is only necessary if you want multiple mappings inside one object. Otherwise, the single consume() should work fine.

Glad you figured it out.

in several examples EventHandlerHelper.install( is used.

Do you mean just in answers to old tickets, or have you found an outdated demo/example elsewhere on this site or elsewhere on the internet?

A quick GitHub search brought me to some Javadoc: https://github.com/TomasMikula/RichTextFX/search?utf8=%E2%9C%93&q=EventHandlerHelper.install%28

BTW, that's how I use your editor components:

screenshot 2016-07-14 18 24 52

Works great!

Thanks, this needs to be updated.

Looks cool, is that some visual programming environment for computer graphics?

It's actually a general purpose environment for a subset of Groovy/Java with the ultimate goal to cover Java. The code is automatically visualized. It's a bidirectional mapping between code and UI. Changing the UI maps to code changes and vice versa.

Running the code will insert the runtime data into the UI. The window colors are from code-coverage/profiling. 3D graphics are just a cool example for that.

Interesting. So the graphics are just a form of "runtime data"?

Yes, the 3D graphics are just runtime objects. The system just needs a catalog of visualizations for common types, e.g. int, double, String, Image, CSG (3d meshes), etc.

My motivation is this:

I love visual programming. But I hate the fact that common visual programming environments invent their own language for that which only works in their IDE. I imagine a system where everything is just code. No matter if it's visual or textual. That's up to the user/developer. And the cool thing is, you can even use parts of the code visualization as end-user UI. If users change the content of the text fields, the code will change as well. And they can't introduce syntax errors. That means less manual UI development and more coding.

This fix does not seem to work for me.

Nodes.addInputMap(codeArea, InputMap.sequence(
                        InputMap.consume(EventPattern.keyPressed(KeyCode.TAB), e -> codeArea.replaceSelection("    "))));

Gives me the following runtime exception:

java.lang.NoSuchMethodError: org.fxmisc.wellbehaved.event.EventPattern.getEventTypes()Ljava/util/Set;
    at org.fxmisc.wellbehaved.event.PatternActionMap.forEachEventType(InputMap.java:201)
    at org.fxmisc.wellbehaved.event.InputMapChain.forEachEventType(InputMap.java:233)
    at org.fxmisc.wellbehaved.event.InputMapChain.forEachEventType(InputMap.java:233)
    at org.fxmisc.wellbehaved.event.Nodes.lambda$init$28(Nodes.java:63)
    at com.sun.javafx.collections.MapListenerHelper$SingleChange.fireValueChangedEvent(MapListenerHelper.java:163)
    at com.sun.javafx.collections.MapListenerHelper.fireValueChangedEvent(MapListenerHelper.java:72)
    at com.sun.javafx.collections.ObservableMapWrapper.callObservers(ObservableMapWrapper.java:115)
    at com.sun.javafx.collections.ObservableMapWrapper.put(ObservableMapWrapper.java:169)
    at org.fxmisc.wellbehaved.event.Nodes.setInputMap(Nodes.java:42)
    at org.fxmisc.wellbehaved.event.Nodes.addInputMap(Nodes.java:24)
        .... a few more lines

I'm using richtextfx-fat-0.6.10 and wellbehavedfx-0.3.

On another note: In this and every other example you seem to call the sequence() and consume() methods without referring to the class they belong to. I couldn't do that without compile errors, am I missing something? Maybe I'm calling the wrong consume() or sequence() method?

I'm using richtextfx-fat-0.6.10

This is documentation for 0.7-M2 or later / SNAPSHOT versions.

On another note: In this and every other example you seem to call the sequence() and consume() methods without referring to the class they belong to. I couldn't do that without compile errors, am I missing something?

Proper static imports.

Was this page helpful?
0 / 5 - 0 ratings