Recent change in BOY may break your customized widgets

19 views
Skip to first unread message

Chen, Xihui

unread,
Jul 17, 2013, 5:31:58 PM7/17/13
to cs-stud...@lists.sourceforge.net, css...@googlegroups.com, cs-stud...@lists.sourceforge.net

Hi,

 

Recently, BOY has been changed to use org.csstudio.simplepv layer instead of using org.csstudio.utility.pv or PVManager directly: https://github.com/ControlSystemStudio/cs-studio/commit/f7286ff000d42590f6d74890b44164eaa6c21793

 

There are implementations of simplepv layer on top of both utility.pv and PVManager. For your build, you can include both implementations or only once of them, but PVManager is supposed to be the future. The plugins are:

 

Base:  core/plugins/org.csstudio.simplepv

PVManager Implementation: core/plugins/org.csstudio.simplepv.pvmanager

UtlityPV Implementation: applications/plugins/ org.csstudio.simplepv.utilitypv

 

If you have customized widgets, this change may break your customized widgets if your widgets have code handling org.csstudio.data.values.IValue, because PVValueProperty has been changed to hold VType value instead of IValue. If you have a PropertyChangeListener or PropertyChangeHandler on PVValueProperty, the value from the property is now VType value. You should change your IValue handling code to handle VType value.

 

For example, the PV value handling code in ByteMonitorEditPart has been changed like this:

 

The original code that handles IValue:

 

// PV_Value

              IWidgetPropertyChangeHandler pvhandler = new IWidgetPropertyChangeHandler() {

                     public boolean handleChange(final Object oldValue,

                                  final Object newValue, final IFigure refreshableFigure) {

                           boolean succeed = true;

                           if((newValue != null) && (newValue instanceof IValue) ){                                       

if(newValue instanceof IDoubleValue)

                                         setValue(((IDoubleValue)newValue).getValue());

                                  else if(newValue instanceof ILongValue)

                                         setValue(((ILongValue)newValue).getValue());

                                  else if(newValue instanceof IEnumeratedValue)

                                         setValue(((IEnumeratedValue)newValue).getValue());

                                  else

                                         succeed = false;

                           }

                           else {

                                   succeed = false;

                           }                         

                           return false;

                     }

              };

              setPropertyChangeHandler(ByteMonitorModel.PROP_PVVALUE, pvhandler);

 

 

 

The new code that handles VType value

 

// PV_Value

              IWidgetPropertyChangeHandler pvhandler = new IWidgetPropertyChangeHandler() {

                     public boolean handleChange(final Object oldValue,

                                  final Object newValue, final IFigure refreshableFigure) {

                           boolean succeed = true;

                           if((newValue != null) && (newValue instanceof VType) ){                                 

                                  Number number = VTypeHelper.getNumber(((VType) newValue));

                                  if (number != null) {

                                         setValue(number);

                                  } else

                                         succeed = false;                               

                           }

                           else {

                                   succeed = false;

                           }

                          

                           return false;

                     }

              };

              setPropertyChangeHandler(ByteMonitorModel.PROP_PVVALUE, pvhandler);

 

 

Sorry for the inconvenience. Please let me know if you need any assistance on this transition.

 

Thanks,

Xihui

 

 

 

Reply all
Reply to author
Forward
0 new messages