I'm trying to have a custom editor (the "__tagPath" editor) on an alarm property being provided by my module, but it doesn't seem there is a way to do this (or at least I'm not seeing it).
The AlarmManager.registerExtendedConfigProperties
seems to take an AlarmProperty
, which super's DescriptiveProperty
, something that ConfigurationProperty
also has, so I thought I could create a new BasicAlarmConfigurationProperty
that extends BasicAlarmProperty
and implements ConfigurationProperty
and pass that in. If I do that, when creating a tag I get an error:
ExecutionException: com.inductiveautomation.ignition.client.gateway_interface.GatewayException: java.lang.RuntimeException: Error cloning object through serialization.
caused by GatewayException: java.lang.RuntimeException: Error cloning object through serialization.
caused by ExecutionException: java.lang.RuntimeException: Error cloning object through serialization.
This is the complete class:
public class BasicAlarmConfigurationProperty<T> extends BasicAlarmProperty<T> implements ConfigurationProperty<T>, Serializable {
List<ConfigurationProperty.Option<T>> options = null;
ConfigurationProperty.CustomEditorDescriptor editor = null;
String baseKey = null;
public BasicAlarmConfigurationProperty() {}
public BasicAlarmConfigurationProperty(AlarmProperty<T>base, String displayKey) {
super(base, displayKey);
}
public BasicAlarmConfigurationProperty(String name, Class<T> type, T defaultVal, String displayKey,
String categoryKey, String descKey, boolean bindable, boolean advanced,
String editorKey) {
super(name, type, defaultVal, displayKey, categoryKey, descKey, bindable, advanced);
setCustomEditor(new ConfigurationProperty.CustomEditorDescriptor(editorKey));
}
public void setCustomEditor(ConfigurationProperty.CustomEditorDescriptor desc) {
editor = desc;
}
public void setOptions(List<ConfigurationProperty.Option<T>> options) {
this.options = options;
}
@Override
public Optional<List<Option<T>>> getOptions() {
return Optional.ofNullable(options);
}
@Override
public Optional<CustomEditorDescriptor> getCustomEditor() {
return Optional.ofNullable(editor);
}
@Override
public Optional<String> getValueDisplayBaseKey() {
return Optional.empty();
}
}
Is there a way to do this? The end use here is that I'd like to pick an associated tag that reflects the alarm status back into the data source (for example, keeping alarm generation in the HMI but copying the status in the PLC). I'd like the property to include a tag browser similar to how the Reference Tag's source works.
Definition of the property:
public class AlarmProperties {
public static final BasicAlarmProperty<String> REMOTE_STATE = new BasicAlarmConfigurationProperty<>(
"remoteState",
String.class,
"",
"AlarmHandshake.Properties.RemoteState.Name",
"AlarmHandshake.Properties.RemoteState.Category",
"AlarmHandshake.Properties.RemoteState.Desc",
true,
false,
"__tagPath"
);
}
And adding it to the extended properties in the Gateway Hook:
@Override
public void setup(GatewayContext gatewayContext) {
this.gatewayContext = gatewayContext;
BundleUtil.get().addBundle("AlarmHandshake", getClass(), "AlarmProperties");
gatewayContext.getAlarmManager().registerExtendedConfigProperties(MODULE_ID, AlarmProperties.REMOTE_ACK);
}