23.12.2012 Views

ZK Developer's Guide

ZK Developer's Guide

ZK Developer's Guide

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Extending the Online<br />

Media Library<br />

In the last chapter, we started the implementation of a CRUD application. We<br />

implemented the application with some basics of <strong>ZK</strong> application. Now it's time to<br />

extend and optimize the application from the last chapter.<br />

AJAX—Live Data<br />

There are many discussions around AJAX. Everybody understands different things<br />

if we are talking about richness and responsiveness of an application. However,<br />

one thing everybody would agree is that one feature of a user interface should be<br />

to show actual data. In the start page (index.zul) in Chapter 2, we implemented a<br />

listbox, which shows the media instances from the underlying persistent storage.<br />

The listbox component has a header (realized with the listheader component)<br />

and the content. In addition to the attributes of a media class there is one column<br />

(symbolized with the recycling bin image) to delete a media item. If we click on the<br />

image the media is removed, and with Executions.sendRedirect("index.zul")<br />

the page is reloaded. The following code recapitulates the implementation of<br />

this section.<br />

<br />

<br />

MediaDAO dao = MediaDAOFactory.getDAO();<br />

Collection list = dao.getMedia();<br />

<br />

<br />

<br />

<br />

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!