I want the visibility property of the native component to be bound to a property on my custom component. My component bindings have been working perfectly for receiving information from native components. The issue arises when I bind a native component to my custom components property. I can see my custom component property is firing but the native component only reacts to the original binding state and never changes again. I can't post all the code but I can post relevant code.
Bean Info Example
import com.inductiveautomation.factorypmi.designer.property.customizers.DynamicPropertyProviderCustomizer;
import com.inductiveautomation.factorypmi.designer.property.customizers.StyleCustomizer;
import com.inductiveautomation.vision.api.designer.beans.CommonBeanInfo;
import com.inductiveautomation.vision.api.designer.beans.VisionBeanDescriptor;
import com.client.components.DeviceControl.AnalogControlPane;
import com.client.components.DeviceControl.UpperAnalogControlPane;
import java.beans.IntrospectionException;
public class UpperAnalogControlPaneBeanInfo extends CommonBeanInfo {
public UpperAnalogControlPaneBeanInfo()
{
super(UpperAnalogControlPane.class, DynamicPropertyProviderCustomizer.VALUE_DESCRIPTOR, StyleCustomizer.VALUE_DESCRIPTOR);
}
@Override
protected void initProperties() throws IntrospectionException
{
super.initProperties();
addProp("tagPath", "Tag Path", "Device Tag Path", "Setup", BOUND_MASK);
addProp("deviceDescriptionText", "Device Description Text", "Device Description Text", "Setup", BOUND_MASK);
addProp("statusTagPath", "Status Tag Path", "The Status Path for Device", "Setup", BOUND_MASK);
addProp("controlGroupActionPath", "Control Group Action Path", "The Tag Path for the Desired Action", "Setup",BOUND_MASK);
addProp("currentIndex", "Current Index","The current device being controlled", "Setup", BOUND_MASK);
addProp("controlGroupRootPath", "Control Group Root Path","Path To UDT", "Setup", BOUND_MASK);
addProp("controlSelectorValue", "Control Selector Value","Button Control Coordination", "Setup", BOUND_MASK);
}
@Override
protected void initDesc()
{
VisionBeanDescriptor analogBean = getBeanDescriptor();
analogBean.setName("Upper Analog Control Panel");
analogBean.setDisplayName("Upper Analog Pane");
analogBean.setShortDescription("Control Analog Devices that contain Discrete Attributes");
}
}
An example of the methods in the view class for property changes:
public void actionPerformed(ActionEvent buttonClicked) {
if (buttonClicked.getActionCommand().equals("DISCRETE") || buttonClicked.getActionCommand().equals("ANALOG"))
{
this.controlSelectorValue = this.deviceControlButton.isSelected();
logger.info("Value of selector button {}", this.controlSelectorValue);
logger.info("Value of Control button {}", deviceControlButton.isSelected());
discretePaneDisabled(this.controlSelectorValue);
setControlSelectorValue(this.controlSelectorValue);
}
}
public Boolean getControlSelectorValue() {
return controlSelectorValue;
}
public void setControlSelectorValue(Boolean value)
{
Boolean oldValue = this.controlSelectorValue;
logger.info("Changing the control selector value {}", value);
this.controlSelectorValue = value;
propertyChangeSupport.firePropertyChange("controlSelectorValue", oldValue, controlSelectorValue);
}
public void propertyChange(PropertyChangeEvent event) {
String propertyName = event.getPropertyName();
Object inputValue = event.getNewValue();
logger.info("Property change event has been called " + inputValue);
if (propertyName.equals("tagPath") && inputValue != null && !inputValue.toString().isEmpty())
{
if (subscribedFlag == 0)
{
if(aMediator != null)
{
this.aMediator.unsubscribeTags();
subscribeStatus();
subscribedFlag = 1;
}else
{
logger.info("Still Null - TAG PATH");
}
}
} else if (propertyName.equals("controlGroupRootPath") && inputValue != null && !inputValue.toString().isEmpty())
{
if (aMediator != null) {
this.aMediator.setRootPath(controlGroupRootPath);
}else {
logger.info("Still Null - Control Group Path");
}
}
}
The property attribute I chose to share from the view class is ControlSelectorValue. I am purposely not doing anything when this property changes. Sorry I have to be kind of vague but I will try to share as much as I can. The property changes I am catching work perfectly. These properties are bound to the root container. The issue I am having is when I try to bind a native component's property to a property on my component. In the designer the binding connects normally. However the native component will only change from the original binding connection any further property changes my component has are ignored. I see my logger messages in the designer so my component property changes are firing.