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 classTemplateManager.InstanceCache 
- 
Field Summary
Fields Modifier and Type Field Description static java.lang.StringGLOBAL_TEMPLATE_PREFIXstatic ResourceTypeRESOURCE_TYPE 
- 
Constructor Summary
Constructors Constructor Description TemplateManager(ClientContext context) 
- 
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddTemplateListener(ResourcePath templateId, TemplateListener listener)voidapply(java.util.List<? extends ChangeOperation> changes)Modifies the stored instances of the templates based on a supplied change set.static java.lang.StringconvertLegacyPath(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 typeResourcePathgetId(java.lang.String templatePath)Returns a ResourcePath using the given templatePath.TemplateInfogetTemplateInfo(java.lang.String path)VisionTemplategetTemplateInstance(java.lang.String templatePath)java.awt.image.BufferedImagegetTemplateThumbnail(java.lang.String templatePath)static voidinitDeserializedTemplate(ResourcePath path, TemplateInfo info, VisionTemplate template)booleanisTemplateValid(VisionTemplate template)Whether or not this template's info is mapped, possibly removed due to an updatevoidpopCache()voidpushCache(TemplateManager.InstanceCache cache)voidremoveTemplateListener(ResourcePath templateId, TemplateListener listener)voidshutdown()Performs any necessary shutdown tasks for the TemplateManager. 
 - 
 
- 
- 
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 
- 
shutdown
public void shutdown()
Performs any necessary shutdown tasks for the TemplateManager. 
- 
getTemplateInfo
public TemplateInfo getTemplateInfo(java.lang.String path) throws TemplateNotFoundException, SerializationException
 
 - 
 
 -