org.zkoss.zk.ui.annotation
Annotation Type ComponentAnnotation


@Retention(value=RUNTIME)
@Target(value={TYPE,METHOD})
public @interface ComponentAnnotation

Annotation for specifying ZK component's annotations (ComponentCtrl.getAnnotations(java.lang.String, java.lang.String)).

For example, you could specify component's annotations as follows:


@ComponentAnnotation(
 "@ZKBIND(ACCESS=both, SAVE_EVENT=onChange, LOAD_REPLACEMENT=rawValue, LOAD_TYPE=java.lang.String")
public String getValue() {
    //...
}

The syntax of the value is the same as ZUML's annotations. Like ZUML, if you have multiple annotations, you can specify it in the same string. For example,


@ComponentAnnotation("@bind(datasource='author', value='selected') @validate({cond1,cond2})")
public String getValue() {

However, for better readability, you can split it into multiple strings. They are equivalent. For example,


@ComponentAnnotation({
 "@bind(datasource='author', value='selected')"
 "@validate({cond1,cond2})"})
public String getValue() {

If the component's Java class doesn't have the getter or setter for the given property, you can specify the annotations at the class level by prefixing the annotation with the property name and a colon. For example,


@ComponentAnnotation({
 "selectedItem: @ZKBIND(ACCESS=both, SAVE_EVENT=onSelect)",
 "openedItem: @ZKBIND(ACCESS=load, LOAD_EVENT=onOpen)")
public class Foo extends AbstractComponent {
    ....
}

Notice, only the public getter and setter methods (i.e., getXxx, setXxx and isXxx) are scanned when loading the component annotations. Thus, if the method doesn't fit, you have to specify at the class level.

Since:
6.0.1
Author:
tomyeh

Required Element Summary
 java.lang.String[] value
           
 

Element Detail

value

public abstract java.lang.String[] value


Copyright © 2005-2011 Potix Corporation. All Rights Reserved. SourceForge.net Logo