Package com.j3d.gen.guide
Class GuideFlow
java.lang.Object
com.j3d.engine.react.events.EventEmitter
com.j3d.gen.guide.GuideFlow
- All Implemented Interfaces:
EventEmitterInterface,EventListener
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) Supplier<GuidePanelAdapter> (package private) LinkedHashSet<GuideInfo> private final intThe debounce period in seconds to prevent rapid guide closing events.private LocalTimeThe last time a guide closing event was processed, used for debouncing.private intFields inherited from class com.j3d.engine.react.events.EventEmitter
registered -
Constructor Summary
ConstructorsConstructorDescriptionGuideFlow(Supplier<GuidePanelAdapter> adapterSupplier) Constructs a new GuideFlow with the given adapter supplier. -
Method Summary
Modifier and TypeMethodDescriptionAdds aGuideInfoto the flow.voidback()booleanfinished()Checks if all guides in the flow have been processed.intReturns the index of a givenGuideInfowithin the set of all guides ever processed.<K> voidonEvent(EventType event, EventPayload<K> properties) Handles events, specificallyEventType.GUIDE_CLOSINGto advance the guide flow.voidstart()Starts the guide flow by displaying the first guide in the queue.intReturns the total number of guides that were initially added to this flow.Methods inherited from class com.j3d.engine.react.events.EventEmitter
attachListener, broadcast, detachAll, detachListener, genericAttach, genericBroadcast, genericDetach, genericDetachAll, isAttached
-
Field Details
-
guides
-
totalSize
private int totalSize -
allGuides
LinkedHashSet<GuideInfo> allGuides -
adapterSupplier
Supplier<GuidePanelAdapter> adapterSupplier -
DEB
private final int DEBThe debounce period in seconds to prevent rapid guide closing events.- See Also:
-
lastTime
The last time a guide closing event was processed, used for debouncing.
-
-
Constructor Details
-
GuideFlow
Constructs a new GuideFlow with the given adapter supplier.- Parameters:
adapterSupplier- A supplier that provides instances ofGuidePanelAdapter.
-
-
Method Details
-
add
Adds aGuideInfoto the flow.- Parameters:
guideInfo- The guide information to add.- Returns:
- This GuideFlow instance for method chaining.
-
back
public void back() -
start
public void start()Starts the guide flow by displaying the first guide in the queue. If no guides are present, it shows a message dialog. It attaches listeners to the current guide and builds its UI. -
finished
public boolean finished()Checks if all guides in the flow have been processed.- Returns:
trueif there are no more guides to show,falseotherwise.
-
indexOf
Returns the index of a givenGuideInfowithin the set of all guides ever processed.- Parameters:
i- TheGuideInfoto find the index of.- Returns:
- The zero-based index of the guide, or -1 if the guide is not found.
-
totalSize
public int totalSize()Returns the total number of guides that were initially added to this flow.- Returns:
- The total count of guides.
-
onEvent
Handles events, specificallyEventType.GUIDE_CLOSINGto advance the guide flow.- Specified by:
onEventin interfaceEventListener- Type Parameters:
K- The type of the emitter of this event- Parameters:
event- The type of the event.properties- The payload containing event-specific data.
-