Class GuideInfo

All Implemented Interfaces:
EventEmitterInterface, EventListener
Direct Known Subclasses:
CommandPaletteStep, DoubleClickStep, SceneExplStep, SelectionStep

public class GuideInfo extends EventEmitter implements EventListener
  • Field Details

  • Constructor Details

    • GuideInfo

      public GuideInfo(EventEmitterInterface listeningTo)
      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

      public <K> void onEvent(EventType event, EventPayload<K> properties)
      Handles incoming events.
      Specified by:
      onEvent in interface EventListener
      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

      void attachListeners(GuideFlow f)
      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

      public void build(GuidePanelAdapter adapter)
      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 a EventType.GUIDE_CLOSING event with a GuideInfoClosingPayload.
    • 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

      public ArrayList<Component> getComponents()
      Returns the list of UI components associated with this guide step.
      Returns:
      An ArrayList of Component objects managed by this guide step.
    • getId

      public UUID getId()
      Returns the unique identifier for this guide step.
      Returns:
      The UUID of this GuideInfo instance.
    • guideCounter

      public void guideCounter(GuidePanelAdapter adapter)
      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

      public JLabel image(URL url, double scale)
      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 a URISyntaxException when converting the URL to a URI.
    • genericText

      public void genericText(GuidePanelAdapter adapter, String text)
      Adds a generic text label to the guide panel at a predefined position (SOUTH | WEST). The text is styled using InlineHTML with 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

      public void addCompAtCentre(GuidePanelAdapter adapter, Component l, int offX, int offY)
      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

      public void addCompAtCentre(GuidePanelAdapter adapter, Component l)
      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

      public void addCompAt(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. 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. (Use Anchor.offsetRight(int) and Anchor.offsetLeft(int))
      offY - The vertical offset from the calculated anchor position. (Use Anchor.offsetUp(int) and Anchor.offsetDown(int))
    • addCompAt

      public void addCompAt(GuidePanelAdapter adapter, Component l, int anchor)
      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).