Verified Owner
Top Fields Constructors Methods
org.jabref.gui.walkthrough.utils

public Class WalkthroughReverter

extends Object
Class Inheritance
Imports
java.util.Optional, javafx.beans.value.ChangeListener, javafx.scene.Node, javafx.stage.Window, javafx.util.Duration, org.jabref.gui.util.DelayedExecution, org.jabref.gui.walkthrough.Walkthrough, org.jabref.gui.walkthrough.declarative.WindowResolver, org.jabref.gui.walkthrough.declarative.sideeffect.SideEffectExecutor, .WalkthroughSideEffect, org.jabref.gui.walkthrough.declarative.step.SideEffect, .VisibleComponent, .WalkthroughStep, com.sun.javafx.scene.NodeHelper, org.jspecify.annotations.NonNull, .Nullable, org.slf4j.Logger, .LoggerFactory

Field Summary

Modifier and TypeField and Description
private final Window
private static final Logger
private @Nullable ChangeListener<Boolean>
private @Nullable Node
private @Nullable Window
private @Nullable DelayedExecution
private static final Duration
REVERSION_DELAY

The use of delay is related to the following error that can be reproduced as of 00fc407:

If the "Add Group" walkthrough is launched, the following action is performed:

  1. Launch walkthrough
  2. Create the new group "Research Papers"
  3. In step 8 (i.e., immediately after the new group is created), click on other group
  4. The reversion occur because the first-entry that are present in the "All Groups" is not visible
  5. IndexOutOfBoundsException is thrown by JavaFX and the walkthrough become entirely non-responsive.
private final SideEffectExecutor
private final Walkthrough
private @Nullable ChangeListener<Boolean>

Constructor Summary

AccessConstructor and Description
public
WalkthroughReverter(@NonNull Walkthrough walkthrough, @NonNull Window fallbackWindow, @NonNull SideEffectExecutor sideEffectExecutor)

Method Summary

Modifier and TypeMethod and Description
public void
attach(@NonNull Window resolvedWindow, @Nullable Node resolvedNode)

public void
public void
public void
private void
undo(int stepIndex)

private void
undoTo(int from)

Reverts the walkthrough to the last valid step before the given index.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

fallbackWindowback to summary
private final Window fallbackWindow
LOGGERback to summary
private static final Logger LOGGER
nodeVisibleListenerback to summary
private @Nullable ChangeListener<Boolean> nodeVisibleListener
resolvedNodeback to summary
private @Nullable Node resolvedNode
resolvedWindowback to summary
private @Nullable Window resolvedWindow
reversionback to summary
private @Nullable DelayedExecution reversion
REVERSION_DELAYback to summary
private static final Duration REVERSION_DELAY

The use of delay is related to the following error that can be reproduced as of 00fc407:

If the "Add Group" walkthrough is launched, the following action is performed:

  1. Launch walkthrough
  2. Create the new group "Research Papers"
  3. In step 8 (i.e., immediately after the new group is created), click on other group
  4. The reversion occur because the first-entry that are present in the "All Groups" is not visible
  5. IndexOutOfBoundsException is thrown by JavaFX and the walkthrough become entirely non-responsive.

It's not clear why such delay fixes this issue, but it's necessary. A possible hypothesis is that a re-render occurred during the change in the selection state, which leads to restoration to the default event dispatcher and error due to the monkey-patched dispatcher isn't perfectly compatible with JavaFX's inner work.

sideEffectExecutorback to summary
private final SideEffectExecutor sideEffectExecutor
walkthroughback to summary
private final Walkthrough walkthrough
windowShowingListenerback to summary
private @Nullable ChangeListener<Boolean> windowShowingListener

Constructor Detail

WalkthroughReverterback to summary
public WalkthroughReverter(@NonNull Walkthrough walkthrough, @NonNull Window fallbackWindow, @NonNull SideEffectExecutor sideEffectExecutor)

Method Detail

attachback to summary
public void attach(@NonNull Window resolvedWindow, @Nullable Node resolvedNode)
detachback to summary
public void detach()
findAndUndoback to summary
public void findAndUndo()
revertAllback to summary
public void revertAll()
undoback to summary
private void undo(int stepIndex)
undoToback to summary
private void undoTo(int from)

Reverts the walkthrough to the last valid step before the given index. This method assumes that the step in the given index is not valid anymore without checking whether it's valid.