Class DocsProvider

java.lang.Object
com.j3d.gen.docs.DocsProvider

public class DocsProvider extends Object
Provides and manages documentation frames within the J3Engine. This class acts as a central point for accessing and creating DocsFrame instances, ensuring that documentation files are loaded and displayed efficiently. It maintains a cache of DocsFrame objects to prevent redundant loading.
Author:
Lehlogonolo Poole
  • Field Details

    • frameHashMap

      private final HashMap<String,DocsFrame> frameHashMap
      A map to store DocsFrame instances, keyed by their ID. This allows for efficient retrieval of existing documentation frames.
    • main

      private final DocsFrame main
      The main documentation frame, which is always available.
  • Constructor Details

    • DocsProvider

      public DocsProvider()
      Constructs a new DocsProvider.
  • Method Details

    • provideMain

      public DocsFrame provideMain()
      Provides the main documentation frame. This frame is always available and serves as the primary documentation viewer.
      Returns:
      The main DocsFrame instance.
    • provideDocFrame

      public DocsFrame provideDocFrame(String id)
      Provides a DocsFrame for a given documentation ID. If a frame for the specified ID already exists in the cache, it is returned. Otherwise, a new DocsFrame is created, initialized with the given ID, added to the cache, and then returned. If the ID does not correspond to an existing documentation file, an error is handled.
      Parameters:
      id - The unique identifier for the documentation file.
      Returns:
      The DocsFrame associated with the provided ID.
    • showAndScrollTo

      public void showAndScrollTo(Documentation doc, String header)
      Displays a specific documentation frame and scrolls to a designated header within it. This method first retrieves or creates a DocsFrame for the given Documentation object using its file ID. It then makes the frame visible and instructs it to scroll to the specified header.
      Parameters:
      doc - The Documentation object whose frame is to be shown and scrolled.
      header - The header string within the documentation to scroll to.