use of org.csstudio.display.builder.model.properties.ActionInfo in project org.csstudio.display.builder by kasemir.
the class WidgetRuntime method start.
/**
* Start: Connect to PVs, start scripts
* @throws Exception on error
*/
public void start() throws Exception {
// Update "value" property from primary PV, if defined
final Optional<WidgetProperty<String>> name = widget.checkProperty(propPVName);
final Optional<WidgetProperty<VType>> value = widget.checkProperty(runtimePropPVValue);
if (name.isPresent() && value.isPresent())
pv_name_binding.set(new PVNameToValueBinding(this, name.get(), value.get(), true));
// Prepare action-related PVs
final List<ActionInfo> actions = widget.propActions().getValue().getActions();
if (actions.size() > 0) {
final List<RuntimePV> action_pvs = new ArrayList<>();
for (final ActionInfo action : actions) {
if (action instanceof WritePVActionInfo) {
final String pv_name = ((WritePVActionInfo) action).getPV();
final String expanded = MacroHandler.replace(widget.getMacrosOrProperties(), pv_name);
final RuntimePV pv = PVFactory.getPV(expanded);
action_pvs.add(pv);
addPV(pv, true);
}
}
if (action_pvs.size() > 0)
this.writable_pvs = action_pvs;
}
widget.propClass().addPropertyListener(update_widget_class);
// Start scripts in pool because Jython setup is expensive
RuntimeUtil.getExecutor().execute(this::startScripts);
}
Aggregations