How to add an Image property for an abstract Vision component ?
Looking for a code example.
A code snipped please
Hello,
I have never done it, but maybe you can add a String property in your bean, and configure the related BeanInfo class by adding a property that use a custom property editor with the api:
DefaultBeanInfo.addProp(name,display,desc,category, flags, customEditor)
The editor needs to extend:
com.inductiveautomation.factorypmi.designer.property.editors.bb.SwingEditorSupport
Unfortunately, there is no javadoc available for that class (It seems that anything in the factorypmi package is not included in the javadoc) so you might need to guess it. But I imagine you can use the class ImageChooser within that Editor…
Once you have your image, you can use it when drawing your component.
HTH,
Nicolas
With no javadoc or example, it’s difficult to find the way to add an image property in a component…
A code snipped will be welcome !
Hello,
I am not sure what code snipped would you need. Maybe you could tell us what you have tried and what are the problem you have encountered. The SwingEditorSupport is a class that extends java.beans.PropertyEditorSupport, so I magine the purpose would be quite similar. Maybe you should overrides getCustomEditor() and provide your own Component…
Sorry I can’t really help more without actually trying to do it my-self
Cheers
Nicolas
I proceeded for my image property, as for string property or other type,
in the CommonBeanInfo :
But I don't have the image folder Choser on my image property in the designer !
[attachment=0]ignition_image_prop.jpg[/attachment]
Don't know what'is going wrong ?
I think this is the expected behaviour as the default component does not know how to edit an image. The only way would be to use the API to specify your own editor as I mentionned before. Did you had a chance to try that?
Cheers
Nicolas