Class TemplateManager
- java.lang.Object
-
- com.inductiveautomation.factorypmi.application.model.TemplateManager
-
public class TemplateManager extends java.lang.Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
TemplateManager.InstanceCache
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
GLOBAL_TEMPLATE_PREFIX
static ResourceType
RESOURCE_TYPE
-
Constructor Summary
Constructors Constructor Description TemplateManager(ClientContext context)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addTemplateListener(ResourcePath templateId, TemplateListener listener)
void
apply(java.util.List<? extends ChangeOperation> changes)
Modifies the stored instances of the templates based on a supplied change set.static java.lang.String
convertLegacyPath(java.lang.String templatePath)
Detects whether the given path starts with [shared] or not.com.google.common.collect.Multimap<DataTypeEx,java.lang.String>
getDropTargetTemplates()
Calculates a map of all templates that have a drop target property defined, organized by drop target typeResourcePath
getId(java.lang.String templatePath)
Returns a ResourcePath using the given templatePath.TemplateInfo
getTemplateInfo(java.lang.String path)
VisionTemplate
getTemplateInstance(java.lang.String templatePath)
java.awt.image.BufferedImage
getTemplateThumbnail(java.lang.String templatePath)
static void
initDeserializedTemplate(ResourcePath path, TemplateInfo info, VisionTemplate template)
boolean
isTemplateValid(VisionTemplate template)
Whether or not this template's info is mapped, possibly removed due to an updatevoid
popCache()
void
pushCache(TemplateManager.InstanceCache cache)
void
removeTemplateListener(ResourcePath templateId, TemplateListener listener)
-
-
-
Field Detail
-
RESOURCE_TYPE
public static final ResourceType RESOURCE_TYPE
-
GLOBAL_TEMPLATE_PREFIX
public static final java.lang.String GLOBAL_TEMPLATE_PREFIX
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
TemplateManager
public TemplateManager(ClientContext context)
-
-
Method Detail
-
pushCache
public void pushCache(TemplateManager.InstanceCache cache)
-
popCache
public void popCache()
-
addTemplateListener
public void addTemplateListener(ResourcePath templateId, TemplateListener listener)
-
removeTemplateListener
public void removeTemplateListener(ResourcePath templateId, TemplateListener listener)
-
convertLegacyPath
public static java.lang.String convertLegacyPath(java.lang.String templatePath)
Detects whether the given path starts with [shared] or not.- Returns:
- a modified path pointing to a parent "shared" folder
-
initDeserializedTemplate
public static void initDeserializedTemplate(ResourcePath path, TemplateInfo info, VisionTemplate template)
-
getId
public ResourcePath getId(java.lang.String templatePath)
Returns a ResourcePath using the given templatePath. Corrects for legacy [global] paths. Will return null if the path specified doesn't exist in the project.
-
apply
public void apply(java.util.List<? extends ChangeOperation> changes)
Modifies the stored instances of the templates based on a supplied change set.
-
getTemplateInstance
public VisionTemplate getTemplateInstance(java.lang.String templatePath) throws TemplateNotFoundException, SerializationException
-
isTemplateValid
public boolean isTemplateValid(VisionTemplate template)
Whether or not this template's info is mapped, possibly removed due to an update
-
getTemplateThumbnail
public java.awt.image.BufferedImage getTemplateThumbnail(java.lang.String templatePath)
-
getDropTargetTemplates
public com.google.common.collect.Multimap<DataTypeEx,java.lang.String> getDropTargetTemplates()
Calculates a map of all templates that have a drop target property defined, organized by drop target type
-
getTemplateInfo
public TemplateInfo getTemplateInfo(java.lang.String path) throws TemplateNotFoundException, SerializationException
-
-