java - Wait for Runnables to finish -


i have implemented programm in javafx dynamically generates input mask , generates word-document after button click on mask.

i define in db-table input fields available in mask. i'm adding support custom procedures executed on specific states of program (onfocuslost of field,onchange,...) wich works perfect.

now i'm stuck @ ongenerate execution.

when render mask, hold list of runnables store actions should executed on generation (at render time know action should executed. @ generation time have read data in again. thought save action functionalinterface. , need no inputparameter , no returnvalue ... ended runnable)

textfield tf = ...; string s = ...;  actionsbeforegenerate.add(() -> {                 tf.settext(s);             }); 

so now, if press generate button, following:

private void startgenerate(){  //main.getactionsbeforegenerate() == list<runnable>  main.getactionsbeforegenerate().foreach(action -> action.run());   generateworddocument();   } 

the text set node correctly, after document generated.

how can change textfield before generationlogic starts?

if need more information, don't hesitate ask it.

edit:

i think i've found solution problem:

private void startgenerate(){  task<boolean> task = new task<boolean>() {            @override public boolean call() throws exception {     main.getactionsbeforegenerate().foreach(action -> action.run());     ....     generateworddocument();     ....     return boolean.true;   } };    thread thread = new thread(task); thread.setdaemon(true); thread.start(); } 

now have new values textfield values available in generateworddocument()


Comments

Popular posts from this blog

python - Healpy: From Data to Healpix map -

c - Bitwise operation with (signed) enum value -

xslt - Unnest parent nodes by child node -