ZK Check Event Handling Using MVC

image

CheckBoxEvent.zul

<?page title="new page title" contentType="text/html;charset=UTF-8"?>
<zk>
    <window title="new page title" border="normal" apply="mypack.CheckBoxController">
        <checkbox id ="showActive" label="Show only active" />
        <separator />
        <hlayout>
            You have selected :
            <label id="Active" />
        </hlayout>
    </window>
</zk>


CheckBoxController.java



package mypack;
 
import org.zkoss.zk.ui.util.GenericForwardComposer;
import org.zkoss.zk.ui.event.Event;
import org.zkoss.zk.ui.event.InputEvent;
import org.zkoss.zul.Label;
import org.zkoss.zul.Checkbox;
import org.zkoss.zul.Messagebox;
 
public class CheckBoxController extends GenericForwardComposer {
 
    private Label Active;
    private Checkbox showActive;
 
    public void onCheck$showActive(Event event) {
        if (showActive.isChecked() == true)
            Active.setValue("You have selected to show Only Active ");
        else
            Active.setValue("You have selected to show All");
        
    }
}