|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.zkoss.zk.ui.event.GenericEventListener
org.zkoss.zk.ui.util.GenericComposer
org.zkoss.zk.ui.util.GenericAutowireComposer
public abstract class GenericAutowireComposer
An abstract composer that you can extend and write intuitive onXxx event handler methods with "auto-wired" accessible variable objects such as implicit objects, components, and external resolvable variables in a ZK zuml page; this class will registers onXxx events to the supervised component and wire all accessible variable objects to this composer by calling setXxx() method or set xxx field value directly per the variable name. Since 3.0.7, this composer has wired all implicit objects such as self, spaceOwner, page, desktop, session, application, componentScope, spaceScope, pageScope, desktopScope, sessionScope, applicationScope, and requestScope, so you can use them directly. Besides that, it also provides alert(String message) method, so you can call alert() without problems.
Notice that since this composer kept references to the components, single instance composer object cannot be shared by multiple components.
The following is an example. The onOK event listener is registered into the target window, and the Textbox component with id name "mytextbox" is injected into the "mytextbox" field automatically (so you can use mytextbox variable directly in onOK).
MyComposer.java
public class MyComposer extends GenericAutowireComposer {
private Textbox mytextbox;
public void onOK() {
mytextbox.setValue("Enter Pressed");
alert("Hi!");
}
}
test.zul
<window id="mywin" apply="MyComposer">
<textbox id="mytextbox"/>
</window>
Components.wireFellows(org.zkoss.zk.ui.IdSpace, java.lang.Object)
,
Serialized FormField Summary | |
---|---|
protected char |
_separator
The separator. |
protected WebApp |
application
Implicit Object; the web application. |
protected java.util.Map |
applicationScope
Implicit Object; a map of attributes defined in the web application. |
protected java.util.Map |
arg
Implicit Object; the arg argument passed to the createComponents method. |
protected java.util.Map |
componentScope
Implicit Object; a map of attributes defined in the applied component. |
protected Desktop |
desktop
Implicit Object; the desktop. |
protected java.util.Map |
desktopScope
Implicit Object; a map of attributes defined in the desktop. |
protected Execution |
execution
Implicit Object; the current execution. |
protected Page |
page
Implicit Object; the page. |
protected java.util.Map |
pageScope
Implicit Object; a map of attributes defined in the page. |
protected java.util.Map |
param
Implicit Object; the param argument passed from the http request. |
protected java.util.Map |
requestScope
Implicit Object; a map of attributes defined in the request. |
protected Component |
self
Implicit Object; the applied component itself. |
protected Session |
session
Implicit Object; the session. |
protected java.util.Map |
sessionScope
Implicit Object; a map of attributes defined in the session. |
protected IdSpace |
spaceOwner
Implicit Object; the space owner of the applied component. |
protected java.util.Map |
spaceScope
Implicit Object; a map of attributes defined in the ID space contains the applied component. |
Fields inherited from class org.zkoss.zk.ui.util.GenericComposer |
---|
_applied |
Constructor Summary | |
---|---|
protected |
GenericAutowireComposer()
|
protected |
GenericAutowireComposer(char separator)
Constructor with a custom separator. |
Method Summary | |
---|---|
protected void |
alert(java.lang.String m)
|
void |
didActivate(Component comp)
Called when a session has just been activated (and its value has been deserialized). |
void |
doAfterCompose(Component comp)
Auto wire accessible variables of the specified component into a controller Java object; a subclass that override this method should remember to call super.doAfterCompose(comp) or it will not work. |
java.lang.Object |
willClone(Component comp)
Internal use only. |
Methods inherited from class org.zkoss.zk.ui.util.GenericComposer |
---|
doBeforeCompose, doBeforeComposeChildren, doCatch, doFinally, willPassivate |
Methods inherited from class org.zkoss.zk.ui.event.GenericEventListener |
---|
bindComponent, getController, onEvent, unbindComponent |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.zkoss.zk.ui.util.ComponentActivationListener |
---|
willPassivate |
Field Detail |
---|
protected transient Component self
protected transient IdSpace spaceOwner
protected transient Page page
protected transient Desktop desktop
protected transient Session session
protected transient WebApp application
protected transient java.util.Map componentScope
protected transient java.util.Map spaceScope
protected transient java.util.Map pageScope
protected transient java.util.Map desktopScope
protected transient java.util.Map sessionScope
protected transient java.util.Map applicationScope
protected transient java.util.Map requestScope
protected transient Execution execution
protected transient java.util.Map arg
protected transient java.util.Map param
protected final char _separator
Constructor Detail |
---|
protected GenericAutowireComposer()
protected GenericAutowireComposer(char separator)
Method Detail |
---|
public void doAfterCompose(Component comp) throws java.lang.Exception
doAfterCompose
in interface Composer
doAfterCompose
in class GenericComposer
comp
- the component has been composed
java.lang.Exception
protected void alert(java.lang.String m)
public java.lang.Object willClone(Component comp)
willClone
in interface ComponentCloneListener
comp
- the clone of the applied component
public void didActivate(Component comp)
ComponentActivationListener
didActivate
in interface ComponentActivationListener
didActivate
in class GenericComposer
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |