{"push_id":2306669566,"size":1,"distinct_size":1,"ref":"refs/heads/727-helpwindow-interferes-with-ui","head":"f838547066c2a0bad47add7134571f00478295ff","before":"258ed0cddc71fcf2cec05293aaf96276333b62a1","commits":[{"sha":"f838547066c2a0bad47add7134571f00478295ff","author":{"name":"Vivek","email":"9242cbc2dcaf463b55d4776ca7152eb62652a5f3@gmail.com"},"message":"HelpWindow: modify HelpWindow#show() to use Stage#show()\n\nSome UI components do not function properly once the help window is \nopened by typing help in the command box. For instance, the command box \ndoes not display the result message of subsequent commands. However, \nthis does not occur when opening the help window by pressing F1 or \npressing help from the help menu. \n\nThis occurs due to a combination of using the default Dispatcher used by \nthe Guava EventBus system, Dispatcher#perThreadDispatchQueue() along \nwith calling Stage#showAndWait(). Calling Stage#showAndWait(), starts a \nnested event loop to handle subsequent JavaFX events. However, the \ndefault Dispatcher used by the EventBus does not allow nested callback \ninvocations, and instead queues them to be invoked after the current \ninvoked callback completes. This callback is the nested event loop \nstarted by Stage#showAndWait() which only dispatches JavaFX events. As \nsuch, EventBus events are queued up in the meantime resulting in the \nsubscribers of these events to wait until the nested event loop is \nterminated. Therefore, the UI components that subscribe to the EventBus \nevents do not receive them in a timely manner and will not be updated.\n\nHowever, in the case of pressing F1 or pressing help from the help menu, \nthe MainWindow#handleHelp() is called immediately without posting an \nEventBus event. As such, a nested event loop is not started and \nsubsequent EventBus events get dispatched as usual.\n\nLet's replace Stage#showAndWait() with Stage#show(), so \nthat there will be no entering of a nested loop and hence no blockage \nof the Guava EventBus system.\n\nLikewise, this could be fixed by using the Dispatcher#immediate() \ndispatcher instead of the default dispatcher used by the Guava EventBus \nsystem. However, replacing Stage#showAndWait() with Stage#show() is \nmore suitable in this case as it is sufficient to show the help window \ninstead of starting a nested event loop to handle subsequent JavaFX \nevents while waiting for the help window to be closed.\n\nJavaFX documentation for Stage:\nhttps://docs.oracle.com/javase/8/javafx/api/javafx/stage/Stage.html\n\nCode and documentation for the Guava Dispatcher:\nhttps://github.com/google/guava/blob/master/guava/src/com/google/common/eventbus/Dispatcher.java\n\nMore information on the Guava EventBus system:\nhttps://github.com/google/guava/wiki/EventBusExplained","distinct":true,"url":"https://api.github.com/repos/vivekscl/addressbook-level4/commits/f838547066c2a0bad47add7134571f00478295ff"}]}
{"actor":{"display_login":"vivekscl"}}