Package com.j3d.gen.guide
Class GuideInfo
java.lang.Object
com.j3d.engine.react.events.EventEmitter
com.j3d.gen.guide.GuideInfo
- All Implemented Interfaces:
EventEmitterInterface,EventListener
- Direct Known Subclasses:
CommandPaletteStep,DoubleClickStep,SceneExplStep,SelectionStep
-
Field Summary
FieldsFields inherited from class com.j3d.engine.react.events.EventEmitter
registered -
Constructor Summary
ConstructorsConstructorDescriptionGuideInfo(EventEmitterInterface listeningTo) Constructs a new GuideInfo instance, setting up the event emitter it should listen to. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddCompAt(GuidePanelAdapter adapter, Component l, int anchor) Adds a component to the guide panel at a position determined by an anchor with no offsets.voidaddCompAt(GuidePanelAdapter adapter, Component l, int anchor, int offX, int offY) Adds a component to the guide panel at a position determined by an anchor and offsets.voidaddCompAtCentre(GuidePanelAdapter adapter, Component l) Adds a component to the center of the guide panel with no offset.voidaddCompAtCentre(GuidePanelAdapter adapter, Component l, int offX, int offY) Adds a component to the center of the guide panel with specified X and Y offsets.(package private) voidAttaches listeners for this guide.voidCleans up the guide step by removing all associated UI components from the adapter and detaching itself as a listener from the `listeningTo` EventEmitterInterface, if it was attached.voidbuild(GuidePanelAdapter adapter) Builds the UI components for this guide step using the provided adapter.voidclose()Initiates the closing process for this guide step.voidgenericText(GuidePanelAdapter adapter, String text) Adds a generic text label to the guide panel at a predefined position (SOUTH | WEST).Returns the list of UI components associated with this guide step.getId()Returns the unique identifier for this guide step.voidguideCounter(GuidePanelAdapter adapter) Displays a guide counter (e.g., "1 of 5") on the guide panel.Creates and returns a JLabel containing an image loaded from the given URL, scaled by the specified factor.<K> voidonEvent(EventType event, EventPayload<K> properties) Handles incoming events.Methods inherited from class com.j3d.engine.react.events.EventEmitter
attachListener, broadcast, detachAll, detachListener, genericAttach, genericBroadcast, genericDetach, genericDetachAll, isAttached
-
Field Details
-
components
-
listeningTo
-
id
-
-
Constructor Details
-
GuideInfo
Constructs a new GuideInfo instance, setting up the event emitter it should listen to.- Parameters:
listeningTo- The EventEmitterInterface instance to listen for events from.
-
-
Method Details
-
onEvent
Handles incoming events.- Specified by:
onEventin interfaceEventListener- Type Parameters:
K- The type of the emitter associated with the event.- Parameters:
event- The type of event that occurred.properties- The payload containing data related to the event.
-
attachListeners
Attaches listeners for this guide. It attaches itself to the provided GuideFlow and also attaches itself as a listener to the `listeningTo` EventEmitterInterface, if set.- Parameters:
f- The GuideFlow to which this GuideInfo should attach its listener.
-
build
Builds the UI components for this guide step using the provided adapter. Subclasses should override this method to define their specific guide content.- Parameters:
adapter- The GuidePanelAdapter used to add and manage UI components.
-
close
public void close()Initiates the closing process for this guide step. It broadcasts aEventType.GUIDE_CLOSINGevent with aGuideInfoClosingPayload. -
breakdown
public void breakdown()Cleans up the guide step by removing all associated UI components from the adapter and detaching itself as a listener from the `listeningTo` EventEmitterInterface, if it was attached. -
getComponents
Returns the list of UI components associated with this guide step.- Returns:
- An ArrayList of Component objects managed by this guide step.
-
getId
Returns the unique identifier for this guide step.- Returns:
- The UUID of this GuideInfo instance.
-
guideCounter
Displays a guide counter (e.g., "1 of 5") on the guide panel. The counter indicates the current guide step's position within the overall flow.- Parameters:
adapter- The GuidePanelAdapter to which the counter label will be added.
-
image
Creates and returns a JLabel containing an image loaded from the given URL, scaled by the specified factor.- Parameters:
url- The URL of the image to load.scale- The scaling factor to apply to the image (e.g., 0.5 for half size).- Returns:
- A JLabel with the scaled image icon.
- Throws:
RuntimeException- if there is aURISyntaxExceptionwhen converting the URL to a URI.
-
genericText
Adds a generic text label to the guide panel at a predefined position (SOUTH | WEST). The text is styled usingInlineHTMLwith a specific font color and size.- Parameters:
adapter- The GuidePanelAdapter to which the text label will be added.text- The string content to display in the label.
-
addCompAtCentre
Adds a component to the center of the guide panel with specified X and Y offsets. The component is also added to this guide's internal list of components.- Parameters:
adapter- The GuidePanelAdapter to which the component will be added.l- The Component to add.offX- The horizontal offset from the center.offY- The vertical offset from the center.
-
addCompAtCentre
Adds a component to the center of the guide panel with no offset. The component is also added to this guide's internal list of components.- Parameters:
adapter- The GuidePanelAdapter to which the component will be added.l- The Component to add.
-
addCompAt
Adds a component to the guide panel at a position determined by an anchor and offsets. The component is also added to this guide's internal list of components.- Parameters:
adapter- The GuidePanelAdapter to which the component will be added.l- The Component to add.anchor- A bitmask representing the desired anchor point (e.g.,Anchor.NORTH,Anchor.SOUTH,Anchor.EAST,Anchor.WEST,Anchor.CENTRE).offX- The horizontal offset from the calculated anchor position. (UseAnchor.offsetRight(int)andAnchor.offsetLeft(int))offY- The vertical offset from the calculated anchor position. (UseAnchor.offsetUp(int)andAnchor.offsetDown(int))
-
addCompAt
Adds a component to the guide panel at a position determined by an anchor with no offsets. The component is also added to this guide's internal list of components.- Parameters:
adapter- The GuidePanelAdapter to which the component will be added.l- The Component to add.anchor- A bitmask representing the desired anchor point (e.g.,Anchor.NORTH,Anchor.SOUTH,Anchor.EAST,Anchor.WEST,Anchor.CENTRE).
-