Search in sources :

Example 31 with IWidgetPropertyChangeHandler

use of org.csstudio.opibuilder.properties.IWidgetPropertyChangeHandler in project yamcs-studio by yamcs.

the class MeterEditPart method registerPropertyChangeHandlers.

/**
 * {@inheritDoc}
 */
@Override
protected void registerPropertyChangeHandlers() {
    registerCommonPropertyChangeHandlers();
    // needle Color
    IWidgetPropertyChangeHandler needleColorColorHandler = new IWidgetPropertyChangeHandler() {

        @Override
        public boolean handleChange(final Object oldValue, final Object newValue, final IFigure refreshableFigure) {
            MeterFigure xMeter = (MeterFigure) refreshableFigure;
            xMeter.setNeedleColor(((OPIColor) newValue).getSWTColor());
            return false;
        }
    };
    setPropertyChangeHandler(MeterModel.PROP_NEEDLE_COLOR, needleColorColorHandler);
    // Ramp gradient
    IWidgetPropertyChangeHandler gradientHandler = new IWidgetPropertyChangeHandler() {

        @Override
        public boolean handleChange(final Object oldValue, final Object newValue, final IFigure refreshableFigure) {
            MeterFigure xMeter = (MeterFigure) refreshableFigure;
            xMeter.setGradient((Boolean) newValue);
            return false;
        }
    };
    setPropertyChangeHandler(MeterModel.PROP_RAMP_GRADIENT, gradientHandler);
    // Show Value Label
    IWidgetPropertyChangeHandler valueLabelHandler = new IWidgetPropertyChangeHandler() {

        @Override
        public boolean handleChange(final Object oldValue, final Object newValue, final IFigure refreshableFigure) {
            MeterFigure xMeter = (MeterFigure) refreshableFigure;
            xMeter.setValueLabelVisibility((Boolean) newValue);
            return false;
        }
    };
    setPropertyChangeHandler(MeterModel.PROP_SHOW_VALUE_LABEL, valueLabelHandler);
}
Also used : MeterFigure(org.csstudio.swt.widgets.figures.MeterFigure) IWidgetPropertyChangeHandler(org.csstudio.opibuilder.properties.IWidgetPropertyChangeHandler) IFigure(org.eclipse.draw2d.IFigure)

Example 32 with IWidgetPropertyChangeHandler

use of org.csstudio.opibuilder.properties.IWidgetPropertyChangeHandler in project yamcs-studio by yamcs.

the class AbstractBoolEditPart 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()}.
 */
