Giter VIP home page Giter VIP logo

Comments (12)

AdamBien avatar AdamBien commented on August 28, 2024

Seems like a good idea. Will look at the problem. Do you encounter any performance problems?

from afterburner.fx.

aliebelt avatar aliebelt commented on August 28, 2024

I have a ListView with some graphical elements for every cell in the list (the list-cell-content is an afterburner.fx module).
In the list there are between 1 und 1.000 cells und I have about 10 of this ListViews.
So the GUI seems to hang on startup for some seconds (about 20 seconds in my case).

from afterburner.fx.

AdamBien avatar AdamBien commented on August 28, 2024

O.k. I will try to implement that, could you please re-test the asynchronous version?

from afterburner.fx.

aliebelt avatar aliebelt commented on August 28, 2024

No problem, I will test the asynchronous version and tell you the result :)

from afterburner.fx.

AdamBien avatar AdamBien commented on August 28, 2024

fxml is loaded asynchronously. Could you please test that? I'm curious about the performance difference.

from afterburner.fx.

aliebelt avatar aliebelt commented on August 28, 2024

Where can I find the changes? The last commit was 6 days ago.

from afterburner.fx.

AdamBien avatar AdamBien commented on August 28, 2024

The changes were pushed to maven central (1.4.2-SNAPSHOT). I will push the code in few minutes as well.

from afterburner.fx.

aliebelt avatar aliebelt commented on August 28, 2024

I've tested the changed version but there seems to be no difference.
I think the problem is that the getLoader() method is still blocking the FXApplication Thread because it's waiting for the Future to return when finished.

A solution may be to immediately return an empty container-node (e.g. a Region [*] ). When the Future has finished loading, the root-node of the FXMLLoader could be added to the children of the empty container-node which has been returned previously.

[*] A Region should be used to bind the size of the loaded content to the parent-node.

from afterburner.fx.

AdamBien avatar AdamBien commented on August 28, 2024

FXMLLoader is loaded within the edt. Does it work for you? I'm thinking about the asynchronous behavior :-)

from afterburner.fx.

aliebelt avatar aliebelt commented on August 28, 2024

It's still blocking the FXApplication Thread when the FXMLView loads the content (I have a simple ProgressBar in my main-view with progress=-1.0 and the bar-animation stops during loading the child-view).

The thing is that Platform.runLater(runnable); blocks the FXApplication Thread as long as the runnable is working.
The runLater only let the FXApplication Thread decide when to start the runnable.

from afterburner.fx.

AdamBien avatar AdamBien commented on August 28, 2024

The constructor invocation should not block. The get-invocation should. Does it work now with invokeLater? (my tests are green).
What about an asynchronous Future getView method? Then you could parallelise the whole process

from afterburner.fx.

aliebelt avatar aliebelt commented on August 28, 2024

So, back from a short vacation...
-> The constructor is not blocking (duration in my testcase: 7 Milliseconds in FXApplication Thread)
-> The getView method blocks (duration in my testcase: 5.070 Milliseconds in FXApplication Thread)

I like the idea of an additional getView method which returns a Future.
I would recommend to return a javafx.concurrent.Task<Parent>

from afterburner.fx.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.