Class TemplatesPanel

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible

public class TemplatesPanel extends JPanel
A dedicated master-detail management panel for AGI Session Templates.

Displays a list of all stored AGI templates on the left sidebar and hosts the full, interactive AgiPanel for the selected template on the right side. Allows users to create, clone, customize, delete, set default, and launch active sessions directly from templates.

Author:
anahata
See Also:
  • Field Details

    • container

      private final AbstractSwingAsiContainer container
      The parent Swing ASI container instance.
    • listModel

      private final DefaultListModel<Agi> listModel
      The list model backing the sidebar template list.
    • templateList

      private final JList<Agi> templateList
      The visual sidebar list component displaying registered AGI templates.
    • detailContainer

      private final JPanel detailContainer
      Container panel holding the active template's embedded AgiPanel.
    • cachedPanels

      private final Map<String,AgiPanel> cachedPanels
      Cache of initialized AgiPanel instances keyed by template session ID.
    • selectedTemplate

      private Agi selectedTemplate
      The currently selected template Agi instance.
    • makeDefaultButton

      private final JButton makeDefaultButton
      Button to designate the currently selected template as the default bootstrap template.
    • deleteButton

      private final JButton deleteButton
      Button to delete/dispose the selected template.
    • launchButton

      private final JButton launchButton
      Button to spawn an active AGI session from the selected template.
  • Constructor Details

    • TemplatesPanel

      public TemplatesPanel(@NonNull @NonNull AbstractSwingAsiContainer container)
      Constructs a new Master-Detail TemplatesPanel bound to the specified container.
      Parameters:
      container - The parent ASI container instance.
  • Method Details

    • refreshTemplateList

      public void refreshTemplateList()
      Refreshes the sidebar template list from the container's registered templates, maintaining the active selection if still valid.
    • updateDetailPanel

      private void updateDetailPanel(Agi template)
      Updates the center detail panel with the embedded AgiPanel for the selected template.
      Parameters:
      template - The template Agi instance to display, or null if no selection.
    • updateActionButtonsState

      private void updateActionButtonsState()
      Updates the enabled state of sidebar action buttons based on the current selection.
    • showCreateTemplateDialog

      private void showCreateTemplateDialog()
      Displays a dialog prompting the user to name and create a new template.
    • setAsDefault

      private void setAsDefault()
      Sets the currently selected template as the default template ("default.kryo") and disposes the original template to prevent duplicates.
    • deleteSelectedTemplate

      private void deleteSelectedTemplate()
      Prompts for confirmation and permanently disposes/deletes the selected template.
    • launchFromSelectedTemplate

      private void launchFromSelectedTemplate()
      Creates and opens a new active session instantiated directly from the selected template.