Class AbstractAsiContainerPanel

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible
Direct Known Subclasses:
AsiCardsContainerPanel, AsiTableContainerPanel

public abstract class AbstractAsiContainerPanel extends JPanel
A base abstract class for panels that manage a collection of AI agi sessions. It provides a standard toolbar with common actions (New, Close, Dispose) and a background refresh mechanism.
Author:
anahata
See Also:
  • Field Details

    • asiContainer

      protected final AbstractSwingAsiContainer asiContainer
      The application-wide ASI container.
    • toolBar

      protected final JToolBar toolBar
      The toolbar containing session actions.
    • closeButton

      protected final JButton closeButton
      Button to close the selected session's window.
    • disposeButton

      protected final JButton disposeButton
      Button to permanently dispose of the selected session.
    • warningLabel

      protected final JLabel warningLabel
      A global warning label indicating if the DNA template loaded cleanly.
    • refreshTimer

      private final Timer refreshTimer
      Timer for periodic UI refreshes.
  • Constructor Details

    • AbstractAsiContainerPanel

      public AbstractAsiContainerPanel(@NonNull @NonNull AbstractSwingAsiContainer container)
      Constructs a new container panel.
      Parameters:
      container - The ASI container.
  • Method Details

    • focus

      public void focus(@NonNull @NonNull Agi agi)
      Authoritatively requests focus for the given agi session via the container.
      Parameters:
      agi - The agi session to focus.
    • close

      public void close(@NonNull @NonNull Agi agi)
      Authoritatively requests the closure of the given agi session via the container.
      Parameters:
      agi - The agi session to close.
    • dispose

      public void dispose(@NonNull @NonNull Agi agi)
      Authoritatively requests the disposal of the given agi session via the container.
      Parameters:
      agi - The agi session to dispose.
    • createNew

      public void createNew()
      Authoritatively creates a new agi session via the container.

      Operational Guard: If no API keys are configured, this method alerts the user and opens the Preferences dashboard instead of spawning a non-functional session.

    • importSession

      public void importSession()
      Invokes the shared Swing import UI from the container.
    • showPreferences

      public void showPreferences()
      Displays the global ASI preferences dashboard in a modal dialog.
    • showPreferences

      public void showPreferences(int initialTabIndex)
      Displays the global ASI preferences dashboard with a specific tab selected.

      Implementation details: Switches from modal JDialog to a non-modal JFrame to support full OS window management (maximization). Implements a single-instance pattern to reuse the existing frame if already open.

      Parameters:
      initialTabIndex - The index of the tab to open.
    • setToolBarVisible

      public void setToolBarVisible(boolean visible)
      Sets whether the toolbar is visible.
      Parameters:
      visible - true to show the toolbar, false to hide it.
    • startRefresh

      public void startRefresh()
      Starts the background refresh timer.
    • stopRefresh

      public void stopRefresh()
      Stops the background refresh timer.
    • updateButtonState

      protected void updateButtonState()
      Updates the enabled state of toolbar buttons based on the current selection.
    • refreshView

      protected abstract void refreshView()
      Refreshes the specific view implementation (e.g., table or cards).
    • getSelectedAgi

      protected abstract Agi getSelectedAgi()
      Gets the currently selected agi session in the view.
      Returns:
      The selected agi, or null if none.