Adds a basic list of Departments

parent efcbf97f
package dgpena.siexample.webapp;
import java.util.List;
import javax.persistence.EntityManager;
import org.zkoss.bind.annotation.Init;
import dgpena.siexample.persistence.Department;
import dgpena.siexample.persistence.Departments;
public class DepartmentsVM {
private EntityManager em;
private Departments departments;
@Init
public void init() {
this.em = DesktopEntityManagerManager.getDesktopEntityManager();
this.departments = new Departments(em);
}
public List<Department> getDepartments() {
return this.departments.findAll();
}
}
<zk>
<window title="Hello World" border="normal"
apply="org.zkoss.bind.BindComposer"
viewModel="@id('vm') @init('dgpena.siexample.webapp.DepartmentsVM')"
>
<listbox model="@bind(vm.departments)">
<listhead>
<listheader label="name"></listheader>
<listheader label="actions"></listheader>
</listhead>
<template name="model">
<listitem>
<listcell><label value="@bind(each.name)"></label></listcell>
<listcell>work in progress</listcell>
</listitem>
</template>
</listbox>
</window>
</zk>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment