Search in sources :

Example 1 with PROP_PASSWORD

use of org.csstudio.opibuilder.widgets.model.AbstractBoolControlModel.PROP_PASSWORD in project yamcs-studio by yamcs.

the class AbstractBoolControlEditPart method registerCommonPropertyChangeHandlers.

/**
 * Registers property change handlers for the properties defined in {@link AbstractBoolWidgetModel}. This method is
 * provided for the convenience of subclasses, which can call this method in their implementation of
 * {@link #registerPropertyChangeHandlers()}.
 */
@Override
protected void registerCommonPropertyChangeHandlers() {
    configureButtonListener((AbstractBoolControlFigure) getFigure());
    super.registerCommonPropertyChangeHandlers();
    IWidgetPropertyChangeHandler toggleHandler = (oldValue, newValue, refreshableFigure) -> {
        var figure = (AbstractBoolControlFigure) refreshableFigure;
        figure.setToggle((Boolean) newValue);
        return true;
    };
    getWidgetModel().getProperty(PROP_TOGGLE_BUTTON).addPropertyChangeListener(evt -> toggleHandler.handleChange(evt.getOldValue(), evt.getNewValue(), getFigure()));
    setPropertyChangeHandler(PROP_CONFIRM_DIALOG, (oldValue, newValue, refreshableFigure) -> {
        var figure = (AbstractBoolControlFigure) refreshableFigure;
        figure.setShowConfirmDialog(getWidgetModel().getShowConfirmDialog());
        return true;
    });
    setPropertyChangeHandler(PROP_CONFIRM_TIP, (oldValue, newValue, refreshableFigure) -> {
        var figure = (AbstractBoolControlFigure) refreshableFigure;
        figure.setConfirmTip((String) newValue);
        return true;
    });
    setPropertyChangeHandler(PROP_PASSWORD, (oldValue, newValue, refreshableFigure) -> {
        var figure = (AbstractBoolControlFigure) refreshableFigure;
        figure.setPassword((String) newValue);
        return true;
    });
    // enabled. WidgetBaseEditPart will force the widget as disabled in edit model,
    // which is not the case for the bool control widget
    setPropertyChangeHandler(PROP_ENABLED, (oldValue, newValue, refreshableFigure) -> {
        var figure = (AbstractBoolControlFigure) refreshableFigure;
        figure.setEnabled((Boolean) newValue);
        return true;
    });
}
Also used : PROP_PVVALUE(org.csstudio.opibuilder.model.IPVWidgetModel.PROP_PVVALUE) AbstractBoolFigure(org.csstudio.swt.widgets.figures.AbstractBoolFigure) PROP_CONFIRM_TIP(org.csstudio.opibuilder.widgets.model.AbstractBoolControlModel.PROP_CONFIRM_TIP) PROP_PASSWORD(org.csstudio.opibuilder.widgets.model.AbstractBoolControlModel.PROP_PASSWORD) PROP_ENABLED(org.csstudio.opibuilder.model.AbstractWidgetModel.PROP_ENABLED) AbstractBaseEditPart(org.csstudio.opibuilder.editparts.AbstractBaseEditPart) PROP_PVNAME(org.csstudio.opibuilder.model.IPVWidgetModel.PROP_PVNAME) PROP_CONFIRM_DIALOG(org.csstudio.opibuilder.widgets.model.AbstractBoolControlModel.PROP_CONFIRM_DIALOG) AbstractBoolWidgetModel(org.csstudio.opibuilder.widgets.model.AbstractBoolWidgetModel) AbstractBoolControlFigure(org.csstudio.swt.widgets.figures.AbstractBoolControlFigure) PROP_TOGGLE_BUTTON(org.csstudio.opibuilder.widgets.model.AbstractBoolControlModel.PROP_TOGGLE_BUTTON) AbstractBoolControlModel(org.csstudio.opibuilder.widgets.model.AbstractBoolControlModel) ExecutionMode(org.csstudio.opibuilder.editparts.ExecutionMode) IWidgetPropertyChangeHandler(org.csstudio.opibuilder.properties.IWidgetPropertyChangeHandler) IWidgetPropertyChangeHandler(org.csstudio.opibuilder.properties.IWidgetPropertyChangeHandler) AbstractBoolControlFigure(org.csstudio.swt.widgets.figures.AbstractBoolControlFigure)

Aggregations

AbstractBaseEditPart (org.csstudio.opibuilder.editparts.AbstractBaseEditPart)1 ExecutionMode (org.csstudio.opibuilder.editparts.ExecutionMode)1 PROP_ENABLED (org.csstudio.opibuilder.model.AbstractWidgetModel.PROP_ENABLED)1 PROP_PVNAME (org.csstudio.opibuilder.model.IPVWidgetModel.PROP_PVNAME)1 PROP_PVVALUE (org.csstudio.opibuilder.model.IPVWidgetModel.PROP_PVVALUE)1 IWidgetPropertyChangeHandler (org.csstudio.opibuilder.properties.IWidgetPropertyChangeHandler)1 AbstractBoolControlModel (org.csstudio.opibuilder.widgets.model.AbstractBoolControlModel)1 PROP_CONFIRM_DIALOG (org.csstudio.opibuilder.widgets.model.AbstractBoolControlModel.PROP_CONFIRM_DIALOG)1 PROP_CONFIRM_TIP (org.csstudio.opibuilder.widgets.model.AbstractBoolControlModel.PROP_CONFIRM_TIP)1 PROP_PASSWORD (org.csstudio.opibuilder.widgets.model.AbstractBoolControlModel.PROP_PASSWORD)1 PROP_TOGGLE_BUTTON (org.csstudio.opibuilder.widgets.model.AbstractBoolControlModel.PROP_TOGGLE_BUTTON)1 AbstractBoolWidgetModel (org.csstudio.opibuilder.widgets.model.AbstractBoolWidgetModel)1 AbstractBoolControlFigure (org.csstudio.swt.widgets.figures.AbstractBoolControlFigure)1 AbstractBoolFigure (org.csstudio.swt.widgets.figures.AbstractBoolFigure)1