protected void registerCommonPropertyChangeHandlers() {
    // value
    IWidgetPropertyChangeHandler handler = new IWidgetPropertyChangeHandler() {

        @Override
        public boolean handleChange(final Object oldValue, final Object newValue, final IFigure refreshableFigure) {
            if (newValue == null || !(newValue instanceof VType))
                return false;
            AbstractBoolFigure figure = (AbstractBoolFigure) refreshableFigure;
            switch(VTypeHelper.getBasicDataType((VType) newValue)) {
                case SHORT:
                    figure.setTotalBits(TotalBits.BITS_16);
                    break;
                case INT:
                case ENUM:
                    figure.setTotalBits(TotalBits.BITS_32);
                    break;
                default:
                    break;
            }
            updateFromValue((VType) newValue, figure);
            return true;
        }
    };
    setPropertyChangeHandler(AbstractPVWidgetModel.PROP_PVVALUE, handler);
    // bit
    handler = new IWidgetPropertyChangeHandler() {

        @Override
        public boolean handleChange(final Object oldValue, final Object newValue, final IFigure refreshableFigure) {
            if (getWidgetModel().getDataType() != 0)
                return false;
            AbstractBoolFigure figure = (AbstractBoolFigure) refreshableFigure;
            figure.setBit((Integer) newValue);
            updateFromValue(getPVValue(AbstractPVWidgetModel.PROP_PVNAME), figure);
            return true;
        }
    };
    setPropertyChangeHandler(AbstractBoolWidgetModel.PROP_BIT, handler);
    // data type
    final IWidgetPropertyChangeHandler dataTypeHandler = new IWidgetPropertyChangeHandler() {

        @Override
        public boolean handleChange(Object oldValue, Object newValue, IFigure refreshableFigure) {
            AbstractBoolFigure figure = (AbstractBoolFigure) refreshableFigure;
            if ((Integer) newValue == 0)
                figure.setBit(getWidgetModel().getBit());
            else
                figure.setBit(-1);
            updateFromValue(getPVValue(AbstractPVWidgetModel.PROP_PVNAME), figure);
            updatePropSheet((Integer) newValue);
            return true;
        }
    };
    getWidgetModel().getProperty(AbstractBoolWidgetModel.PROP_DATA_TYPE).addPropertyChangeListener(new PropertyChangeListener() {

        @Override
        public void propertyChange(PropertyChangeEvent evt) {
            dataTypeHandler.handleChange(evt.getOldValue(), evt.getNewValue(), getFigure());
        }
    });
    // on state
    handler = new IWidgetPropertyChangeHandler() {

        public boolean handleChange(Object oldValue, Object newValue, IFigure refreshableFigure) {
            AbstractBoolFigure figure = (AbstractBoolFigure) refreshableFigure;
            updateFromValue(getPVValue(AbstractPVWidgetModel.PROP_PVNAME), figure);
            return true;
        }
    };
    setPropertyChangeHandler(AbstractBoolWidgetModel.PROP_ON_STATE, handler);
    // show bool label
    handler = new IWidgetPropertyChangeHandler() {

        @Override
        public boolean handleChange(final Object oldValue, final Object newValue, final IFigure refreshableFigure) {
            AbstractBoolFigure figure = (AbstractBoolFigure) refreshableFigure;
            figure.setShowBooleanLabel((Boolean) newValue);
            return true;
        }
    };
    setPropertyChangeHandler(AbstractBoolWidgetModel.PROP_SHOW_BOOL_LABEL, handler);
    // bool label position
    handler = new IWidgetPropertyChangeHandler() {

        @Override
        public boolean handleChange(final Object oldValue, final Object newValue, final IFigure refreshableFigure) {
            AbstractBoolFigure figure = (AbstractBoolFigure) refreshableFigure;
            figure.setBoolLabelPosition(BoolLabelPosition.values()[(Integer) newValue]);
            return false;
        }
    };
    setPropertyChangeHandler(AbstractBoolWidgetModel.PROP_BOOL_LABEL_POS, handler);
    // on label
    handler = new IWidgetPropertyChangeHandler() {

        @Override
        public boolean handleChange(final Object oldValue, final Object newValue, final IFigure refreshableFigure) {
            AbstractBoolFigure figure = (AbstractBoolFigure) refreshableFigure;
            figure.setOnLabel((String) newValue);
            return true;
        }
    };
    setPropertyChangeHandler(AbstractBoolWidgetModel.PROP_ON_LABEL, handler);
    // off label
    handler = new IWidgetPropertyChangeHandler() {

        @Override
        public boolean handleChange(final Object oldValue, final Object newValue, final IFigure refreshableFigure) {
            AbstractBoolFigure figure = (AbstractBoolFigure) refreshableFigure;
            figure.setOffLabel((String) newValue);
            return true;
        }
    };
    setPropertyChangeHandler(AbstractBoolWidgetModel.PROP_OFF_LABEL, handler);
    // on color
    handler = new IWidgetPropertyChangeHandler() {

        @Override
        public boolean handleChange(final Object oldValue, final Object newValue, final IFigure refreshableFigure) {
            AbstractBoolFigure figure = (AbstractBoolFigure) refreshableFigure;
            figure.setOnColor(((OPIColor) newValue).getSWTColor());
            return true;
        }
    };
    setPropertyChangeHandler(AbstractBoolWidgetModel.PROP_ON_COLOR, handler);
    // off color
    handler = new IWidgetPropertyChangeHandler() {

        @Override
        public boolean handleChange(final Object oldValue, final Object newValue, final IFigure refreshableFigure) {
            AbstractBoolFigure figure = (AbstractBoolFigure) refreshableFigure;
            figure.setOffColor(((OPIColor) newValue).getSWTColor());
            return true;
        }
    };
    setPropertyChangeHandler(AbstractBoolWidgetModel.PROP_OFF_COLOR, handler);
}
Also used : PropertyChangeEvent(java.beans.PropertyChangeEvent) VType(org.diirt.vtype.VType) PropertyChangeListener(java.beans.PropertyChangeListener) IWidgetPropertyChangeHandler(org.csstudio.opibuilder.properties.IWidgetPropertyChangeHandler) AbstractBoolFigure(org.csstudio.swt.widgets.figures.AbstractBoolFigure) OPIColor(org.csstudio.opibuilder.util.OPIColor) IFigure(org.eclipse.draw2d.IFigure)

