Skip to end of metadata
Go to start of metadata

Writing a component for the Vision module is as easy as writing any Java Swing-based component. There are only a few things specific to Ignition and the Vision module that you need to be aware of. 

JavaBean Properties

One of the most fundamental parts of writing a component is exposing properties to the rest of the Vision system. These properties are going to be the primary mechanism for your component to be configured and to interact with data from the rest of Ignition, such as tag data and SQL query data. To expose a property, you simply need to make it accessible via JavaBean-style getter/setter functions. 
For example, if I have a String field called title on my component, I'd add these functions to expose the property: 


public String getTitle() {
    return title;
public void setTitle(String title) {
    this.title = title;

Now as long as I include the title property in my component's BeanInfo class, it will show up in the Property Table pane when the user selects the component in the designer. That means they can set the value of the property, or bind it to a tag, a query, or whatever. Note that your component remains blissfully unaware of the binding system - all it cares about is that the title field may change, and it knows how to deal with that.

Bound Properties

Components have two major types of properties: normal properties and bound properties. All properties whose type is understood by Ignition can use the binding system. That is, the user can configure a binding on that property. However, only bound properties can be bound to. To understand this, look at the Text Field component. It has many properties. Now put a Label on a window and bind the text of the label to the text field's text. You'll notice that the list of the Text Field's properties that you can bind the label's text to is much shorter than the whole list of properties for the Text Field. This shorter list is the list of bound properties. A better name for these might be: properties that can be bound to.
There are two things that make a property a bound property.

  1. In the component's BeanInfo class, the component is marked as a bound property with the BOUND_MASK.
  1. The component property fires the propertyChangeEvent when the field is altered. This event is what powers the binding system. For example, to make the title field fire events, I'd alter the setter function to this:
public void setTitle(String title) { 
    String oldValue = this.title; 
	this.title = title;
	firePropertyChange("title", oldValue, title);

Special Abilities

There are a few special abilities that users of the Vision system expect a component to have. The ability to add dynamic properties and displaying the correct quality overlay are examples of these. By having your component implement the correct interfaces, they gain these abilities.

To save you the trouble of implementing a handful of interfaces that you aren't familiar with, the Vision module provides abstract base classes that you are encouraged to extend. So, instead of extending directly from JComponent, you might extend AbstractVisionComponent, which itself extends from JComponent. Doing this will get you: dynamic properties, quality overlays, styles, correct cursor and name collision handling. It is highly recommended that you extend from either AbstractVisionComponent, AbstractVisionPanel, or AbstractVisionScrollPane to start your component off on the right foot.


All components are expected to implement the VisionComponent interface (All of the abstract base classes above already do this for you). This defines the quality monitoring behavior as well as the ComponentLifecycle behavior.  ComponentLifecycle is an interface that defines a startup and shutdown method. The startup method gives you the VisionClientContext, which can be handy for referencing the rest of the system. More importantly, it lets your component know when to shut itself down. Any component that has long-running background processes (threads) needs to shut them down when the shutdownComponent() function is called. Not doing this will create a resource leak. This function is called when the window that contains the component is closed.



  • No labels