|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.zkoss.spring.util.GenericSpringComposer
An abstract composer that you can extend and write intuitive
@EventHandler
("myComponent.onXXX") event handler methods and
auto-wired components in a ZK ZUML page. This class will add
forward condition to myComponent and forward source onXXX event
received by teh source myComponent to the target component method
annotated with (@link EventHandler) annotation.
Notice that since this composer kept references to the components, single instance object cannot be shared by multiple components.
The following is an example. The onClick event received by Button will be forwarded to target Window myWin and the Textbox component with id name and Button component with id greetBtn are injected into name and greetBtn fields respectively (so you can use name and greetBtn variables directly in showGreeting without problem)
GreetingCtrl.java
@org.springframework.stereotype.Component
("greetingCtrl")
@Scope
("desktop")
public class GreetingCtrl extends GenericSpringComposer {
@Autowired
private Textbox name;
@Autowired
private Button greetBtn;
@EventHandler
("greetBtn.onClick")
public void showGreeting(Event evt) throws WrongValueException, InterruptedException {
Messagebox.show("Hello " + name.getValue() + "!");
}
}
test.zul
<?variable-resolver class="org.zkoss.zkplus.spring.DelegatingVariableResolver"?>
<window id="myWin" apply="${greetingCtrl}">
<textbox id="name" />
<button id="greetBtn" label="Greet!" />
</window>
public class GenericSpringComposer
Constructor Summary | |
---|---|
GenericSpringComposer()
Deprecated. |
Method Summary | |
---|---|
void |
doAfterCompose(org.zkoss.zk.ui.Component comp)
Deprecated. Auto-wires ZK Components in controllers and registers event handlers for |
org.zkoss.zk.ui.metainfo.ComponentInfo |
doBeforeCompose(org.zkoss.zk.ui.Page page,
org.zkoss.zk.ui.Component parent,
org.zkoss.zk.ui.metainfo.ComponentInfo compInfo)
Deprecated. |
void |
doBeforeComposeChildren(org.zkoss.zk.ui.Component comp)
Deprecated. |
boolean |
doCatch(Throwable ex)
Deprecated. |
void |
doFinally()
Deprecated. |
protected Object |
getController()
Deprecated. |
void |
onEvent(org.zkoss.zk.ui.event.Event evt)
Deprecated. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public GenericSpringComposer()
Method Detail |
---|
public void doAfterCompose(org.zkoss.zk.ui.Component comp) throws Exception
doAfterCompose
in interface org.zkoss.zk.ui.util.Composer
Exception
protected Object getController()
public org.zkoss.zk.ui.metainfo.ComponentInfo doBeforeCompose(org.zkoss.zk.ui.Page page, org.zkoss.zk.ui.Component parent, org.zkoss.zk.ui.metainfo.ComponentInfo compInfo) throws Exception
doBeforeCompose
in interface org.zkoss.zk.ui.util.ComposerExt
Exception
public void doBeforeComposeChildren(org.zkoss.zk.ui.Component comp) throws Exception
doBeforeComposeChildren
in interface org.zkoss.zk.ui.util.ComposerExt
Exception
public boolean doCatch(Throwable ex) throws Exception
doCatch
in interface org.zkoss.zk.ui.util.ComposerExt
Exception
public void doFinally() throws Exception
doFinally
in interface org.zkoss.zk.ui.util.ComposerExt
Exception
public void onEvent(org.zkoss.zk.ui.event.Event evt) throws Exception
onEvent
in interface org.zkoss.zk.ui.event.EventListener
Exception
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |