How do I bind a property adapter to a specific Tag in code?

I am trying to change the Tag binding for a numeric label’s property ‘Mouseover Text’ from Tagname.toolTipText to Tagname.LastUpdated. I am able to retrieve the value of the property adapter for this component’s property, and I am able to clear the property adapter, but I can’t figure out how to set it. How do you instantiate the ‘pa’ in the setPropertyAdapter method ‘setPropertyAdapter(java.awt.Component c, java.lang.String propName, PropertyAdapter pa)’. A specific code example would be appreciated. I have reviewed the SDK and can’t figure this one out.


Here is the code snipet I have so far:

#get property adapter
w = system.gui.getWindow(‘Main Windows/WQYork’)
c = w.getRootContainer().getComponent(‘nlbl_WP_Curr’)
pa = w.interactionController.getPropertyAdapter(c,‘toolTipText’)
print pa
returns York/PH_CURR_WP.Tooltip --> nlbl_WP_Curr.toolTipText

#remove the property adapter (must be removed before setting one?)
w.interactionController.removePropertyAdapter(c, ‘toolTipText’)
pa = w.interactionController.getPropertyAdapter(c,‘toolTipText’)
print pa
returns None

#set property adapter for component ‘Mouseover Text’ property
pa = ‘York/PH_CURR_WP.LastChange --> nlbl_WP_Curr.toolTipText’ # this is what I want the Tag binding to be
pa = w.interactionController.getPropertyAdapter(c,‘toolTipText’)
print pa

Returns Traceback (most recent call last):
_ File “”, line 3, in _
TypeError: setPropertyAdapter(): 3rd arg can’t be coerced to com.inductiveautomation.factorypmi.application.binding.PropertyAdapter

1 Like

You are treading on dangerous and unstable ground. There is no support for manipulating binding like this.
The supported way to do this is to use an indirect tag binding and change the string property as needed.