Presentation Patterns In ZK

Introduction

Overview

Why Patterns? Evolving Software

Why Patterns? A Challenge!

Programming In The View

<label id=”hiddenBookId” value=”${book.id}” visible=”false”/> <button label=”Buy Book”> <attribute name=”onClick”><![CDATA[ MyDao myDao = … ; // get dao via jndi myDao.buyBook(user.id, hiddenBookId.value); statusLabel.value = ”Thanks! Buy another book?”; ]]></attribute> </button> <label id=”statusLabel” value=””/>

Avoid Coding In The View

The Triumvirate

Micro vs. Macro

The View

View Best Practices

View Has Micro Models

ZK Micro-Model == View

The Business Domain (Macro) Model

Model Best Practices

The Other Bit...

Alphabet Soup

MVC Has Many Interpretations

Controller Of What?

The Controller Revisited

Model-View-ZKComposer

Model-View-Presenter

Model-View-Presenter

Model-View-Controller

Enter The Binder

Controller Best Practices

Model-View-ViewModel

ViewModel Nirvāna

Model-View-Binder

Model-View-Binder (Simplified)

Model-View-ZKBind

<listcell label="@load(reminder.name)"/> <button label="Save" onClick="@command('save')"/> @NotifyChange({"reminders","selectedReminder"}) public void save() { … }

MVB/MVVM Best Practices

ViewModel Choices

Summary

Summary (Cont 1)

Summary (Cont 2)

References

Corrections