use of org.csstudio.swt.widgets.figures.AbstractChoiceFigure.IChoiceButtonListener in project yamcs-studio by yamcs.
the class AbstractChoiceEditPart method doCreateFigure.
/**
* {@inheritDoc}
*/
@Override
protected IFigure doCreateFigure() {
final AbstractChoiceModel model = getWidgetModel();
updatePropSheet(model.isItemsFromPV());
AbstractChoiceFigure choiceFigure = createChoiceFigure();
choiceFigure.setSelectedColor(getWidgetModel().getSelectedColor().getSWTColor());
choiceFigure.setFont(CustomMediaFactory.getInstance().getFont(model.getFont().getFontData()));
choiceFigure.setHorizontal((Boolean) (model.getPropertyValue(AbstractChoiceModel.PROP_HORIZONTAL)));
if (!model.isItemsFromPV() || getExecutionMode() == ExecutionMode.EDIT_MODE) {
List<String> items = getWidgetModel().getItems();
if (items != null)
choiceFigure.setStates(items);
}
choiceFigure.addChoiceButtonListener(new IChoiceButtonListener() {
@Override
public void buttonPressed(int index, String value) {
setPVValue(AbstractChoiceModel.PROP_PVNAME, value);
}
});
markAsControlPV(AbstractPVWidgetModel.PROP_PVNAME, AbstractPVWidgetModel.PROP_PVVALUE);
return choiceFigure;
}
Aggregations