use of org.csstudio.opibuilder.widgets.model.ActionButtonModel in project yamcs-studio by yamcs.
the class NativeButtonEditPartDelegate method doCreateFigure.
@Override
public IFigure doCreateFigure() {
ActionButtonModel model = editpart.getWidgetModel();
int style = SWT.None;
style |= model.isToggleButton() ? SWT.TOGGLE : SWT.PUSH;
style |= SWT.WRAP;
final NativeButtonFigure buttonFigure = new NativeButtonFigure(editpart, style);
button = buttonFigure.getSWTWidget();
button.setText(model.getText());
button.addTraverseListener(e -> {
if (skipTraverse)
return;
e.doit = false;
skipTraverse = true;
if (e.stateMask == 0) {
SingleSourceHelper.swtControlTraverse(button, SWT.TRAVERSE_TAB_PREVIOUS);
} else {
SingleSourceHelper.swtControlTraverse(button, SWT.TRAVERSE_TAB_NEXT);
}
skipTraverse = false;
});
buttonFigure.setImagePath(model.getImagePath());
return buttonFigure;
}
use of org.csstudio.opibuilder.widgets.model.ActionButtonModel in project yamcs-studio by yamcs.
the class NativeButtonEditPart method getHookedActions.
@Override
public List<AbstractWidgetAction> getHookedActions() {
ActionButtonModel widgetModel = getWidgetModel();
boolean isSelected = button.getSelection();
return ActionButtonEditPart.getHookedActionsForButton(widgetModel, isSelected);
}
use of org.csstudio.opibuilder.widgets.model.ActionButtonModel in project yamcs-studio by yamcs.
the class ActionButtonEditPart method doCreateFigure.
/**
* {@inheritDoc}
*/
@Override
protected IFigure doCreateFigure() {
ActionButtonModel model = getWidgetModel();
switch(model.getStyle()) {
case NATIVE:
this.delegate = new NativeButtonEditPartDelegate(this);
break;
case CLASSIC:
default:
this.delegate = new Draw2DButtonEditPartDelegate(this);
break;
}
updatePropSheet();
markAsControlPV(AbstractPVWidgetModel.PROP_PVNAME, AbstractPVWidgetModel.PROP_PVVALUE);
return delegate.doCreateFigure();
}
use of org.csstudio.opibuilder.widgets.model.ActionButtonModel in project yamcs-studio by yamcs.
the class ActionButtonEditPart method getHookedActions.
@Override
public List<AbstractWidgetAction> getHookedActions() {
ActionButtonModel widgetModel = getWidgetModel();
boolean isSelected = delegate.isSelected();
return getHookedActionsForButton(widgetModel, isSelected);
}
use of org.csstudio.opibuilder.widgets.model.ActionButtonModel in project yamcs-studio by yamcs.
the class Draw2DButtonEditPartDelegate method doCreateFigure.
/* (non-Javadoc)
* @see org.csstudio.opibuilder.widgets.editparts.IButtonEditPartDelegate#doCreateFigure()
*/
@Override
public IFigure doCreateFigure() {
ActionButtonModel model = editpart.getWidgetModel();
final ActionButtonFigure buttonFigure = new ActionButtonFigure(editpart.getExecutionMode() == ExecutionMode.RUN_MODE);
buttonFigure.setText(model.getText());
buttonFigure.setToggleStyle(model.isToggleButton());
buttonFigure.setImagePath(model.getImagePath());
editpart.updatePropSheet();
return buttonFigure;
}
Aggregations