Implementation of walkthrough infrastructure - #13182
Conversation
|
So far I like the idea.
|
|
This refs #12664 somehow :) |
calixtus
left a comment
There was a problem hiding this comment.
First half of first iteration through review. More to come on the weekend.
Co-authored-by: Subhramit Basu <subhramit.bb@live.in>
subhramit
left a comment
There was a problem hiding this comment.
Just some small nits when reading otherwise lgtm
| CompletableFuture<Void> timeoutFuture = CompletableFuture.runAsync(() -> { | ||
| try { | ||
| Thread.sleep(HANDLER_TIMEOUT_MS); | ||
| } catch (InterruptedException e) { | ||
| Thread.currentThread().interrupt(); | ||
| } | ||
| }); |
There was a problem hiding this comment.
I think this entire class could make use of some more javadoc - I sense high cognitive load on if someone wants to work on this in future. Things like, why we are using a completable future, etc.
But these refinements can be done in future, we can get this in and start focusing on the next steps.
| .filter(menuItem -> Optional.ofNullable(menuItem.getGraphic()) | ||
| .map(graphic -> graphic.equals(node) | ||
| || Stream.iterate(graphic, Objects::nonNull, Node::getParent) | ||
| .anyMatch(cm -> cm.equals(node))) |
There was a problem hiding this comment.
If I am not wrong on the expansion:
| .filter(menuItem -> Optional.ofNullable(menuItem.getGraphic()) | |
| .map(graphic -> graphic.equals(node) | |
| || Stream.iterate(graphic, Objects::nonNull, Node::getParent) | |
| .anyMatch(cm -> cm.equals(node))) | |
| .filter(menuItem -> Optional.ofNullable(menuItem.getGraphic()) | |
| .map(graphic -> graphic.equals(node) | |
| || Stream.iterate(graphic, Objects::nonNull, Node::getParent) | |
| .anyMatch(contextMenu -> contextMenu.equals(node))) |
|
@Yubo-Cao please apply suggestions from @subhramit , then we merge. |
|
@trag-bot didn't find any issues in the code! ✅✨ |
| event.consume(); | ||
| beforeNavigate.run(); | ||
|
|
||
| CompletableFuture<Void> handlerFuture = new CompletableFuture<>(); |
There was a problem hiding this comment.
This variable is never read? -> always handlerFtuure.complete(null) passed. What is the intention?
There was a problem hiding this comment.
The intention is that we run onNavigate after the original handler has completed, or a timeout has occurred, or a new window has been created, whichever comes first. To allow for such checking, the handler's future is used more as a signal to indicate that the original handler has finished.
| /// @param event the event to navigate | ||
| static <T extends Event> void navigate( | ||
| Runnable beforeNavigate, | ||
| EventHandler<? super T> originalHandler, |
There was a problem hiding this comment.
Annotate with @Nullable (the other ones are non-null, aren't they?)
| /// - The handler has timed out after HANDLER_TIMEOUT_MS milliseconds. | ||
| /// - A new window has been opened, or an existing window has been closed. | ||
| /// | ||
| /// Those conditions ensure that we will still navigate if original handler is blocking (e.g., showing a dialog, |
Closes N/A
Initial implementation of the walkthrough feature. See this Google Drive video for demonstration: https://drive.google.com/file/d/19sUz1XoSjP0UkuhUvKQE-MZjmVASy2ot/view?usp=sharing
The completion of the walkthrough is also tracked through modifying the preferences class.
This refs #12664
Mandatory checks
CHANGELOG.mddescribed in a way that is understandable for the average user (if change is visible to the user)