Is it possible to create a Vision Component that is able to create Instances of Templates?

Hi all,

Looking to make a Vision Component that acts as a Custom implementation of the Template Canvas. From what I can tell this might not be possible (i.e. accessing and creating instances of Ignition Templates) but I am hoping someone might have a little insight and able to confirm whether this is in fact passed the technical limitations as I know IA obviously have to keep their in-house module source code under tight wraps.

All answers are appreciated thanks!

You can subclass the Template Canvas in a 3rd party module to create a version with custom behavior.

1 Like

This is excellent news for me, is it just extending a class and if so any idea what the reference would be, etc. I tried building upon built-in modules before (or at least implementing behaviour) but was unable to see how to do so, are you able to point me to documentation as I could never find it!

Start with the Vision Component example module:

Then subclass this:

Thanks, this is exactly what I was looking for. I always did look to see if built-in components could be extended but seems I always missed this part of the docs. Thanks!

Sorry Phil,

Any ideas on the best way to deal with the BeansInfo? As I say, I haven’t extended in-built components before and this is a relatively painful one to start with. Is there a way I can essentially transfer over the Component Properties to my Override or do I need to figure out what the original BeanInfos contains and remake it from scratch?

Kind Regards,

Max

You need your own beaninfo. You can reference the original to establish a baseline and just provide the differences.

When you say reference do you mean extending the TemplateCanvasBeanInfo class? If I am just extending the TemplateCanvasBeanInfo how do I override the Constructor to point to my new component instead of TemplateCanvas.class? I.e. the equivalent of:

public class ExBeanInfo extends CommonBeanInfo {

    public ExBeanInfo() {
        super(ExComponent.class, DynamicPropertyProviderCustomizer.VALUE_DESCRIPTOR, StyleCustomizer.VALUE_DESCRIPTOR);
    }

As I know that the TemplateCanvasBeanInfo already extends CommonBeanInfo, I have never met a situation where I need to change something like this.

No. Extend CommonBeanInfo and implement getAdditionalBeanInfo().

1 Like

You could also create instances of TemplateHolder in your own custom component, if whatever you're trying to do doesn't work well as a direct subclass of the existing template canvas component.

1 Like

If you do this, be sure to call the lifecycle methods when they are called on your outer component, plus when dynamically adding/removing on the run. This is required to start/stop the template's nested bindings.

1 Like