public void doSetValue(Object value) { updating = true; try { Object oldValue = doGetValue(); Method writeMethod = propertyDescriptor.getWriteMethod(); if (!writeMethod.isAccessible()) { writeMethod.setAccessible(true); } writeMethod.invoke(object, new Object[] {value}); fireValueChange(Diffs.createValueDiff(oldValue, doGetValue())); } catch (InvocationTargetException e) { /* * InvocationTargetException wraps any exception thrown by the * invoked method. */ throw new RuntimeException(e.getCause()); } catch (Exception e) { if (BeansObservables.DEBUG) { Policy.getLog() .log( new Status( IStatus.WARNING, Policy.JFACE_DATABINDING, IStatus.OK, "Could not change value of " + object + "." + propertyDescriptor.getName(), e)); //$NON-NLS-1$ //$NON-NLS-2$ } } finally { updating = false; } }
@Override public void doSetValue(Object aValue) { Object oldValue = doGetValue(); String[] nameValues = ((String) aValue).split(" "); // $NON-NLS-1$ try { myIsUpdating = true; if (nameValues.length == 3) { for (int i = 0; i < 3; i++) { myObservableValues[i].setValue(nameValues[i]); } } else if (nameValues.length == 2) { myObservableValues[0].setValue(nameValues[0]); myObservableValues[1].setValue(""); // $NON-NLS-1$ myObservableValues[2].setValue(nameValues[1]); } else if (nameValues.length == 1) { myObservableValues[0].setValue(nameValues[0]); myObservableValues[1].setValue(""); // $NON-NLS-1$ myObservableValues[2].setValue(""); // $NON-NLS-1$ } else { for (int i = 0; i < 3; i++) { myObservableValues[i].setValue(""); // $NON-NLS-1$ } } } finally { myIsUpdating = false; } doGetValue(); fireValueChange(Diffs.createValueDiff(oldValue, aValue)); }
@Override protected void doSetValue(Object value) { Object oldValue = this.value; if (overrideValue != null) value = overrideValue; this.value = value; stale = false; fireValueChange(Diffs.createValueDiff(oldValue, value)); }
@Override public void focusLost(FocusEvent e) { if (!updating) { Date newSelection = CDateTimeObservableValue.this.dateTime.getSelection(); fireValueChange(Diffs.createValueDiff(currentSelection, newSelection)); currentSelection = newSelection; } }
@Override public void handleChange(final ChangeEvent event) { if (!this.setting) { final Object newValue = calculate(); final Object oldValue = this.value; if ((oldValue != null) ? !oldValue.equals(newValue) : null != newValue) { fireValueChange(Diffs.createValueDiff(oldValue, this.value = newValue)); } } }
@Override protected void doSetValue(Object value) { if (value instanceof Date && !dateTime.isDisposed()) { Date oldValue; Date newValue; try { updating = true; oldValue = dateTime.getSelection(); newValue = (Date) value; dateTime.setSelection(newValue); currentSelection = newValue; fireValueChange(Diffs.createValueDiff(oldValue, newValue)); } finally { updating = false; } } }
@Override public void doSetValue(Object value) { final Object oldValue = doGetValue(); if (attribute.equals(Constants.ATTR_IMAGE)) { item.setImage((Image) value); } else if (attribute.equals(Constants.ATTR_TEXT)) { item.setText((String) value); } else if (attribute.equals(Constants.ATTR_TOOLTIP)) { if (item instanceof TableColumn) { ((TableColumn) item).setToolTipText((String) value); } if (item instanceof TreeColumn) { ((TreeColumn) item).setToolTipText((String) value); } if (item instanceof ToolItem) { ((ToolItem) item).setToolTipText((String) value); } if (item instanceof TabItem) { ((TabItem) item).setToolTipText((String) value); } } else if (attribute.equals(Constants.ATTR_ALIGNMENT)) { if (item instanceof TableColumn) { ((TableColumn) item).setAlignment((Integer) value); } if (item instanceof TreeColumn) { ((TreeColumn) item).setAlignment((Integer) value); } } else if (attribute.equals(Constants.ATTR_WIDTH)) { if (item instanceof TableColumn) { ((TableColumn) item).setWidth((Integer) value); } if (item instanceof TreeColumn) { ((TreeColumn) item).setWidth((Integer) value); } if (item instanceof ToolItem) { ((ToolItem) item).setWidth((Integer) value); } } else if (attribute.equals(Constants.ATTR_ENABLED)) { if (item instanceof ToolItem) { ((ToolItem) item).setEnabled(value == Boolean.TRUE); } } fireValueChange(Diffs.createValueDiff(oldValue, value)); }
/** Selection changed... */ protected void handleSelectionChanged() { final Object newValue = doGetValue(); if (Util.equals(myCurrentValue, newValue)) return; fireValueChange(Diffs.createValueDiff(myCurrentValue, myCurrentValue = newValue)); }
public void handleChange(ChangeEvent event) { fireValueChange(Diffs.createValueDiff(currentValue, doGetValue())); }