Class AbstractAsiContainerDashboardPanel

java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
uno.anahata.asi.swing.AbstractAsiContainerDashboardPanel
All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible
Direct Known Subclasses:
AsiCardsContainerPanel, AsiTableContainerPanel

public abstract class AbstractAsiContainerDashboardPanel 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.
    • settingsBtn

      protected final JButton settingsBtn
      Button to open global settings.
    • 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

    • AbstractAsiContainerDashboardPanel

      public AbstractAsiContainerDashboardPanel(@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.
    • showNewAgiMenu

      private void showNewAgiMenu(JButton button)
      Displays a popup menu anchored to the "New AGI" button allowing the user to choose between the default AGI or any stored template.
      Parameters:
      button - The source button to anchor the popup to.
    • 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.
    • showSettings

      public void showSettings()
      Displays the global ASI settings dashboard in a modal dialog.
    • showSettings

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

      Switches to a non-modal JFrame (AsiContainerSettingsFrame) in full maximized mode (Frame.MAXIMIZED_BOTH) to support full OS window management. Implements a single-instance pattern to reuse the existing frame if already open.

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

      public void showPreferences(int initialTabIndex)
      Compatibility alias for showSettings(int).
      Parameters:
      initialTabIndex - The index of the tab to open.
    • showPreferences

      public void showPreferences()
      Compatibility alias for showSettings().
    • 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.
    • updateSettingsButton

      private void updateSettingsButton()
      Dynamically updates the Settings button text and tooltip depending on whether operational notifications or warnings are present in the container.
    • 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.