Class AbstractSwingAsiContainer
- All Implemented Interfaces:
PropertyChangeSource, Rebindable
- Direct Known Subclasses:
AsiDesktopAsiContainer, IntellijAsiContainer
This class bridges the gap between model-agnostic session logic and the Swing UI environment. It provides shared utilities for UI-based session imports and defines the hooks for environment-specific window/tab management.
- Author:
- anahata
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final List<Class<? extends AbstractAiProvider>> List of all known AI Providers.protected static Stringprivate AsiContainerSettingsFrameThe single-instance Settings Command Center frame for this container.Fields inherited from class AbstractAsiContainer
applicationAttributes, containerAttributesFields inherited from class BasicPropertyChangeSource
propertyChangeSupport -
Constructor Summary
ConstructorsConstructorDescriptionAbstractSwingAsiContainer(String hostApplicationId) Constructs a new Swing ASI container. -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract voidEnvironment-specific logic to visually close or hide the UI component associated with the given session.protected abstract voidEnvironment-specific logic to visually focus or select the UI component associated with the given session.getAgiPanel(Agi agi) Retrieves the AgiPanel associated with a specific Agi session.Gets the root working directory for this specific host application instance. e.g., ~/.anahata/asi/netbeans or ~/.anahata/asi/netbeans/1.2.0static StringReturns the detected JavaFX version and supported conditional features string, initializing the platform lazily viaJavaFxBridgeif available on the classpath.voidimportSessionWithUI(Component parent) Opens a standard SwingJFileChooserto allow the user to select a saved session (.kryo) for import.static booleanChecks if the JavaFX Platform class is present on the classpath without loading it.protected voidonAgiClosed(Agi agi) Hook invoked when a session has been logically closed.protected voidonAgiOpened(Agi agi) Hook invoked when a session has been logically opened.protected booleanpromptUpgrade(String previousVersion, String currentVersion) Prompts the user via a native Swing dialog asking whether they would like to import persistent settings from an earlier detected version.private voidshowImportSuccess(int count, String prevVerStr) Displays an informational dialog confirming that settings were successfully imported from an earlier version.voidDisplays the global ASI settings Command Center in maximized mode.voidshowSettings(int initialTabIndex) Displays the global ASI settings Command Center with a specific tab selected.Methods inherited from class AbstractAsiContainer
addNotification, autoSaveSession, clearNotifications, cloneAgi, cloneAgi, close, configureNewAgi, createNewAgi, createNewAgi, createNewAgiConfig, createNewAgiFromTemplate, createNewAgiFromTemplate, createNewBlankAgi, createTemplate, createTemplateFromSession, dispose, ensureDir, findModels, getActiveAgis, getAgi, getAllModels, getAllModels, getAllProviders, getAppDirSubDir, getAsiCoreImplementationVersion, getChildrenAgis, getContainerCreationTime, getContainerImplementationVersion, getContainerVersion, getDefaultTemplate, getDisposedSessionsDir, getEffectivelyEnabledProviders, getMavenArtifactId, getMavenGroupId, getNotifications, getOpenAgis, getPersistenceDir, getProvider, getProviderByClass, getProvidersDir, getSavedSessionsDir, getSessionsDir, getSubdirectory, getTemplates, getTemplatesDir, getUI, getUnloadableProvidersDir, getUnloadableSessionsDir, getUnloadableTemplatesDir, getWorkDir, getWorkDirSubDir, hasAnyProviderConfigured, importSession, isTemplate, loadAgi, loadAgis, loadProvidersFromDisk, loadSessions, loadTemplatesFromDisk, manualSaveSession, onAgiRegistered, onAgiUnregistered, open, registerProvider, registerTemplate, saveAgi, shutdown, unregisterAgi, unregisterProvider, unregisterTemplateMethods inherited from class BasicPropertyChangeSource
addPropertyChangeListener, addPropertyChangeListener, rebind, removePropertyChangeListener, removePropertyChangeListenerMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface PropertyChangeSource
getPropertyChangeSupport
-
Field Details
-
javaFxVersionInfo
-
AVAILABLE_PROVIDER_CLASSES
List of all known AI Providers. -
settingsFrame
The single-instance Settings Command Center frame for this container.
-
-
Constructor Details
-
AbstractSwingAsiContainer
Constructs a new Swing ASI container.- Parameters:
hostApplicationId- The unique ID of the host application.- Throws:
IOException
-
-
Method Details
-
isJavaFxAvailable
public static boolean isJavaFxAvailable()Checks if the JavaFX Platform class is present on the classpath without loading it.- Returns:
- true if JavaFX is available.
-
getJavaFxVersionInfo
Returns the detected JavaFX version and supported conditional features string, initializing the platform lazily viaJavaFxBridgeif available on the classpath.- Returns:
- formatted JavaFX version and feature string, or null if JavaFX is not available.
-
getDirectory
Gets the root working directory for this specific host application instance. e.g., ~/.anahata/asi/netbeans or ~/.anahata/asi/netbeans/1.2.0Intercepts container directory resolution prior to creation to detect predecessor version directories. Prompts the user via Swing UI dialog and automatically migrates persistent settings if requested.
- Overrides:
getDirectoryin classAbstractAsiContainer- Returns:
- The application-specific working directory path.
- Throws:
IOException- If creating the directory fails.
-
promptUpgrade
Prompts the user via a native Swing dialog asking whether they would like to import persistent settings from an earlier detected version.- Parameters:
previousVersion- The predecessor version string.currentVersion- The running container version string.- Returns:
trueif the user elected to import,falseto start fresh.
-
showImportSuccess
Displays an informational dialog confirming that settings were successfully imported from an earlier version.- Parameters:
count- The number of entities imported.prevVerStr- The predecessor version string.
-
showSettings
public void showSettings()Displays the global ASI settings Command Center in maximized mode. -
showSettings
public void showSettings(int initialTabIndex) Displays the global ASI settings Command Center with a specific tab selected.Reuses the existing
AsiContainerSettingsFrameinstance if already open, bringing it to front and selecting the requested tab index.- Parameters:
initialTabIndex- The index of the tab to open.
-
getAgiPanel
-
onAgiOpened
Hook invoked when a session has been logically opened.Implementation details: Marshals the logical 'open' intent to the Event Dispatch Thread (EDT) and delegates to the environment-specific
focusUI(Agi)method. This guarantees safe UI manipulation regardless of the calling thread.- Specified by:
onAgiOpenedin classAbstractAsiContainer- Parameters:
agi- The opened session.
-
onAgiClosed
Hook invoked when a session has been logically closed.Implementation details: Marshals the logical 'close' intent to the Event Dispatch Thread (EDT) and delegates to the environment-specific
closeUI(Agi)method. This guarantees safe UI manipulation regardless of the calling thread.- Specified by:
onAgiClosedin classAbstractAsiContainer- Parameters:
agi- The closed session.
-
focusUI
Environment-specific logic to visually focus or select the UI component associated with the given session.- Parameters:
agi- The session to focus.
-
closeUI
Environment-specific logic to visually close or hide the UI component associated with the given session.- Parameters:
agi- The session to close.
-
importSessionWithUI
Opens a standard SwingJFileChooserto allow the user to select a saved session (.kryo) for import.- Parameters:
parent- The parent component for the dialog.
-

