Component Properties"
Line 6: | Line 6: | ||
=Properties= | =Properties= | ||
Depending on the requirement, you could change the initial value of a property for a particular ZUML document, or for the whole application. | Depending on the requirement, you could change the initial value of a property for a particular ZUML document, or for the whole application. | ||
+ | |||
+ | Notice the initial values are applicable only to the component instantiated by ZK Loaders. It has no effect if you instantiate it in pure Java (unless you invoke <javadoc method="applyProperties()" type="interface">org.zkoss.zk.ui.Component</javadoc> after instantiating a component). | ||
+ | |||
==Page-wide Initialization== | ==Page-wide Initialization== | ||
Suppose we want to assign <tt>normal</tt> to the border property (<javadoc method="setBorder(java.lang.String)">org.zkoss.zul.Window</javadoc>) of all windows in a ZUML document, then we could use [[ZUML Reference/ZUML/Processing Instructions/component|the component directive]] as follows. | Suppose we want to assign <tt>normal</tt> to the border property (<javadoc method="setBorder(java.lang.String)">org.zkoss.zul.Window</javadoc>) of all windows in a ZUML document, then we could use [[ZUML Reference/ZUML/Processing Instructions/component|the component directive]] as follows. | ||
Line 43: | Line 46: | ||
=Molds= | =Molds= | ||
=Attributes= | =Attributes= | ||
− | + | Like properties, you could change the initial value of an attribute for a particular ZUML document, or for the whole application. | |
+ | |||
+ | Notice the initial values are applicable only to the component instantiated by ZK Loaders. It has no effect if you instantiate it in pure Java (unless you invoke <javadoc method="applyProperties()" type="interface">org.zkoss.zk.ui.Component</javadoc> after instantiating a component). | ||
==Page-wide Initialization== | ==Page-wide Initialization== | ||
==Application-wid Initialization== | ==Application-wid Initialization== |
Revision as of 03:23, 30 November 2010
With component definitions, we could specify the initial values for the properties, attributes and annotations of a component.
Properties
Depending on the requirement, you could change the initial value of a property for a particular ZUML document, or for the whole application.
Notice the initial values are applicable only to the component instantiated by ZK Loaders. It has no effect if you instantiate it in pure Java (unless you invoke Component.applyProperties() after instantiating a component).
Page-wide Initialization
Suppose we want to assign normal to the border property (Window.setBorder(String)) of all windows in a ZUML document, then we could use the component directive as follows.
<?component name="window" extends="window" border="normal"?>
<window title="Border"/>
Application-wid Initialization
If you prefer to have the same initial value for all ZUML documents, you could specify it in a language addon. For example, we could prepare a file called WEB-INF/lang-addon.xml with the following content:
<language-addon>
<component>
<component-name>window</component-name>
<extends>window</extends>
<property>
<property-name>border</property-name>
<property-value>normal</property-value>
</property>
</component>
</language-addon>
Then, we could specify this file by adding the following content to WEB-INF/zk.xml:
<language-config>
<addon-uri>/WEB-INF/lang-addon.xml</addon-uri>
</language-config>
For more information, please refer to ZK Configuration Reference.
Molds
Attributes
Like properties, you could change the initial value of an attribute for a particular ZUML document, or for the whole application.
Notice the initial values are applicable only to the component instantiated by ZK Loaders. It has no effect if you instantiate it in pure Java (unless you invoke Component.applyProperties() after instantiating a component).
Page-wide Initialization
Application-wid Initialization
Version History
Version | Date | Content |
---|---|---|