Class AbstractSwingAsiContainer
- All Implemented Interfaces:
PropertyChangeSource, Rebindable
- Direct Known Subclasses:
AsiDesktopAsiContainer, IntellijAsiContainer, NetBeansAsiContainer
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 StringCached JavaFX version and conditional features info for this container instance.private 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.0Returns the ClassLoader to search for JavaFX runtime classes.voidimportSessionWithUI(Component parent) Opens a standard SwingJFileChooserto allow the user to select a saved session (.kryo) for import.private voidInitializes the JavaFX runtime on the container's designated ClassLoader once during startup.booleanChecks if JavaFX is available and initialized in this container.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.protected 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
-
AVAILABLE_PROVIDER_CLASSES
List of all known AI Providers. -
settingsFrame
The single-instance Settings Command Center frame for this container. -
javaFxVersionInfo
Cached JavaFX version and conditional features info for this container instance.
-
-
Constructor Details
-
AbstractSwingAsiContainer
Constructs a new Swing ASI container.- Parameters:
hostApplicationId- The unique ID of the host application.- Throws:
IOException
-
-
Method Details
-
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.
-
initJavaFx
private void initJavaFx()Initializes the JavaFX runtime on the container's designated ClassLoader once during startup. -
getJavaFxClassLoader
Returns the ClassLoader to search for JavaFX runtime classes. Defaults to the container's own ClassLoader; overridden in NetBeans to query the JavaFX module loader.- Returns:
- the ClassLoader for JavaFX.
-
isJavaFxAvailable
public boolean isJavaFxAvailable()Checks if JavaFX is available and initialized in this container.- Returns:
- true if JavaFX version info is resolved.
-

