Specify Stubonly for Client-only Components"
(Created page with '{{ZKDevelopersGuidePageHeader}} [since 5.0.4][ZK EE] {{ ZKDevelopersGuidePageFooter}}') |
|||
Line 1: | Line 1: | ||
{{ZKDevelopersGuidePageHeader}} | {{ZKDevelopersGuidePageHeader}} | ||
+ | __TOC__ | ||
+ | |||
+ | = Overview = | ||
[since 5.0.4][ZK EE] | [since 5.0.4][ZK EE] | ||
+ | It is common that the states of some components are not required to maintain at the server. A typical example is that an application might use some components, such as <tt>hbox</tt>, for layout and won't access it again after rendered. To minimize the memory footprint, ZK supports a special property called <tt>stubonly</tt> (<javadoc method="setStubonly(java.lang.String)">org.zkoss.zk.ui.Component</javadoc>). Once specified with <tt>true</tt>, its states won't be maintained at the server (and all states are maintained at the client). For example, | ||
+ | |||
+ | <source lang="xml"> | ||
+ | <hbox stubonly="true"> | ||
+ | </hbox> | ||
+ | </source> | ||
+ | |||
+ | == Values of Stubonly: true, false and inherit == | ||
+ | |||
+ | The default value of the <tt>stubonly</tt> property is <tt>inherit</tt> that is the same as its parent, if any, or <tt>false</tt>, if no parent at all. Thus, if a component's <tt>stubonly</tt> is specified with <tt>true</tt>, all its descendants are stub-only too. For example, only <tt>textbox</tt> is not stub-only in the following example. | ||
+ | |||
+ | <source lang="xml"> | ||
+ | <hbox stubonly="true"> | ||
+ | a stub-only label | ||
+ | <textbox stubonly="false"/> | ||
+ | <listbox> | ||
+ | <listitem label="also stubonly"/> | ||
+ | </listbox> | ||
+ | </hbox> | ||
+ | </source> | ||
+ | |||
+ | = Invalidation and Smart Updates = | ||
+ | |||
+ | = Event Handling = | ||
{{ ZKDevelopersGuidePageFooter}} | {{ ZKDevelopersGuidePageFooter}} |
Revision as of 10:22, 9 August 2010
This documentation is for an older version of ZK. For the latest one, please click here.
Overview
[since 5.0.4][ZK EE]
It is common that the states of some components are not required to maintain at the server. A typical example is that an application might use some components, such as hbox, for layout and won't access it again after rendered. To minimize the memory footprint, ZK supports a special property called stubonly (Component.setStubonly(String)). Once specified with true, its states won't be maintained at the server (and all states are maintained at the client). For example,
<hbox stubonly="true">
</hbox>
Values of Stubonly: true, false and inherit
The default value of the stubonly property is inherit that is the same as its parent, if any, or false, if no parent at all. Thus, if a component's stubonly is specified with true, all its descendants are stub-only too. For example, only textbox is not stub-only in the following example.
<hbox stubonly="true">
a stub-only label
<textbox stubonly="false"/>
<listbox>
<listitem label="also stubonly"/>
</listbox>
</hbox>
Invalidation and Smart Updates
Event Handling