/** * Set PV to given value. Should accept Double, Double[], Integer, String, maybe more. * * @param pvPropId * @param value */ public void setPVValue(String pvPropId, Object value) { fireSetPVValue(pvPropId, value); final IPV pv = pvMap.get(pvPropId); if (pv != null) { try { if (pvPropId.equals(controlPVPropId) && controlPVValuePropId != null && getUpdateSuppressTime() > 0) { // activate suppress timer synchronized (this) { if (updateSuppressTimer == null || timerTask == null) initUpdateSuppressTimer(); if (!updateSuppressTimer.isDue()) updateSuppressTimer.reset(); else startUpdateSuppressTimer(); } } pv.setValue(value); } catch (final Exception e) { UIBundlingThread.getInstance() .addRunnable( new Runnable() { public void run() { String message = "Failed to write PV:" + pv.getName(); ErrorHandlerUtil.handleError(message, e); } }); } } }
/** * Start the updateSuppressTimer. All property change listeners of PV_Value property will * temporarily removed until timer is due. */ protected synchronized void startUpdateSuppressTimer() { AbstractWidgetProperty pvValueProperty = editpart.getWidgetModel().getProperty(controlPVValuePropId); pvValueListeners = pvValueProperty.getAllPropertyChangeListeners(); pvValueProperty.removeAllPropertyChangeListeners(); updateSuppressTimer.start(timerTask, getUpdateSuppressTime()); }