Class VisionDesignerImpl
- java.lang.Object
-
- com.inductiveautomation.ignition.designer.model.AbstractDesignerModuleHook
-
- com.inductiveautomation.factorypmi.designer.model.VisionDesignerImpl
-
- All Implemented Interfaces:
DesignerModuleHook
,VisionClientInterface
,VisionDesignerInterface
public class VisionDesignerImpl extends AbstractDesignerModuleHook implements VisionDesignerInterface
This is the core of the Vision module, implementing bothDesignerModuleHook
andVisionDesignerInterface
. Most of the heavy lifting is actually done in theWindowWorkspace
class.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description class
VisionDesignerImpl.Handler
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
MODULE_ID
-
Fields inherited from interface com.inductiveautomation.vision.api.client.VisionClientInterface
VISION_MODULE_ID
-
-
Constructor Summary
Constructors Constructor Description VisionDesignerImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addDesignableProjectListener()
void
addExtensibleBindingType(BindingType binding)
Adds a new binding type to be used in the extensible binding systemvoid
addNewTemplate(ResourcePath parentFolder, int width, int height)
void
addNewTemplate(ResourcePath parentFolder, int width, int height, java.util.function.Consumer<ResourcePath> onAfter)
void
addNewTemplate(ResourcePath parentFolder, VisionTemplate template)
void
addNewTemplate(ResourcePath parentFolder, VisionTemplate template, java.util.function.Consumer<ResourcePath> onFinished)
void
addNewWindow(ResourcePath parentFolder, int width, int height, java.util.function.Consumer<ResourcePath> onAfter)
Adds a new window to theFPMIApp
being designedvoid
addNewWindow(ResourcePath parentFolder, FPMIWindow newWindow)
void
addNewWindow(ResourcePath parentFolder, FPMIWindow newWindow, java.util.function.Consumer<ResourcePath> onFinished)
Adds a new window to theFHMIApp
being designedvoid
addWindowDropHandler(WindowDropHandler handler)
Add a new drop handler for custom drop types onto windows and templatesvoid
addWindowListener(VisionWindowListener listener)
Adds a listener to be notified when windows are opened and closed.java.awt.Component
cloneComponent(java.awt.Component comp)
boolean
configureBinding(java.awt.Component component, java.lang.String property, BindingConfiguration configuration)
Configures a new property binding for the component.property using the given configuration.void
configureDeserializer(XMLDeserializer deserializer)
void
configureSerializer(XMLSerializer s)
Provides the module a chance to add serialization delegates to the serializer custom for classes that might be encountered when serializing objects provided by this moduleBindingType
getBindingType(java.lang.String bindingTypeKey)
ClientScriptEditor
getClientEventScriptEditor()
DesignerPrefs
getCurrentPrefs()
DesignerContext
getDesignerContext()
java.util.Collection<BindingType>
getExtensibleBindings()
java.util.List<com.jidesoft.docking.DockableFrame>
getFrames()
A list of DockableFrames that this module provides, that should be available to all workspaces.WindowUtilities
getGuiUtil()
WindowUtilities
getGuiUtil(java.lang.String desktopHandle)
Gets the WindowUtilities for a secondary desktop, by handleVisionDesignerImpl.Handler
getHandler()
MenuBarMerge
getMenu()
MenuBarMerge
getModuleMenu()
Returns a menu merge for any global menu additions.java.util.List<com.jidesoft.action.CommandBar>
getModuleToolbars()
Returns the toolbars for the module.NavUtilities
getNavUtil()
Gets the NavUtilities (for the primary desktopNavUtilities
getNavUtil(java.lang.String desktopHandle)
Gets the NavUtilities for a secondary desktop, by handlePaletteImpl
getPalette()
DesignableProject
getProject()
java.lang.String
getResourceCategoryKey(ProjectResourceId resource)
Used by modules that add project resources to an Ignition project.java.lang.String
getResourceDisplayName(ProjectResourceId resource)
Allows a module to give an appropriate display name for the resource.javax.swing.Icon
getResourceIcon(ProjectResourceId resource)
Allows a module to give an appropriate icon for a resource.FPMIApp
getRoot()
WindowFolderNode
getRootFolderNode()
ResourcePath
getSelectedTemplateFolder()
ResourcePath
getSelectedWindowFolder()
Returns the id of the currently selected window folder in the project browser tree.java.util.List<WindowDropHandler>
getWindowDropHandlers()
WindowWorkspace
getWorkspace()
protected void
initSearchProviders()
void
newDockedWindow(ResourcePath parentFolder)
void
newDockedWindow(ResourcePath parentFolder, java.util.function.Consumer<ResourcePath> onFinished)
void
newMainWindow(ResourcePath folder)
void
newMainWindow(ResourcePath folder, java.util.function.Consumer<ResourcePath> onFinished)
void
newPopupWindow(ResourcePath parentFolder)
void
newPopupWindow(ResourcePath parentFolder, java.util.function.Consumer<ResourcePath> onFinished)
void
notifyActivationStateChanged(LicenseState licenseState)
Notifies this designer module that its license state has changed.void
notifyDesignableContainerClosed(ResourcePath path)
void
notifyProjectSaveDone()
Notifies the module that the save operation has finished.void
notifyProjectSaveStart(SaveContext save)
Notifies the module that the user has requested that the project is saved.void
openBindingDialog(java.awt.Component component, java.lang.String propertyName)
Opens the binding dialog for a given component.void
removeDesignableProjectListener()
void
removeWindowListener(VisionWindowListener listiner)
Removes window listenerbyte[]
serializeProjectResource(java.lang.Object obj)
Serializes an object to be stored in a ProjectResource.void
setContext(DesignerContext context)
void
setWorkspace(WindowWorkspace workspace)
void
shutdown()
Called when the module is shut down.void
startup(DesignerContext designerContext, LicenseState activationState)
The main entrypoint for the module hook.-
Methods inherited from class com.inductiveautomation.ignition.designer.model.AbstractDesignerModuleHook
configureFunctionFactory, createPermissionKeys, initializeScriptManager
-
-
-
-
Field Detail
-
MODULE_ID
public static final java.lang.String MODULE_ID
- See Also:
- Constant Field Values
-
-
Method Detail
-
startup
public void startup(DesignerContext designerContext, LicenseState activationState) throws java.lang.Exception
Description copied from interface:DesignerModuleHook
The main entrypoint for the module hook. This will only be called once for a given project. If another project is ever opened,DesignerModuleHook.shutdown()
will be called and a new hook will be instantiated- Specified by:
startup
in interfaceDesignerModuleHook
- Overrides:
startup
in classAbstractDesignerModuleHook
- Throws:
java.lang.Exception
- if the module was not able to be initialized for the given project.
-
shutdown
public void shutdown()
Description copied from interface:DesignerModuleHook
Called when the module is shut down. This will happen if the user opens a different project within the same designer session - the existing modules will be shut down, and new module hooks will be instantiated and started up.- Specified by:
shutdown
in interfaceDesignerModuleHook
- Overrides:
shutdown
in classAbstractDesignerModuleHook
-
addDesignableProjectListener
public void addDesignableProjectListener()
-
removeDesignableProjectListener
public void removeDesignableProjectListener()
-
addWindowDropHandler
public void addWindowDropHandler(WindowDropHandler handler)
Description copied from interface:VisionDesignerInterface
Add a new drop handler for custom drop types onto windows and templates- Specified by:
addWindowDropHandler
in interfaceVisionDesignerInterface
-
getWindowDropHandlers
public java.util.List<WindowDropHandler> getWindowDropHandlers()
-
getResourceCategoryKey
public java.lang.String getResourceCategoryKey(ProjectResourceId resource)
Description copied from interface:DesignerModuleHook
Used by modules that add project resources to an Ignition project. This will be called when the exporter is displaying all of the resources inside a project for export. Only project resources that match this module's ID will passed to this function.
Used by the import/export system.
- Specified by:
getResourceCategoryKey
in interfaceDesignerModuleHook
- Overrides:
getResourceCategoryKey
in classAbstractDesignerModuleHook
- Parameters:
resource
- A project resource that was added by this module.- Returns:
- A bundle resource key for the category of this resource.
-
getResourceDisplayName
public java.lang.String getResourceDisplayName(ProjectResourceId resource)
Description copied from interface:DesignerModuleHook
Allows a module to give an appropriate display name for the resource. For most resources this won't be necessary (the resource's name itself should be used), but for some resources whose name is null, this may be appropriate.
Used by the import/export system.
- Specified by:
getResourceDisplayName
in interfaceDesignerModuleHook
- Overrides:
getResourceDisplayName
in classAbstractDesignerModuleHook
- Returns:
- the name for a resource, or null to use the resource's folder path/name.
-
getResourceIcon
public javax.swing.Icon getResourceIcon(ProjectResourceId resource)
Description copied from interface:DesignerModuleHook
Allows a module to give an appropriate icon for a resource.
Used by the import/export system.
- Specified by:
getResourceIcon
in interfaceDesignerModuleHook
- Overrides:
getResourceIcon
in classAbstractDesignerModuleHook
-
getModuleMenu
public MenuBarMerge getModuleMenu()
Description copied from interface:DesignerModuleHook
Returns a menu merge for any global menu additions. May be null.- Specified by:
getModuleMenu
in interfaceDesignerModuleHook
- Overrides:
getModuleMenu
in classAbstractDesignerModuleHook
- See Also:
JMenuMerge
-
getMenu
public MenuBarMerge getMenu()
- Returns:
- the
MenuBarMerge
specific to the vision workspace
-
getModuleToolbars
public java.util.List<com.jidesoft.action.CommandBar> getModuleToolbars()
Description copied from interface:DesignerModuleHook
Returns the toolbars for the module. May be empty but not null.- Specified by:
getModuleToolbars
in interfaceDesignerModuleHook
- Overrides:
getModuleToolbars
in classAbstractDesignerModuleHook
-
getFrames
public java.util.List<com.jidesoft.docking.DockableFrame> getFrames()
Description copied from interface:DesignerModuleHook
A list of DockableFrames that this module provides, that should be available to all workspaces.- Specified by:
getFrames
in interfaceDesignerModuleHook
- Overrides:
getFrames
in classAbstractDesignerModuleHook
-
notifyActivationStateChanged
public void notifyActivationStateChanged(LicenseState licenseState)
Description copied from interface:DesignerModuleHook
Notifies this designer module that its license state has changed. This could mean that the trial mode has expired (or been reset), the module has been activated, etc.- Specified by:
notifyActivationStateChanged
in interfaceDesignerModuleHook
- Overrides:
notifyActivationStateChanged
in classAbstractDesignerModuleHook
-
addWindowListener
public void addWindowListener(VisionWindowListener listener)
Description copied from interface:VisionClientInterface
Adds a listener to be notified when windows are opened and closed. Only works during runtime, not designer- Specified by:
addWindowListener
in interfaceVisionClientInterface
-
removeWindowListener
public void removeWindowListener(VisionWindowListener listiner)
Description copied from interface:VisionClientInterface
Removes window listener- Specified by:
removeWindowListener
in interfaceVisionClientInterface
-
configureSerializer
public void configureSerializer(XMLSerializer s)
Description copied from interface:DesignerModuleHook
Provides the module a chance to add serialization delegates to the serializer custom for classes that might be encountered when serializing objects provided by this module- Specified by:
configureSerializer
in interfaceDesignerModuleHook
- Overrides:
configureSerializer
in classAbstractDesignerModuleHook
-
configureDeserializer
public void configureDeserializer(XMLDeserializer deserializer)
- Specified by:
configureDeserializer
in interfaceDesignerModuleHook
- Overrides:
configureDeserializer
in classAbstractDesignerModuleHook
-
notifyProjectSaveStart
public void notifyProjectSaveStart(SaveContext save)
Description copied from interface:DesignerModuleHook
Notifies the module that the user has requested that the project is saved. The module must check-in any checked-out resources that it is holding.- Specified by:
notifyProjectSaveStart
in interfaceDesignerModuleHook
- Overrides:
notifyProjectSaveStart
in classAbstractDesignerModuleHook
-
notifyProjectSaveDone
public void notifyProjectSaveDone()
Description copied from interface:DesignerModuleHook
Notifies the module that the save operation has finished. This is the cue to check-out any previously checked-out resources that it was forced to check-in before the save.- Specified by:
notifyProjectSaveDone
in interfaceDesignerModuleHook
- Overrides:
notifyProjectSaveDone
in classAbstractDesignerModuleHook
-
initSearchProviders
protected void initSearchProviders()
-
notifyDesignableContainerClosed
public void notifyDesignableContainerClosed(ResourcePath path)
-
setContext
public void setContext(DesignerContext context)
-
getProject
public DesignableProject getProject()
-
getRoot
public FPMIApp getRoot()
-
getHandler
public VisionDesignerImpl.Handler getHandler()
-
getClientEventScriptEditor
public ClientScriptEditor getClientEventScriptEditor()
-
addNewTemplate
public void addNewTemplate(ResourcePath parentFolder, int width, int height)
-
addNewTemplate
public void addNewTemplate(ResourcePath parentFolder, int width, int height, java.util.function.Consumer<ResourcePath> onAfter)
-
addNewTemplate
public void addNewTemplate(ResourcePath parentFolder, VisionTemplate template)
-
addNewTemplate
public void addNewTemplate(ResourcePath parentFolder, VisionTemplate template, java.util.function.Consumer<ResourcePath> onFinished)
-
newMainWindow
public void newMainWindow(ResourcePath folder)
-
newMainWindow
public void newMainWindow(ResourcePath folder, java.util.function.Consumer<ResourcePath> onFinished)
-
newDockedWindow
public void newDockedWindow(ResourcePath parentFolder)
-
newDockedWindow
public void newDockedWindow(ResourcePath parentFolder, java.util.function.Consumer<ResourcePath> onFinished)
-
newPopupWindow
public void newPopupWindow(ResourcePath parentFolder)
-
newPopupWindow
public void newPopupWindow(ResourcePath parentFolder, java.util.function.Consumer<ResourcePath> onFinished)
-
addNewWindow
public void addNewWindow(ResourcePath parentFolder, FPMIWindow newWindow)
-
addNewWindow
public void addNewWindow(ResourcePath parentFolder, FPMIWindow newWindow, java.util.function.Consumer<ResourcePath> onFinished)
Adds a new window to theFHMIApp
being designed
-
getSelectedWindowFolder
public ResourcePath getSelectedWindowFolder()
Returns the id of the currently selected window folder in the project browser tree.
-
getSelectedTemplateFolder
public ResourcePath getSelectedTemplateFolder()
-
getRootFolderNode
public WindowFolderNode getRootFolderNode()
-
serializeProjectResource
public byte[] serializeProjectResource(java.lang.Object obj) throws SerializationException
Serializes an object to be stored in a ProjectResource. Serialized code is stored in a GZipped byte array.- Throws:
SerializationException
-
addExtensibleBindingType
public void addExtensibleBindingType(BindingType binding)
Description copied from interface:VisionClientInterface
Adds a new binding type to be used in the extensible binding system- Specified by:
addExtensibleBindingType
in interfaceVisionClientInterface
-
getBindingType
public BindingType getBindingType(java.lang.String bindingTypeKey)
- Specified by:
getBindingType
in interfaceVisionClientInterface
-
getNavUtil
public NavUtilities getNavUtil()
Description copied from interface:VisionClientInterface
Gets the NavUtilities (for the primary desktop- Specified by:
getNavUtil
in interfaceVisionClientInterface
-
getNavUtil
public NavUtilities getNavUtil(java.lang.String desktopHandle)
Description copied from interface:VisionClientInterface
Gets the NavUtilities for a secondary desktop, by handle- Specified by:
getNavUtil
in interfaceVisionClientInterface
-
getGuiUtil
public WindowUtilities getGuiUtil()
- Specified by:
getGuiUtil
in interfaceVisionClientInterface
-
getGuiUtil
public WindowUtilities getGuiUtil(java.lang.String desktopHandle)
Description copied from interface:VisionClientInterface
Gets the WindowUtilities for a secondary desktop, by handle- Specified by:
getGuiUtil
in interfaceVisionClientInterface
-
getExtensibleBindings
public java.util.Collection<BindingType> getExtensibleBindings()
-
getPalette
public PaletteImpl getPalette()
- Specified by:
getPalette
in interfaceVisionDesignerInterface
-
addNewWindow
public void addNewWindow(ResourcePath parentFolder, int width, int height, java.util.function.Consumer<ResourcePath> onAfter)
Description copied from interface:VisionDesignerInterface
Adds a new window to theFPMIApp
being designed- Specified by:
addNewWindow
in interfaceVisionDesignerInterface
-
cloneComponent
public java.awt.Component cloneComponent(java.awt.Component comp)
- Specified by:
cloneComponent
in interfaceVisionDesignerInterface
-
getCurrentPrefs
public DesignerPrefs getCurrentPrefs()
- Specified by:
getCurrentPrefs
in interfaceVisionDesignerInterface
-
getWorkspace
public WindowWorkspace getWorkspace()
- Specified by:
getWorkspace
in interfaceVisionDesignerInterface
-
setWorkspace
public void setWorkspace(WindowWorkspace workspace)
-
getDesignerContext
public DesignerContext getDesignerContext()
- Specified by:
getDesignerContext
in interfaceVisionDesignerInterface
-
openBindingDialog
public void openBindingDialog(java.awt.Component component, java.lang.String propertyName) throws NotBindableException
Description copied from interface:VisionDesignerInterface
Opens the binding dialog for a given component. The component should be on a window that is currently open for design- Specified by:
openBindingDialog
in interfaceVisionDesignerInterface
- Throws:
NotBindableException
-
configureBinding
public boolean configureBinding(java.awt.Component component, java.lang.String property, BindingConfiguration configuration) throws java.lang.Exception
Description copied from interface:VisionDesignerInterface
Configures a new property binding for the component.property using the given configuration. The binding type is defined by the configuration'sBindingConfiguration.getBindingType()
- Specified by:
configureBinding
in interfaceVisionDesignerInterface
- Throws:
java.lang.Exception
-
-