use of org.csstudio.opibuilder.model.IPVWidgetModel.PROP_PVVALUE in project yamcs-studio by yamcs.
the class AbstractChoiceEditPart method registerPropertyChangeHandlers.
@Override
@SuppressWarnings("unchecked")
protected void registerPropertyChangeHandlers() {
setPropertyChangeHandler(PROP_PVNAME, (oldValue, newValue, figure) -> {
registerLoadItemsListener();
return false;
});
setPropertyChangeHandler(PROP_PVVALUE, (oldValue, newValue, refreshableFigure) -> {
if (newValue != null && newValue instanceof VType) {
var stringValue = VTypeHelper.getString((VType) newValue);
((AbstractChoiceFigure) refreshableFigure).setState(stringValue);
}
return false;
});
setPropertyChangeHandler(PROP_ITEMS, (oldValue, newValue, refreshableFigure) -> {
if (newValue != null && newValue instanceof List) {
((AbstractChoiceFigure) refreshableFigure).setStates(((List<String>) newValue));
if (getWidgetModel().isItemsFromPV()) {
((AbstractChoiceFigure) refreshableFigure).setState(VTypeHelper.getString(getPVValue(PROP_PVNAME)));
}
}
return true;
});
IWidgetPropertyChangeHandler selectedColorHandler = (oldValue, newValue, figure) -> {
((AbstractChoiceFigure) figure).setSelectedColor(((OPIColor) newValue).getSWTColor());
return false;
};
setPropertyChangeHandler(PROP_SELECTED_COLOR, selectedColorHandler);
setPropertyChangeHandler(PROP_HORIZONTAL, (oldValue, newValue, figure) -> {
((AbstractChoiceFigure) figure).setHorizontal((Boolean) newValue);
return true;
});
IWidgetPropertyChangeHandler handler = (oldValue, newValue, refreshableFigure) -> {
if (!(Boolean) newValue) {
((AbstractChoiceFigure) refreshableFigure).setStates((getWidgetModel().getItems()));
}
updatePropSheet((Boolean) newValue);
return false;
};
getWidgetModel().getProperty(PROP_ITEMS_FROM_PV).addPropertyChangeListener(evt -> handler.handleChange(evt.getOldValue(), evt.getNewValue(), getFigure()));
}
use of org.csstudio.opibuilder.model.IPVWidgetModel.PROP_PVVALUE in project yamcs-studio by yamcs.
the class ComboEditPart method registerPropertyChangeHandlers.
@Override
@SuppressWarnings("unchecked")
protected void registerPropertyChangeHandlers() {
setPropertyChangeHandler(PROP_PVNAME, (oldValue, newValue, figure) -> {
registerLoadItemsListener();
return false;
});
autoSizeWidget((ComboFigure) getFigure());
setPropertyChangeHandler(PROP_PVVALUE, (oldValue, newValue, refreshableFigure) -> {
if (newValue != null) {
var stringValue = VTypeHelper.getString((VType) newValue);
if (Arrays.asList(combo.getItems()).contains(stringValue)) {
combo.setText(stringValue);
} else {
combo.deselectAll();
//
// if(getWidgetModel().isBorderAlarmSensitve())
// autoSizeWidget((ComboFigure) refreshableFigure);
}
}
return true;
});
setPropertyChangeHandler(PROP_ITEMS, (oldValue, newValue, refreshableFigure) -> {
if (newValue != null && newValue instanceof List) {
updateCombo((List<String>) newValue);
if (getWidgetModel().isItemsFromPV()) {
combo.setText(VTypeHelper.getString(getPVValue(PROP_PVNAME)));
}
}
return true;
});
IWidgetPropertyChangeHandler handler = (oldValue, newValue, refreshableFigure) -> {
updatePropSheet((Boolean) newValue);
return false;
};
getWidgetModel().getProperty(PROP_ITEMS_FROM_PV).addPropertyChangeListener(evt -> handler.handleChange(evt.getOldValue(), evt.getNewValue(), getFigure()));
// size change handlers--always apply the default height
IWidgetPropertyChangeHandler handle = (oldValue, newValue, figure) -> {
autoSizeWidget((ComboFigure) figure);
return true;
};
setPropertyChangeHandler(PROP_WIDTH, handle);
setPropertyChangeHandler(PROP_HEIGHT, handle);
setPropertyChangeHandler(PROP_BORDER_STYLE, handle);
setPropertyChangeHandler(PROP_BORDER_WIDTH, handle);
setPropertyChangeHandler(PROP_FONT, handle);
}
Aggregations