[Bug #1009] Fix bug
onChangeEnableApply was wiping the listener just added. Now both of them are added to the same time. FEA: ItEr74S04BugFixing
This commit is contained in:
parent
da568213fc
commit
86be89730c
2 changed files with 20 additions and 4 deletions
|
|
@ -590,12 +590,29 @@ public class Util {
|
|||
*/
|
||||
public static void ensureUniqueListener(Component component, String eventName,
|
||||
EventListener uniqueListener) {
|
||||
ensureUniqueListeners(component, eventName, uniqueListener);
|
||||
}
|
||||
|
||||
/**
|
||||
* It removes all listeners registered for eventName and adds the new
|
||||
* listeners. It's ensured that the only listeners left in the component for
|
||||
* events of name eventName is uniqueListeners
|
||||
*
|
||||
* @param component
|
||||
* @param eventName
|
||||
* @param uniqueListeners
|
||||
* new listeners to add
|
||||
*/
|
||||
public static void ensureUniqueListeners(Component component,
|
||||
String eventName, EventListener... uniqueListeners) {
|
||||
Iterator<?> listenerIterator = component.getListenerIterator(eventName);
|
||||
while (listenerIterator.hasNext()) {
|
||||
listenerIterator.next();
|
||||
listenerIterator.remove();
|
||||
}
|
||||
component.addEventListener(eventName, uniqueListener);
|
||||
for (EventListener each : uniqueListeners) {
|
||||
component.addEventListener(eventName, each);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -315,7 +315,7 @@ public class FormBinder {
|
|||
this.labelTaskStart = labelTaskStart;
|
||||
this.labelTaskEnd = labelTaskEnd;
|
||||
initializeDateAndDurationFieldsFromTaskOriginalValues();
|
||||
Util.ensureUniqueListener(taskWorkableDays, Events.ON_CHANGE,
|
||||
Util.ensureUniqueListeners(taskWorkableDays, Events.ON_CHANGE,
|
||||
new EventListener() {
|
||||
|
||||
@Override
|
||||
|
|
@ -336,9 +336,8 @@ public class FormBinder {
|
|||
showValueOfDateOn(labelTaskStart, newStart);
|
||||
}
|
||||
}
|
||||
});
|
||||
}, onChangeEnableApply);
|
||||
applyDisabledRules();
|
||||
onChangeEnableApply(taskWorkableDays);
|
||||
}
|
||||
|
||||
void applyDisabledRules() {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue