use of org.csstudio.opibuilder.widgetActions.ActionsInput in project yamcs-studio by yamcs.
the class MenuButtonEditPart method registerLoadActionsListener.
private void registerLoadActionsListener() {
if (getExecutionMode() == ExecutionMode.RUN_MODE) {
if (getWidgetModel().isActionsFromPV()) {
IPV pv = getPV(AbstractPVWidgetModel.PROP_PVNAME);
if (pv != null) {
if (loadActionsFromPVListener == null)
loadActionsFromPVListener = new IPVListener.Stub() {
@Override
public void valueChanged(IPV pv) {
VType value = pv.getValue();
if (value != null && value instanceof VEnum) {
List<String> new_meta = ((VEnum) value).getLabels();
if (meta == null || !meta.equals(new_meta)) {
meta = new_meta;
ActionsInput actionsInput = new ActionsInput();
for (String writeValue : meta) {
WritePVAction action = new WritePVAction();
action.setPropertyValue(WritePVAction.PROP_PVNAME, getWidgetModel().getPVName());
action.setPropertyValue(WritePVAction.PROP_VALUE, writeValue);
action.setPropertyValue(WritePVAction.PROP_DESCRIPTION, writeValue);
actionsInput.getActionsList().add(action);
}
getWidgetModel().setPropertyValue(AbstractWidgetModel.PROP_ACTIONS, actionsInput);
}
}
}
};
pv.addListener(loadActionsFromPVListener);
}
}
}
}
use of org.csstudio.opibuilder.widgetActions.ActionsInput in project yamcs-studio by yamcs.
the class ActionsProperty method writeToXML.
@Override
public void writeToXML(Element propElement) {
ActionsInput actionsInput = (ActionsInput) getPropertyValue();
// //$NON-NLS-1$
propElement.setAttribute(XML_ATTRIBUTE_HOOK_FIRST, "" + actionsInput.isFirstActionHookedUpToWidget());
// //$NON-NLS-1$
propElement.setAttribute(XML_ATTRIBUTE_HOOK_ALL, "" + actionsInput.isHookUpAllActionsToWidget());
for (AbstractWidgetAction action : actionsInput.getActionsList()) {
Element actionElement = new Element(XML_ELEMENT_ACTION);
actionElement.setAttribute(XML_ATTRIBUTE_ACTION_TYPE, action.getActionType().toString());
for (AbstractWidgetProperty property : action.getAllProperties()) {
Element propEle = new Element(property.getPropertyID());
property.writeToXML(propEle);
actionElement.addContent(propEle);
}
propElement.addContent(actionElement);
}
}
use of org.csstudio.opibuilder.widgetActions.ActionsInput in project yamcs-studio by yamcs.
the class ActionsProperty method checkValue.
@Override
public Object checkValue(Object value) {
if (value == null)
return null;
ActionsInput acceptableValue = null;
if (value instanceof ActionsInput) {
((ActionsInput) value).setWidgetModel(widgetModel);
acceptableValue = (ActionsInput) value;
}
return acceptableValue;
}
Aggregations