Search in sources :

Example 1 with AbstractMarkedWidgetFigure

use of org.csstudio.swt.widgets.figures.AbstractMarkedWidgetFigure in project yamcs-studio by yamcs.

the class AbstractMarkedWidgetEditPart method registerCommonPropertyChangeHandlers.

/**
 * Registers property change handlers for the properties defined in
 * {@link AbstractScaledWidgetModel}. This method is provided for the convenience
 * of subclasses, which can call this method in their implementation of
 * {@link #registerPropertyChangeHandlers()}.
 */
@Override
protected void registerCommonPropertyChangeHandlers() {
    super.registerCommonPropertyChangeHandlers();
    IWidgetPropertyChangeHandler pvNameHandler = new IWidgetPropertyChangeHandler() {

        @Override
        public boolean handleChange(Object oldValue, Object newValue, IFigure figure) {
            registerLoadLimitsListener();
            return false;
        }
    };
    setPropertyChangeHandler(AbstractPVWidgetModel.PROP_PVNAME, pvNameHandler);
    // showMarkers
    IWidgetPropertyChangeHandler showMarkersHandler = new IWidgetPropertyChangeHandler() {

        @Override
        public boolean handleChange(final Object oldValue, final Object newValue, final IFigure refreshableFigure) {
            AbstractMarkedWidgetFigure figure = (AbstractMarkedWidgetFigure) refreshableFigure;
            figure.setShowMarkers((Boolean) newValue);
            return false;
        }
    };
    setPropertyChangeHandler(AbstractMarkedWidgetModel.PROP_SHOW_MARKERS, showMarkersHandler);
    // LoLo Level
    IWidgetPropertyChangeHandler loloHandler = new IWidgetPropertyChangeHandler() {

        @Override
        public boolean handleChange(final Object oldValue, final Object newValue, final IFigure refreshableFigure) {
            AbstractMarkedWidgetFigure figure = (AbstractMarkedWidgetFigure) refreshableFigure;
            figure.setLoloLevel((Double) newValue);
            return true;
        }
    };
    setPropertyChangeHandler(AbstractMarkedWidgetModel.PROP_LOLO_LEVEL, loloHandler);
    // Lo Level
    IWidgetPropertyChangeHandler loHandler = new IWidgetPropertyChangeHandler() {

        @Override
        public boolean handleChange(final Object oldValue, final Object newValue, final IFigure refreshableFigure) {
            AbstractMarkedWidgetFigure figure = (AbstractMarkedWidgetFigure) refreshableFigure;
            figure.setLoLevel((Double) newValue);
            return true;
        }
    };
    setPropertyChangeHandler(AbstractMarkedWidgetModel.PROP_LO_LEVEL, loHandler);
    // Hi Level
    IWidgetPropertyChangeHandler hiHandler = new IWidgetPropertyChangeHandler() {

        @Override
        public boolean handleChange(final Object oldValue, final Object newValue, final IFigure refreshableFigure) {
            AbstractMarkedWidgetFigure figure = (AbstractMarkedWidgetFigure) refreshableFigure;
            figure.setHiLevel((Double) newValue);
            return true;
        }
    };
    setPropertyChangeHandler(AbstractMarkedWidgetModel.PROP_HI_LEVEL, hiHandler);
    // HiHi Level
    IWidgetPropertyChangeHandler hihiHandler = new IWidgetPropertyChangeHandler() {

        @Override
        public boolean handleChange(final Object oldValue, final Object newValue, final IFigure refreshableFigure) {
            AbstractMarkedWidgetFigure figure = (AbstractMarkedWidgetFigure) refreshableFigure;
            figure.setHihiLevel((Double) newValue);
            return true;
        }
    };
    setPropertyChangeHandler(AbstractMarkedWidgetModel.PROP_HIHI_LEVEL, hihiHandler);
    // show lolo
    IWidgetPropertyChangeHandler showLoloHandler = new IWidgetPropertyChangeHandler() {

        @Override
        public boolean handleChange(final Object oldValue, final Object newValue, final IFigure refreshableFigure) {
            AbstractMarkedWidgetFigure figure = (AbstractMarkedWidgetFigure) refreshableFigure;
            figure.setShowLolo((Boolean) newValue);
            return true;
        }
    };
    setPropertyChangeHandler(AbstractMarkedWidgetModel.PROP_SHOW_LOLO, showLoloHandler);
    // show lo
    IWidgetPropertyChangeHandler showLoHandler = new IWidgetPropertyChangeHandler() {

        @Override
        public boolean handleChange(final Object oldValue, final Object newValue, final IFigure refreshableFigure) {
            AbstractMarkedWidgetFigure figure = (AbstractMarkedWidgetFigure) refreshableFigure;
            figure.setShowLo((Boolean) newValue);
            return true;
        }
    };
    setPropertyChangeHandler(AbstractMarkedWidgetModel.PROP_SHOW_LO, showLoHandler);
    // show Hi
    IWidgetPropertyChangeHandler showHiHandler = new IWidgetPropertyChangeHandler() {

        @Override
        public boolean handleChange(final Object oldValue, final Object newValue, final IFigure refreshableFigure) {
            AbstractMarkedWidgetFigure figure = (AbstractMarkedWidgetFigure) refreshableFigure;
            figure.setShowHi((Boolean) newValue);
            return false;
        }
    };
    setPropertyChangeHandler(AbstractMarkedWidgetModel.PROP_SHOW_HI, showHiHandler);
    // show Hihi
    IWidgetPropertyChangeHandler showHihiHandler = new IWidgetPropertyChangeHandler() {

        @Override
        public boolean handleChange(final Object oldValue, final Object newValue, final IFigure refreshableFigure) {
            AbstractMarkedWidgetFigure figure = (AbstractMarkedWidgetFigure) refreshableFigure;
            figure.setShowHihi((Boolean) newValue);
            return false;
        }
    };
    setPropertyChangeHandler(AbstractMarkedWidgetModel.PROP_SHOW_HIHI, showHihiHandler);
    // Lolo color
    IWidgetPropertyChangeHandler LoloColorHandler = new IWidgetPropertyChangeHandler() {

        @Override
        public boolean handleChange(final Object oldValue, final Object newValue, final IFigure refreshableFigure) {
            AbstractMarkedWidgetFigure figure = (AbstractMarkedWidgetFigure) refreshableFigure;
            figure.setLoloColor(((OPIColor) newValue).getSWTColor());
            return false;
        }
    };
    setPropertyChangeHandler(AbstractMarkedWidgetModel.PROP_LOLO_COLOR, LoloColorHandler);
    // Lo color
    IWidgetPropertyChangeHandler LoColorHandler = new IWidgetPropertyChangeHandler() {

        @Override
        public boolean handleChange(final Object oldValue, final Object newValue, final IFigure refreshableFigure) {
            AbstractMarkedWidgetFigure figure = (AbstractMarkedWidgetFigure) refreshableFigure;
            figure.setLoColor(((OPIColor) newValue).getSWTColor());
            return false;
        }
    };
    setPropertyChangeHandler(AbstractMarkedWidgetModel.PROP_LO_COLOR, LoColorHandler);
    // Hi color
    IWidgetPropertyChangeHandler HiColorHandler = new IWidgetPropertyChangeHandler() {

        @Override
        public boolean handleChange(final Object oldValue, final Object newValue, final IFigure refreshableFigure) {
            AbstractMarkedWidgetFigure figure = (AbstractMarkedWidgetFigure) refreshableFigure;
            figure.setHiColor(((OPIColor) newValue).getSWTColor());
            return false;
        }
    };
    setPropertyChangeHandler(AbstractMarkedWidgetModel.PROP_HI_COLOR, HiColorHandler);
    // Hihi color
    IWidgetPropertyChangeHandler HihiColorHandler = new IWidgetPropertyChangeHandler() {

        @Override
        public boolean handleChange(final Object oldValue, final Object newValue, final IFigure refreshableFigure) {
            AbstractMarkedWidgetFigure figure = (AbstractMarkedWidgetFigure) refreshableFigure;
            figure.setHihiColor(((OPIColor) newValue).getSWTColor());
            return false;
        }
    };
    setPropertyChangeHandler(AbstractMarkedWidgetModel.PROP_HIHI_COLOR, HihiColorHandler);
}
Also used : AbstractMarkedWidgetFigure(org.csstudio.swt.widgets.figures.AbstractMarkedWidgetFigure) IWidgetPropertyChangeHandler(org.csstudio.opibuilder.properties.IWidgetPropertyChangeHandler) IFigure(org.eclipse.draw2d.IFigure)

Aggregations

IWidgetPropertyChangeHandler (org.csstudio.opibuilder.properties.IWidgetPropertyChangeHandler)1 AbstractMarkedWidgetFigure (org.csstudio.swt.widgets.figures.AbstractMarkedWidgetFigure)1 IFigure (org.eclipse.draw2d.IFigure)1