Annotate Component Definitions"
From Documentation
(Created page with '{{ZKDevelopersReferencePageHeader}} In additions to annotating a component or its properties, you could annotate a component definition, such that all its instances will have th…') |
m (remove empty version history (via JWB)) |
||
(6 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
{{ZKDevelopersReferencePageHeader}} | {{ZKDevelopersReferencePageHeader}} | ||
− | In | + | In addition to annotating a component or its properties, you could annotate a component definition, such that all its instances will have the annotations. |
− | To annotate a component definition, you have to specify the annotations in [[ZK | + | To annotate a component definition, you have to specify the annotations in [[ZK Client-side Reference/Language Definition|a language definition]]. For example, we could extend the definition of bandbox to add annotations. Please refer to [[ZK Component Reference/Annotation/Data Binding]] for detail. |
<source lang="xml"> | <source lang="xml"> | ||
Line 10: | Line 10: | ||
<extends>bandbox</extends> | <extends>bandbox</extends> | ||
<annotation> | <annotation> | ||
− | <annotation-name> | + | <annotation-name>ZKBIND</annotation-name> |
<property-name>value</property-name> | <property-name>value</property-name> | ||
<attribute> | <attribute> | ||
− | <attribute-name> | + | <attribute-name>ACCESS</attribute-name> |
<attribute-value>both</attribute-value> | <attribute-value>both</attribute-value> | ||
</attribute> | </attribute> | ||
<attribute> | <attribute> | ||
− | <attribute-name> | + | <attribute-name>SAVE_EVENT</attribute-name> |
− | <attribute-value> | + | <attribute-value>onChange</attribute-value> |
+ | </attribute> | ||
+ | <attribute> | ||
+ | <attribute-name>LOAD_REPLACEMENT</attribute-name> | ||
+ | <attribute-value>rawValue</attribute-value> | ||
+ | </attribute> | ||
+ | <attribute> | ||
+ | <attribute-name>LOAD_TYPE</attribute-name> | ||
+ | <attribute-value>java.lang.String</attribute-value> | ||
</attribute> | </attribute> | ||
</annotation> | </annotation> | ||
+ | <annotation> | ||
+ | <annotation-name>ZKBIND</annotation-name> | ||
+ | <property-name>open</property-name> | ||
+ | <attribute> | ||
+ | <attribute-name>ACCESS</attribute-name> | ||
+ | <attribute-value>both</attribute-value> | ||
+ | </attribute> | ||
+ | <attribute> | ||
+ | <attribute-name>SAVE_EVENT</attribute-name> | ||
+ | <attribute-value>onOpen</attribute-value> | ||
+ | </attribute> | ||
+ | </annotation> | ||
</component> | </component> | ||
</source> | </source> | ||
− | + | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
{{ZKDevelopersReferencePageFooter}} | {{ZKDevelopersReferencePageFooter}} |
Latest revision as of 04:32, 5 February 2024
In addition to annotating a component or its properties, you could annotate a component definition, such that all its instances will have the annotations.
To annotate a component definition, you have to specify the annotations in a language definition. For example, we could extend the definition of bandbox to add annotations. Please refer to ZK Component Reference/Annotation/Data Binding for detail.
<component>
<component-name>bandbox</component-name>
<extends>bandbox</extends>
<annotation>
<annotation-name>ZKBIND</annotation-name>
<property-name>value</property-name>
<attribute>
<attribute-name>ACCESS</attribute-name>
<attribute-value>both</attribute-value>
</attribute>
<attribute>
<attribute-name>SAVE_EVENT</attribute-name>
<attribute-value>onChange</attribute-value>
</attribute>
<attribute>
<attribute-name>LOAD_REPLACEMENT</attribute-name>
<attribute-value>rawValue</attribute-value>
</attribute>
<attribute>
<attribute-name>LOAD_TYPE</attribute-name>
<attribute-value>java.lang.String</attribute-value>
</attribute>
</annotation>
<annotation>
<annotation-name>ZKBIND</annotation-name>
<property-name>open</property-name>
<attribute>
<attribute-name>ACCESS</attribute-name>
<attribute-value>both</attribute-value>
</attribute>
<attribute>
<attribute-name>SAVE_EVENT</attribute-name>
<attribute-value>onOpen</attribute-value>
</attribute>
</annotation>
</component>