Search in sources :

Example 1 with ActionButtonModel

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;
}
Also used : NativeButtonFigure(org.csstudio.opibuilder.widgets.figures.NativeButtonFigure) ActionButtonModel(org.csstudio.opibuilder.widgets.model.ActionButtonModel)

Example 2 with ActionButtonModel

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);
}
Also used : ActionButtonModel(org.csstudio.opibuilder.widgets.model.ActionButtonModel)

Example 3 with ActionButtonModel

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();
}
Also used : ActionButtonModel(org.csstudio.opibuilder.widgets.model.ActionButtonModel)

Example 4 with ActionButtonModel

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);
}
Also used : ActionButtonModel(org.csstudio.opibuilder.widgets.model.ActionButtonModel)

Example 5 with ActionButtonModel

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

Aggregations

ActionButtonModel (org.csstudio.opibuilder.widgets.model.ActionButtonModel)5 NativeButtonFigure (org.csstudio.opibuilder.widgets.figures.NativeButtonFigure)1 ActionButtonFigure (org.csstudio.swt.widgets.figures.ActionButtonFigure)1