Example 33 with IWidgetPropertyChangeHandler

use of org.csstudio.opibuilder.properties.IWidgetPropertyChangeHandler in project yamcs-studio by yamcs.

the class AbstractChoiceEditPart method registerPropertyChangeHandlers.

/**
 * {@inheritDoc}
 */
@Override
protected void registerPropertyChangeHandlers() {
    IWidgetPropertyChangeHandler pvNameHandler = new IWidgetPropertyChangeHandler() {

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

        @Override
        public boolean handleChange(final Object oldValue, final Object newValue, final IFigure refreshableFigure) {
            if (newValue != null && newValue instanceof VType) {
                String stringValue = VTypeHelper.getString((VType) newValue);
                ((AbstractChoiceFigure) refreshableFigure).setState(stringValue);
            }
            return false;
        }
    };
    setPropertyChangeHandler(AbstractChoiceModel.PROP_PVVALUE, pvhandler);
    // Items
    IWidgetPropertyChangeHandler itemsHandler = new IWidgetPropertyChangeHandler() {

        @SuppressWarnings("unchecked")
        @Override
        public boolean handleChange(final Object oldValue, final Object newValue, final IFigure refreshableFigure) {
            if (newValue != null && newValue instanceof List) {
                ((AbstractChoiceFigure) refreshableFigure).setStates(((List<String>) newValue));
                if (getWidgetModel().isItemsFromPV())
                    ((AbstractChoiceFigure) refreshableFigure).setState(VTypeHelper.getString(getPVValue(AbstractPVWidgetModel.PROP_PVNAME)));
            }
            return true;
        }
    };
    setPropertyChangeHandler(AbstractChoiceModel.PROP_ITEMS, itemsHandler);
    IWidgetPropertyChangeHandler selectedColorHandler = new IWidgetPropertyChangeHandler() {

        @Override
        public boolean handleChange(Object oldValue, Object newValue, IFigure figure) {
            ((AbstractChoiceFigure) figure).setSelectedColor(((OPIColor) newValue).getSWTColor());
            return false;
        }
    };
    setPropertyChangeHandler(ChoiceButtonModel.PROP_SELECTED_COLOR, selectedColorHandler);
    IWidgetPropertyChangeHandler horizontalHandler = new IWidgetPropertyChangeHandler() {

        @Override
        public boolean handleChange(Object oldValue, Object newValue, IFigure figure) {
            ((AbstractChoiceFigure) figure).setHorizontal((Boolean) newValue);
            return true;
        }
    };
    setPropertyChangeHandler(AbstractChoiceModel.PROP_HORIZONTAL, horizontalHandler);
    final IWidgetPropertyChangeHandler handler = new IWidgetPropertyChangeHandler() {

        @Override
        public boolean handleChange(final Object oldValue, final Object newValue, final IFigure refreshableFigure) {
            if (!(Boolean) newValue)
                ((AbstractChoiceFigure) refreshableFigure).setStates((getWidgetModel().getItems()));
            updatePropSheet((Boolean) newValue);
            return false;
        }
    };
    getWidgetModel().getProperty(AbstractChoiceModel.PROP_ITEMS_FROM_PV).addPropertyChangeListener(new PropertyChangeListener() {

        @Override
        public void propertyChange(PropertyChangeEvent evt) {
            handler.handleChange(evt.getOldValue(), evt.getNewValue(), getFigure());
        }
    });
}
Also used : PropertyChangeEvent(java.beans.PropertyChangeEvent) VType(org.diirt.vtype.VType) AbstractChoiceFigure(org.csstudio.swt.widgets.figures.AbstractChoiceFigure) PropertyChangeListener(java.beans.PropertyChangeListener) IWidgetPropertyChangeHandler(org.csstudio.opibuilder.properties.IWidgetPropertyChangeHandler) List(java.util.List) IFigure(org.eclipse.draw2d.IFigure)

Example 34 with IWidgetPropertyChangeHandler

