Skip to main content



      Home
Home » Eclipse Projects » Eclipse Scout » Controlling if execChangedValue() is called or not.
Controlling if execChangedValue() is called or not. [message #1356939] Thu, 15 May 2014 05:38 Go to next message
Eclipse UserFriend
Here some thoughts about execChangedValue() trigger, depending on the situation:

Import FormData:
By default importFormData() does not trigger an execChangedValue() event when the values are imported.
The framework provides a possibility to activate the triggers with the method:
importFormData(AbstractFormData source, boolean valueChangeTriggersEnabled)

This allows you to trigger the execChangedValue() events:
importFormData(formData, true)



Reset Value:
Reset value calls execChangedValue() if the current value differs from the initial value (the initial value is determined by Scout with the value that is set during the execLoad of the FormHandler).

A possibility to avoid the execChangedValue trigger during doReset() is to add this snippet in all the value fields:

@Override
public void resetValue() {
  try {
    setValueChangeTriggerEnabled(false);
    super.resetValue();
  }
  finally {
    setValueChangeTriggerEnabled(true);
  }
}



Set value without execChangedValue trigger:
Similar to the previous pattern, it is possible to write a utility to set a value on a field without triggering execChangedValue():

public static <T> void setValueWithoutChangedValueTrigger(IValueField<T> field, T v) {
  try {
    field.setValueChangeTriggerEnabled(false);
    field.setValue(v);
  }
  finally {
    field.setValueChangeTriggerEnabled(true);
  }
}


Or you add this in all your value fields:
public void setValueWithoutValueChangeTrigger(String value) {
    try {
        setValueChangeTriggerEnabled(false);
        setValue(value);
    } finally {
        setValueChangeTriggerEnabled(true);
    }
}


---

In my opinion support to trigger of execChangedValue() or not should be improved in the Scout API directly.

What do you think?
Re: Controlling if execChangedValue() is called or not. [message #1585191 is a reply to message #1356939] Mon, 26 January 2015 01:04 Go to previous message
Eclipse UserFriend
Keeping questions together. I have answered something similar on StackOverflow: Eclipse Scout callback for entering value in fields.
Previous Topic:Detecting that the server is not available and reacting to this state.
Next Topic:Width in Pixel
Goto Forum:
  


Current Time: Tue Jun 10 03:42:43 EDT 2025

Powered by FUDForum. Page generated in 0.05791 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top