View"

From Documentation
m
 
(2 intermediate revisions by one other user not shown)
Line 3: Line 3:
 
The view is the UI of an application. It totally depends on the application's requirements.
 
The view is the UI of an application. It totally depends on the application's requirements.
  
As described in [[ZK Developer's Reference/MVC/Model|the Model section]], many ZK components could operate based on models, such as <javadoc>org.zkoss.zul.Listbox</javadoc>. There are two approaches to customize the rendering of each item in model: [[ZK Developer's Reference/MVC/View/Template|Template]] and [[ZK Developer's Reference/MVC/View/Renderer|Renderer]].
+
As described in [[ZK Developer's Reference/MVC/Model|MVC/Model]], some ZK components support Model-driven rendering, such as <javadoc>org.zkoss.zul.Listbox</javadoc>. There are two approaches you can customize the rendering of each item in a model:
 +
 
 +
* [[ZK Developer's Reference/MVC/View/Template|Template]]: you define a template which is a fragment of the ZUML document to define how to render each item. It's more readable and easy to use.
 +
 
 +
* [[ZK Developer's Reference/MVC/View/Renderer|Renderer]]: you create a Java class that implements a specific interface to render each item. If you need to render items according to conditions in the runtime, this approach is suggested.
 +
 
  
A template is a fragment of the ZUML document that defines how to render each item in ZUML. On the other hand, a renderer is a Java class that renders each item in Java.
 
  
 
{{ZKDevelopersReferenceHeadingToc}}
 
{{ZKDevelopersReferenceHeadingToc}}

Latest revision as of 02:03, 30 January 2024

The view is the UI of an application. It totally depends on the application's requirements.

As described in MVC/Model, some ZK components support Model-driven rendering, such as Listbox. There are two approaches you can customize the rendering of each item in a model:

  • Template: you define a template which is a fragment of the ZUML document to define how to render each item. It's more readable and easy to use.
  • Renderer: you create a Java class that implements a specific interface to render each item. If you need to render items according to conditions in the runtime, this approach is suggested.







Last Update : 2024/01/30

Copyright © Potix Corporation. This article is licensed under GNU Free Documentation License.