Platform.runAndWait

XMLWordPrintable

    • Type: Enhancement
    • Resolution: Unresolved
    • Priority: P4
    • tbd
    • Affects Version/s: 7u10
    • Component/s: javafx
    • None

      As already documented in my other issue
      http://javafx-jira.kenai.com/browse/RT-22028
      which relates to this issue, JavaFX could be more helpful when programming in a multithreaded application.

      What I am suggesting now is a method corresponding to Swing's method SwingUtilities.invokeAndWait(). The method should be similar to the Platform.runLater() method, but instead of returning immediately, it should block until the FX thread has run the Runnable. This is highly relevant in situations where an application lets a separate thread carry out a lengthy task during which the UI should be updated, and the thread should not continue until the update is complete.

      As an example, in my application a user can type a street address in a text field. A separate thread will then look up the street address by calling our server. If the thread finds an address matching what the user typed, the thread should finish with a positive outcome allowing the user to continue his work. But if the thread finds that the address is misspelled the thread should finish with a negative outcome preventing the user from continuing his work before correcting the address. However, in some cases the misspelling will be trivial. The user might have written "Hollywood blvd" which should have been spelled with a capital "B". Here the thread should update the text field automatically with the text "Hollywood Blvd" *before* the thread finishes and allows the user to continue his work. This means the thread should invoke something like a Platform.blockUntilRun() which lets the thread update the text field but does not return until the text field update is complete. This way, the user will not be able to continue his work before the thread has corrected his spelling error.

            Assignee:
            Unassigned
            Reporter:
            Randahl Isaksen
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Imported: