|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.zkoss.zk.ui.select.SelectorComposer<T>
public class SelectorComposer<T extends Component>
A composer analogous to GenericForwardComposer. Instead of wiring variables and adding event listeners by naming convention, this composer do the work by annotation and selectors.
For example:
MyComposer.java
public class MyComposer extends SelectorComposer {
@Wire("#win")
private Window myWin;
// implicit variables
@WireVariable
private Desktop desktop;
@Listen("onClick = button#btn")
public void onSubmit(Event event){
// do something ...
}
}
The selector syntax is analogous to CSS selector syntax. For example,
@Wire("textbox") // matches all textboxes
@Wire("#win") // matches components of id "#win" within the same IdSpace
@Wire(".myclass") // matches components of sclass "myclass"
@Wire("label[value = 'My Label']") // matches all labels with value "My Label"
@Wire(":first-child") // matches all components which are first child
@Wire("window textbox") // matches textbox who is a descendant of a window
@Wire("window > textbox") // matches textbox who is a child of a window
@Wire("window + textbox") // matches textbox who is the next sibling of a window
@Wire("window ~ textbox") // matches textbox who is a younger sibling of a window
@Wire("window > textbox.myclass:first-child") // conditions can be mixed
| Nested Class Summary | |
|---|---|
static interface |
SelectorComposer.UtilityHandler
An interface for SelectorComposer's functionality plug-in. |
static class |
SelectorComposer.UtilityHandlerImpl
Default skeletal implementation of SelectorComposer.UtilityHandler. |
| Field Summary | |
|---|---|
protected java.util.List<VariableResolver> |
_resolvers
A list of resolvers (never null). |
| Constructor Summary | |
|---|---|
SelectorComposer()
|
|
| Method Summary | |
|---|---|
protected void |
alert(java.lang.String m)
Shortcut to call Messagebox.show(String). |
void |
didActivate(Component comp)
Called when a session has just been activated (and its value has been deserialized). |
void |
doAfterCompose(T comp)
Invokes after ZK loader creates this component, initializes it and composes all its children, if any. |
ComponentInfo |
doBeforeCompose(Page page,
Component parent,
ComponentInfo compInfo)
Invokes before composing a component. |
void |
doBeforeComposeChildren(T comp)
Invokes after the component is instantiated and initialized, but before composing any child. |
boolean |
doCatch(java.lang.Throwable ex)
Called when an exception occurs when composing the component. |
void |
doFinally()
Called after the component has been composed completely. |
protected Page |
getPage()
Returns the current page. |
protected T |
getSelf()
Returns the component which applies to this composer. |
protected static SelectorComposer.UtilityHandler |
getUtilityHandler()
|
java.lang.Object |
willClone(Component comp)
Internal use only. |
void |
willPassivate(Component comp)
Called when a session is about to be passivated (and then serialize its value). |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected final java.util.List<VariableResolver> _resolvers
VariableResolver was annotated.
| Constructor Detail |
|---|
public SelectorComposer()
| Method Detail |
|---|
public ComponentInfo doBeforeCompose(Page page,
Component parent,
ComponentInfo compInfo)
ComposerExtComponentInfo.duplicate() to make a copy and then
modify it such that it won't affect the default behavior.
doBeforeCompose in interface ComposerExt<T extends Component>page - the page for composing this component.parent - the parent component, or null if it is the root component.compInfo - the component info used to instantiate the component.
Notice that it is null if the page is rendered as ZK JSP, since
ComponentInfo is not available under ZK JSP.
public void doBeforeComposeChildren(T comp)
throws java.lang.Exception
ComposerExt
doBeforeComposeChildren in interface ComposerExt<T extends Component>comp - the component being composed
java.lang.Exception
public void doAfterCompose(T comp)
throws java.lang.Exception
Composer
doAfterCompose in interface Composer<T extends Component>comp - the component has been composed
java.lang.Exceptionprotected T getSelf()
protected Page getPage()
protected void alert(java.lang.String m)
public java.lang.Object willClone(Component comp)
willClone in interface ComponentCloneListenercomp - the clone of the applied component
public void didActivate(Component comp)
ComponentActivationListener
didActivate in interface ComponentActivationListenerpublic void willPassivate(Component comp)
ComponentActivationListener
willPassivate in interface ComponentActivationListener
public boolean doCatch(java.lang.Throwable ex)
throws java.lang.Exception
ComposerExtIf you don't want to handle the exception, simply returns false.
boolean doCatch(Throwable ex) {return false;}
An exception thrown in this method is simply logged. It has no effect on the execution. If you want to ignore the exception, just return true.
doCatch in interface ComposerExt<T extends Component>ex - the exception being thrown
java.lang.Exception
public void doFinally()
throws java.lang.Exception
ComposerExtNote: it is always called even if ComposerExt.doCatch(java.lang.Throwable),
ComposerExt.doBeforeComposeChildren(T) or
Composer.doAfterCompose(T) is not called (due to exceptions).
Note: it is called after the onCreate event is posted, but before the onCreate and any other events are handled.
An exception thrown in this method is simply logged. It has no effect on the execution.
doFinally in interface ComposerExt<T extends Component>java.lang.Exceptionprotected static SelectorComposer.UtilityHandler getUtilityHandler()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||