Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EventHandlerHelper.install( no longer available #339

Closed
miho opened this issue Jul 13, 2016 · 10 comments
Closed

EventHandlerHelper.install( no longer available #339

miho opened this issue Jul 13, 2016 · 10 comments

Comments

@miho
Copy link

miho commented Jul 13, 2016

Hi there,

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

Thanks,
Michael

@miho
Copy link
Author

miho commented Jul 13, 2016

Ok,

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

seems to do the trick. See issue #86

@JordanMartinez
Copy link
Contributor

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.

@TomasMikula
Copy link
Member

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?

@miho
Copy link
Author

miho commented Jul 14, 2016

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!

@TomasMikula
Copy link
Member

Thanks, this needs to be updated.

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

@miho
Copy link
Author

miho commented Jul 14, 2016

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.

@TomasMikula
Copy link
Member

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

@miho
Copy link
Author

miho commented Jul 14, 2016

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.

@isjns
Copy link

isjns commented Nov 22, 2016

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?

@alt-grr
Copy link

alt-grr commented Nov 22, 2016

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants