Search in sources :

Example 1 with IChoiceButtonListener

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;
}
Also used : AbstractChoiceModel(org.csstudio.opibuilder.widgets.model.AbstractChoiceModel) AbstractChoiceFigure(org.csstudio.swt.widgets.figures.AbstractChoiceFigure) IChoiceButtonListener(org.csstudio.swt.widgets.figures.AbstractChoiceFigure.IChoiceButtonListener)

Aggregations

AbstractChoiceModel (org.csstudio.opibuilder.widgets.model.AbstractChoiceModel)1 AbstractChoiceFigure (org.csstudio.swt.widgets.figures.AbstractChoiceFigure)1 IChoiceButtonListener (org.csstudio.swt.widgets.figures.AbstractChoiceFigure.IChoiceButtonListener)1