-
New Feature
-
Resolution: Done
-
Normal
-
7.0.4
-
None
-
ZK 8.0.2 S2
Hi,
it would be great to have a way to specify the priority of an eventhandler in the @Listen() annotation.
In my case i'm using databinding to update / validate / parse the value and save it to a java pojo. Additionally i have some business logic in the controller class business logic that does some additional work after the value has be changed. So it would be great to have the business logic triggered after the value is validated and my pojo is updated. By default, the @Listen("onChange = #component") bind's an event listener with prio 0 and so it might be triggered before the databinding has finished it's work. For me it would simplify things if it would be possible to specify a priority in the annotation, like @Listen("onChange(-100) = #component") to ensure that the logic is started after the databinder has finished it's job.
I've patched org/zkoss/zk/ui/select/Selectors.java so it parses a priority specified in brackets of the event name to make it working for me. Is it possible to implement similar functionality to the upstream release? You find my patch attached and can use it if you want...
Thanks & Bye,
Chris
----------
— org/zkoss/zk/ui/select/Selectors.java.orig 2015-01-07 13:18:05.000000000 +0100
+++ org/zkoss/zk/ui/select/Selectors.java 2015-01-07 13:26:39.000000000 +0100
@@ -210,6 +210,13 @@
Iterable<Component> iter = iterable(component, strs[1]);
// no forwarding, just add to event listener
Set<Component> rewired = rewire ? new HashSet<Component>() : null;
+ int prio = 0;
+ int idx = name.indexOf('(');
+ if (idx > 0)
for (Component c : iter) {
if (rewired != null && !rewired.contains(c))
}