Class ClientContextImpl
java.lang.Object
com.inductiveautomation.ignition.client.model.AbstractClientContext
com.inductiveautomation.factorypmi.application.runtime.ClientContextImpl
- All Implemented Interfaces:
ClientContext, CommonContext, VisionClientInterface
-
Nested Class Summary
Nested classes/interfaces inherited from class AbstractClientContext
AbstractClientContext.ClientContextResourceListener -
Field Summary
Fields inherited from class AbstractClientContext
changeSupport, globalProps, log, loggingManager, project, projectDescription, projectTitleFields inherited from interface VisionClientInterface
VISION_MODULE_ID -
Method Summary
Modifier and TypeMethodDescriptionvoidaddExtensibleBindingType(BindingType binding) Adds a new binding type to be used in the extensible binding systemvoidaddWindowListener(VisionWindowListener listener) Adds a listener to be notified when windows are opened and closed.static voidstatic voidReturns an instance of the XMLDeserializer that can be used to deserialize project resources.protected FunctionFactorydeserialize(byte[] data, org.apache.log4j.Logger log) Convenience function to deserialize a gzipped byte array into a single object.getBindingType(String bindingTypeKey) Gets a binding type by its key.Returns the shared task execution manager for this clientGets the WindowUtilities for the primary desktop.getGuiUtil(String desktopHandle) Gets the WindowUtilities for a secondary desktop, by handle.getLicenseState(String moduleId) Returns the license state for the given moduleReturns the running hook object that the module with the given ID contributed to this scope.Retrieve the list of all modules currently loaded in this contextReturns the appropriate named query rpc for the context.Gets the NavUtilities for the primary desktop.getNavUtil(String desktopHandle) Gets the NavUtilities for a secondary desktop, by handle.Returns the project that this client is running.Returns the RootPaneContainer that is currently the owner of the clientReturns the ScriptManager that can be used to execute Python scripts.Returns the manager that provides access to Ignition's tag system.voidloadModules(List<ModuleInfo> modules) Create LoadedModule objects to represent each client-scoped module in the list.protected ResourceListenerMake a custom resource listener so we can keep track of some Vision-specific resourcesvoidListens to the event bus for vision window evens to push all window open/close events to any modules that have registered VisionWindowListener objects.voidremoveWindowListener(VisionWindowListener listener) Removes a window listener.voidvoidvoidsetProject(ResourceCollection project) voidshutdown()voidstartup()Methods inherited from class AbstractClientContext
addPropertyChangeListener, addPropertyChangeListener, getAuthProfileName, getDefaultDatasourceName, getDefaultTagProviderName, getEdgeEditions, getEventBus, getExpressionFunctionFactory, getGlobalProps, getLaunchContext, getLoggingManager, getOrDefault, getProjectDescription, getProjectName, getProjectTitle, getTagPollRate, getUIEventBus, initProject, installLegacyScriptLibrary, removePropertyChangeListener, removePropertyChangeListener, resetExpressionFunctionFactory, setGlobalProps
-
Method Details
-
getProject
Description copied from interface:ClientContextReturns the project that this client is running. Note that this may be null before the client is fully logged in and started, because the context is created before the project is downloaded.- Specified by:
getProjectin interfaceClientContext
-
addExtensibleBindingType
Description copied from interface:VisionClientInterfaceAdds a new binding type to be used in the extensible binding system- Specified by:
addExtensibleBindingTypein interfaceVisionClientInterface- Parameters:
binding- The binding type to add.
-
getBindingType
Description copied from interface:VisionClientInterfaceGets a binding type by its key.- Specified by:
getBindingTypein interfaceVisionClientInterface- Parameters:
bindingTypeKey- The unique key for the binding type.- Returns:
- The binding type, or null if not found.
-
getExecutionManager
Description copied from interface:ClientContextReturns the shared task execution manager for this client- Specified by:
getExecutionManagerin interfaceClientContext
-
getLocalizationManager
- Specified by:
getLocalizationManagerin interfaceClientContext
-
setLocalizationManager
-
addWindowListener
Description copied from interface:VisionClientInterfaceAdds a listener to be notified when windows are opened and closed. Only works during runtime, not designer.- Specified by:
addWindowListenerin interfaceVisionClientInterface- Parameters:
listener- The window listener to add.
-
removeWindowListener
Description copied from interface:VisionClientInterfaceRemoves a window listener.- Specified by:
removeWindowListenerin interfaceVisionClientInterface- Parameters:
listener- The window listener to remove.
-
receiveVisionWindowEvent
Listens to the event bus for vision window evens to push all window open/close events to any modules that have registered VisionWindowListener objects. -
deserialize
Description copied from interface:ClientContextConvenience function to deserialize a gzipped byte array into a single object. If multiple objects are found, they will be discarded. Warnings are logged to the given logger. If data is null or empty, null is returned.- Specified by:
deserializein interfaceClientContext- Throws:
SerializationException
-
getRootPaneContainer
Description copied from interface:ClientContextReturns the RootPaneContainer that is currently the owner of the client- Specified by:
getRootPaneContainerin interfaceClientContext
-
getModules
Description copied from interface:ClientContextRetrieve the list of all modules currently loaded in this context- Specified by:
getModulesin interfaceClientContext
-
getLicenseState
Description copied from interface:CommonContextReturns the license state for the given module- Specified by:
getLicenseStatein interfaceCommonContext
-
createExpressionFunctionFactory
- Specified by:
createExpressionFunctionFactoryin classAbstractClientContext
-
loadModules
Create LoadedModule objects to represent each client-scoped module in the list. This will instantiate, but not start up, the client module hooks.- Throws:
ModuleLoadException
-
startup
public void startup()- Overrides:
startupin classAbstractClientContext
-
setApp
-
shutdown
public void shutdown()- Overrides:
shutdownin classAbstractClientContext
-
getGuiUtil
Description copied from interface:VisionClientInterfaceGets the WindowUtilities for the primary desktop.- Specified by:
getGuiUtilin interfaceVisionClientInterface- Returns:
- The GUI utilities.
-
getGuiUtil
Description copied from interface:VisionClientInterfaceGets the WindowUtilities for a secondary desktop, by handle.- Specified by:
getGuiUtilin interfaceVisionClientInterface- Parameters:
desktopHandle- The handle of the desktop.- Returns:
- The GUI utilities for the specified desktop.
-
setProject
-
newProjectResourceListener
Make a custom resource listener so we can keep track of some Vision-specific resources- Overrides:
newProjectResourceListenerin classAbstractClientContext
-
getTagManager
Description copied from interface:CommonContextReturns the manager that provides access to Ignition's tag system.- Specified by:
getTagManagerin interfaceClientContext- Specified by:
getTagManagerin interfaceCommonContext
-
getScriptManager
Description copied from interface:CommonContextReturns the ScriptManager that can be used to execute Python scripts.- Specified by:
getScriptManagerin interfaceCommonContext
-
getNamedQueryManager
Description copied from interface:ClientContextReturns the appropriate named query rpc for the context. In the gateway and client, we only want to use named queries that have been saved. In the designer, we want to use the current version so that reports and bindings can be seen and used for testing before the project is saved.- Specified by:
getNamedQueryManagerin interfaceClientContext- Returns:
- The correct NamedQueryManager implementation for the scope.
-
createDeserializer
Description copied from interface:CommonContextReturns an instance of the XMLDeserializer that can be used to deserialize project resources. Note that this is the only safe way to obtain an instance of XMLDeserializer, because the context will pass the new deserializer around to all loaded modules, giving them a chance to initialize any custom deserialization deletes on it first.- Specified by:
createDeserializerin interfaceCommonContext
-
configureDeserializer
-
configureClassNameResolver
-
getGeneralProps
-
getLaunchProps
-
getLoginProps
-
getUiProps
-
getModule
Description copied from interface:ClientContextReturns the running hook object that the module with the given ID contributed to this scope. This is the live hook instance, not itsClass. Modules use it to reach each other's APIs at runtime.The return type is
Objectbecause the hook type varies by scope — aClientModuleHookin a Vision client, aDesignerModuleHookin the Designer (seeDesignerContext#getModule(String), which narrows the return type accordingly). Callers narrow the result to an interface the target module publishes for this purpose — pattern matching covers the absent-module case in the same step:if (context.getModule(SFCModule.MODULE_ID) instanceof ClientStepRegistryProvider sfc) { var registry = sfc.getStepRegistry(); }A null result is the usual way to detect that an optional module is unavailable, so account for it unless the module is a hard dependency of yours.
- Specified by:
getModulein interfaceClientContext- Parameters:
id- the module ID of the module whose hook you want.- Returns:
- the module's hook instance, or null if the module is not installed or contributes no hook to this scope.
-