use of org.csstudio.opibuilder.properties.IWidgetPropertyChangeHandler 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)

Example 35 with IWidgetPropertyChangeHandler

use of org.csstudio.opibuilder.properties.IWidgetPropertyChangeHandler in project yamcs-studio by yamcs.

the class AbstractScaledWidgetEditPart 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()}.
 */
protected void registerCommonPropertyChangeHandlers() {
    // value
    IWidgetPropertyChangeHandler valueHandler = new IWidgetPropertyChangeHandler() {

        @Override
        public boolean handleChange(final Object oldValue, final Object newValue, final IFigure refreshableFigure) {
            if (newValue == null)
                return false;
            AbstractScaledWidgetFigure figure = (AbstractScaledWidgetFigure) refreshableFigure;
            figure.setValue(VTypeHelper.getDouble((VType) newValue));
            return false;
        }
    };
    setPropertyChangeHandler(AbstractPVWidgetModel.PROP_PVVALUE, valueHandler);
    // minimum
    IWidgetPropertyChangeHandler minimumHandler = new IWidgetPropertyChangeHandler() {

        @Override
        public boolean handleChange(final Object oldValue, final Object newValue, final IFigure refreshableFigure) {
            AbstractScaledWidgetFigure figure = (AbstractScaledWidgetFigure) refreshableFigure;
            figure.setRange((Double) newValue, ((AbstractScaledWidgetModel) getModel()).getMaximum());
            return false;
        }
    };
    setPropertyChangeHandler(AbstractScaledWidgetModel.PROP_MIN, minimumHandler);
    // maximum
    IWidgetPropertyChangeHandler maximumHandler = new IWidgetPropertyChangeHandler() {

        @Override
        public boolean handleChange(final Object oldValue, final Object newValue, final IFigure refreshableFigure) {
            AbstractScaledWidgetFigure figure = (AbstractScaledWidgetFigure) refreshableFigure;
            figure.setRange(((AbstractScaledWidgetModel) getModel()).getMinimum(), (Double) newValue);
            return false;
        }
    };
    setPropertyChangeHandler(AbstractScaledWidgetModel.PROP_MAX, maximumHandler);
    // major tick step hint
    IWidgetPropertyChangeHandler majorTickHandler = new IWidgetPropertyChangeHandler() {

        @Override
        public boolean handleChange(final Object oldValue, final Object newValue, final IFigure refreshableFigure) {
            AbstractScaledWidgetFigure figure = (AbstractScaledWidgetFigure) refreshableFigure;
            figure.setMajorTickMarkStepHint((Integer) newValue);
            return false;
        }
    };
    setPropertyChangeHandler(AbstractScaledWidgetModel.PROP_MAJOR_TICK_STEP_HINT, majorTickHandler);
    // logScale
    IWidgetPropertyChangeHandler logScaleHandler = new IWidgetPropertyChangeHandler() {

        @Override
        public boolean handleChange(final Object oldValue, final Object newValue, final IFigure refreshableFigure) {
            AbstractScaledWidgetFigure figure = (AbstractScaledWidgetFigure) refreshableFigure;
            figure.setLogScale((Boolean) newValue);
            return false;
        }
    };
    setPropertyChangeHandler(AbstractScaledWidgetModel.PROP_LOG_SCALE, logScaleHandler);
    // showScale
    IWidgetPropertyChangeHandler showScaleHandler = new IWidgetPropertyChangeHandler() {

        @Override
        public boolean handleChange(final Object oldValue, final Object newValue, final IFigure refreshableFigure) {
            AbstractScaledWidgetFigure figure = (AbstractScaledWidgetFigure) refreshableFigure;
            figure.setShowScale((Boolean) newValue);
            return false;
        }
    };
    setPropertyChangeHandler(AbstractScaledWidgetModel.PROP_SHOW_SCALE, showScaleHandler);
    // showMinorTicks
    IWidgetPropertyChangeHandler showMinorTicksHandler = new IWidgetPropertyChangeHandler() {

        @Override
        public boolean handleChange(final Object oldValue, final Object newValue, final IFigure refreshableFigure) {
            AbstractScaledWidgetFigure figure = (AbstractScaledWidgetFigure) refreshableFigure;
            figure.setShowMinorTicks((Boolean) newValue);
            return false;
        }
    };
    setPropertyChangeHandler(AbstractScaledWidgetModel.PROP_SHOW_MINOR_TICKS, showMinorTicksHandler);
    // Transparent
    IWidgetPropertyChangeHandler transparentHandler = new IWidgetPropertyChangeHandler() {

        @Override
        public boolean handleChange(final Object oldValue, final Object newValue, final IFigure refreshableFigure) {
            AbstractScaledWidgetFigure figure = (AbstractScaledWidgetFigure) refreshableFigure;
            figure.setTransparent((Boolean) newValue);
            return false;
        }
    };
    setPropertyChangeHandler(AbstractScaledWidgetModel.PROP_TRANSPARENT, transparentHandler);
    IWidgetPropertyChangeHandler scaleFontHandler = new IWidgetPropertyChangeHandler() {

        @Override
        public boolean handleChange(Object oldValue, Object newValue, IFigure refreshableFigure) {
            AbstractScaledWidgetFigure figure = (AbstractScaledWidgetFigure) refreshableFigure;
            figure.getScale().setFont(((OPIFont) newValue).getSWTFont());
            return false;
        }
    };
    setPropertyChangeHandler(AbstractScaledWidgetModel.PROP_SCALE_FONT, scaleFontHandler);
    // scale format
    IWidgetPropertyChangeHandler numericFormatHandler = new IWidgetPropertyChangeHandler() {

        @Override
        public boolean handleChange(Object oldValue, Object newValue, IFigure figure) {
            AbstractScaledWidgetFigure scaleFigure = (AbstractScaledWidgetFigure) figure;
            setScaleFormat(scaleFigure, (String) newValue);
            return false;
        }
    };
    setPropertyChangeHandler(AbstractScaledWidgetModel.PROP_SCALE_FORMAT, numericFormatHandler);
    // value label format
    IWidgetPropertyChangeHandler valueFormatHandler = new IWidgetPropertyChangeHandler() {

        @Override
        public boolean handleChange(Object oldValue, Object newValue, IFigure figure) {
            AbstractScaledWidgetFigure scaleFigure = (AbstractScaledWidgetFigure) figure;
            setValueLabelFormat(scaleFigure, (String) newValue);
            return false;
        }
    };
    setPropertyChangeHandler(AbstractScaledWidgetModel.PROP_VALUE_LABEL_FORMAT, valueFormatHandler);
}
Also used : VType(org.diirt.vtype.VType) AbstractScaledWidgetFigure(org.csstudio.swt.widgets.figures.AbstractScaledWidgetFigure) IWidgetPropertyChangeHandler(org.csstudio.opibuilder.properties.IWidgetPropertyChangeHandler) IFigure(org.eclipse.draw2d.IFigure)

