<zk xmlns="http://www.zkoss.org/2005/zul"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://www.zkoss.org/2005/zul http://www.zkoss.org/2005/zul/zul.xsd"
      xmlns:a="http://www.zkoss.org/2005/zk/annotation">   
<?page id="simplePage" title="Simple ZK Application using Grid and Annotations "?>
<?init class="org.zkoss.zkplus.databind.AnnotateDataBinderInit" arg0="controller"?>
 
<window id="controller" use="com.ebpm.webdemo.zk.SimpleWindow2" border="normal"
             width="800px" height="500px">
    <caption label="Simple Window Demo"/>        
    <grid>
    <rows>
    <row>* Lastname: <textbox id="lastname" value="@{controller.PersonBean.lastname}" width="300px" constraint="no empty"/></row>
    <row>* Firstname: <textbox id="firstname" value="@{controller.PersonBean.firstname}" width="300px" constraint="no empty"/></row>
    <row> Address: <textbox id="address" value="@{controller.PersonBean.address}" width="300px"/></row>
    <row> Weight: <decimalbox id="weight" value="@{controller.PersonBean.weight}" width="50px" constraint="no negative"/></row>
    <row> Birthdate: <datebox id="birthdate" value="@{controller.PersonBean.birthdate}" format="dd.MM.yyyy"/></row>
      <row spans="2"> 
            <hbox>
                  What is your favorite color?:
                  <combobox id="color" value="@{controller.PersonBean.color}">
                        <comboitem label="Red" description="Red means Red ;-)" value="r1"/>
                        <comboitem label="Green" value="g2"/>
                        <comboitem label="Blue" value="b2"/>
                  </combobox>      
            </hbox>
      </row>
      <row spans="2"> 
            <hbox>
                  <checkbox id="married" checked="@{controller.PersonBean.married}" label="Are you married?"/>
            </hbox>
      </row>
      <row spans="2">
            <groupbox>
                  <caption label="How much do you like yourself?:"/>
                  <radiogroup id="rating" selectedItem="@{controller.PersonBean.rating}">
                        <radio value="1" label="Actually, I hate me."/>
                        <radio value="2" label="Not so much."/>
                        <radio value="3" label="I'm indifferent."/>
                        <radio value="4" label="I'm pretty neat."/>
                        <radio value="5" label="I'm totally in love with me."/>
                  </radiogroup>          
            </groupbox>
      </row>
    </rows>
    </grid>
      <separator/>
      <button id="ok" label="Submit" forward="onOK"/><button label="Cancel" forward="onCancel"/>
      <separator/>
      <grid id="personsGrid" model="@{controller.allPersons}">
            <columns sizable="true">
                  <column label="First Name"/>
                  <column label="Last Name"/>
                  <column label="Address"/>
                  <column label="Weight"/>
                  <column label="Birthdate"/>
                  <column label="Color"/>
                  <column label="Married"/>
                  <column label="Rating"/>
            </columns>
            <rows id="personsGridRows">
                  <row self="@{each=person}">
                        <label value="@{person.firstname}"/>
                        <label value="@{person.lastname}"/>
                        <label value="@{person.address}"/>
                        <label value="@{person.weight}"/>
                        <datebox value="@{person.birthdate}" format="dd.MM.yy" disabled="true" buttonVisible="false"/>
                        <label value="@{person.color}"/>
                        <checkbox checked="@{person.married}" disabled="true"/>
                        <label value="@{person.rating}"/>
                  </row>
            </rows>    
      </grid>
</window>

</zk>