also I have a business method that is disconnected...
# tornadofx
r
also I have a business method that is disconnected from javafx (mainly because I can call the same functionality from a commandline) and I was wondering what a decent way would be to link it up to a progressbar
k
This is what I'm doing (would be interested in feedback)
This function is in a non-FX library
when I call it from FX I pass in a update function that interacts with the progress indicator.
r
comes close to how I fixed it in my app, only I decided not to have a default implementation 🙂
Copy code
button("save") {
                    action {
                        runAsync(taskStatus) {
                            val url = controller.storyModel.url.value.replace("index.html", "");
                            makeBook(controller.storyModel.title.value, url, baseDirectory = controller.directory.replace("\\", "/")) { current, max ->
                                updateProgress((current + 1).toDouble(), max.toDouble())
                                updateMessage("${current+1} / $max")
                            }
                        }

                    }
                }
k
Since I've stopped worrying and learned to love
java.nio.files
I've managed to stop doing this
.replace("\\", "/")
all the time.
I've always thought it was a strange thing to need to do to "force" my code to work on windows.
The main code base I work with for the Navy is full of strings for paths -- the use of backslashes in them is a constant source of trouble because a large number of the developers think the universe is limited to Windows.
r
ROFL, you mean it isn't?
k
Hehe, well in the government it might as well be
r
I never understood this love for windows, allthough I am using it now 🙂 my very new hardware does not seem to play nice with my linux install
k
It all dates back to the FUD campaigns of the 80's I think
r
yeah M$soft really won that one.
k
It is funny, though. All the actual scientific computing folks do their serious work in Linux. It's like, okay we have a unix tool, now make sure it runs on Windows and write a windows gum wrapper for it so people can use it.
r
yes, make sure it has a nice GUI or people will not understand it
k
Its those gum wrapper writers that keep making assumptions about the platform and their work inevitably seeps back into the meaningful code
TornadoFX is really helping me there. Takes most of the suck out of desktop app development.
🎉 1
r
yeah but now I miss it at work 😞