Aggregations

IWidgetPropertyChangeHandler (org.csstudio.opibuilder.properties.IWidgetPropertyChangeHandler)65 IFigure (org.eclipse.draw2d.IFigure)61 PropertyChangeEvent (java.beans.PropertyChangeEvent)27 PropertyChangeListener (java.beans.PropertyChangeListener)27 OPIColor (org.csstudio.opibuilder.util.OPIColor)10 VType (org.diirt.vtype.VType)10 AbstractWidgetModel (org.csstudio.opibuilder.model.AbstractWidgetModel)7 IPath (org.eclipse.core.runtime.IPath)7 AbstractContainerModel (org.csstudio.opibuilder.model.AbstractContainerModel)4 XYGraphModel (org.csstudio.opibuilder.widgets.model.XYGraphModel)4 List (java.util.List)3 AlarmSeverityListener (org.csstudio.opibuilder.editparts.AlarmSeverityListener)3 ImageFigure (org.csstudio.opibuilder.widgets.figures.ImageFigure)3 TabProperty (org.csstudio.opibuilder.widgets.model.TabModel.TabProperty)3 AlarmSeverity (org.diirt.vtype.AlarmSeverity)3 Dimension (org.eclipse.draw2d.geometry.Dimension)3 OPIFont (org.csstudio.opibuilder.util.OPIFont)2 ImageBoolButtonFigure (org.csstudio.opibuilder.widgets.figures.ImageBoolButtonFigure)2 NativeButtonFigure (org.csstudio.opibuilder.widgets.figures.NativeButtonFigure)2 TabModel (org.csstudio.opibuilder.widgets.model.TabModel)2