Wire Event Listeners

From Documentation
Revision as of 10:05, 28 May 2012 by Hawk (talk | contribs) (initial add)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)


Wire Event Listeners


To wire event listeners in a ViewModel like ZK Developer's Reference/MVC/Controller/Wire Event Listeners, we have to call Selectors.wireEventListeners() in the initial method. Then we can use @Listen to declare a method as an event listener.


Wire event listener in a ViewModel

public class SearchAutowireVM{

	@Init
	public void init(@ContextParam(ContextType.VIEW) Component view){
		Selectors.wireEventListeners(view, this);
	}

	@Listen("onClick=#mybutton")
	public void submit(MouseEvent event){
		//handle events
	}
}
  • Selectors.wireEventListeners() 's first parameters is Root View Component which can be retrieved by @ContextParam.


Version History

Last Update : 2012/05/28


Version Date Content
6.0.0 May 2012 Supplement




Last Update : 2012/05/28

Copyright © Potix Corporation. This article is licensed under GNU Free Documentation License.