ZK8 Features for MVC - Shadow Elements - Part 1"

From Documentation
Line 24: Line 24:
 
= Shadow Elements in MVC =
 
= Shadow Elements in MVC =
  
 +
Some of the Shadow Elements '''LINK ME''' are more/less beneficial in MVC than others here a short summary
  
 +
* '''<if>'''
 +
: mainly useful when used with dynamic @load expressions in MVVM
 +
: (in MVC you can attach/detach components directly)
 +
* '''<choose>, <when>, <otherwise>'''
 +
: similar to <if> no real benefit for MVC
 +
* '''<forEach>'''
 +
: very useful see paragraph below
 +
* '''<apply>'''
 +
: helps to compose the UI from fragments (more efficiently than <include>)
  
 +
== Apply ==
 +
 +
 +
 +
==  ForEach ==
 
https://www.zkoss.org/wiki/ZK_Developer's_Reference/MVC/Controller/Wire_Components#Shadow_Selectors
 
https://www.zkoss.org/wiki/ZK_Developer's_Reference/MVC/Controller/Wire_Components#Shadow_Selectors
  

Revision as of 04:41, 23 August 2016

DocumentationSmall Talks2016OctoberZK8 Features for MVC - Shadow Elements - Part 1
ZK8 Features for MVC - Shadow Elements - Part 1

Author
Robert Wenzel, Engineer, Potix Corporation
Date
August 2016
Version
ZK 8.0

WarningTriangle-32x32.png This page is under construction, so we cannot guarantee the accuracy of the content!


Introduction

ZK 8 added several new Features mainly improving Component control when using the MVVM design pattern. The question I sometimes heard since was: (How )can we benefit from these features in our MVC application ?

To answer the question I'll start with the most prominent features which are:

  • shadow elements
  • form proxies

Let's have a look where they can be used in the MVC world.

If you are missing a feature let us know in the comments section below.

Shadow Elements in MVC

Some of the Shadow Elements LINK ME are more/less beneficial in MVC than others here a short summary

  • <if>
mainly useful when used with dynamic @load expressions in MVVM
(in MVC you can attach/detach components directly)
  • <choose>, <when>, <otherwise>
similar to <if> no real benefit for MVC
  • <forEach>
very useful see paragraph below
  • <apply>
helps to compose the UI from fragments (more efficiently than <include>)

Apply

ForEach

https://www.zkoss.org/wiki/ZK_Developer's_Reference/MVC/Controller/Wire_Components#Shadow_Selectors

CollectionTemplate

ZUL Template

Java Based Template

Using ZK8 Form Proxies in MVC

Creating a Simple CRUD Template

Summary

Download

  • The source code for this article can be found on github.

Running the Example

Clone the repository

  git clone [email protected]:zkoss-demo/mvc-shadow.git
  cd mvc-shadow
  git checkout master

The example war file can be built with maven:

   mvn clean package

Execute using jetty:

   mvn jetty:run

Then access the overview page http://localhost:8080/mvc-shadow/


Comments



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