I am novice in ZK.
I use very old zk framework version(legacy project).
I render zk page so:
Executions.createComponents("/myZul.zul", null, null))
I need to pass parameter to zul. And if parameter is true I need render checkbox and otherwise - not on myZul.zul
I need something like this on zul:
if(parameter){
<checkbox id="my_id" label="my checkbox" />
}
UPDATE my zul:
<window xmlns="http://www.zkoss.org/2005/zul"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:h="http://www.w3.org/1999/xhtml"
xmlns:zk="http://www.zkoss.org/2005/zk"
xmlns:ca="http://www.zkoss.org/2005/zk/client"
xsi:schemaLocation="http://www.zkoss.org/2005/zul http://www.zkoss.org/2005/zul/zul.xsd "
border="normal"
closable="false"
position="center,center"
width="383px"
height="270px"
onCancel="self.detach();"
id="decisionCommentWindow"
title="${c:l('approvalTaskWindow.title')}"
use="handlers.ZulHandler">
....
I need override method doAfterCompose
inside of ZulHandler?
One more time:
zul:
<window xmlns="http://www.zkoss.org/2005/zul"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:h="http://www.w3.org/1999/xhtml"
xmlns:zk="http://www.zkoss.org/2005/zk"
xmlns:ca="http://www.zkoss.org/2005/zk/client"
xsi:schemaLocation="http://www.zkoss.org/2005/zul http://www.zkoss.org/2005/zul/zul.xsd "
border="normal"
closable="false"
position="center,center"
width="383px"
height="270px"
onCancel="self.detach();"
id="decisionCommentWindow"
title="${c:l('approvalTaskWindow.title')}"
use="handlers.ZulHandler">
<zk if="${isManufacturingKey}">
<checkbox id="checkbox_id" label="check" />
</zk>
</window>
zul creater:
...
Map args = new HashMap<String, Boolean>();
Boolean isManufacturing = true;
args.put("isManufacturingKey", isManufacturing);
ZulHandler window = Preconditions
.checkNotNull((ZulHandler) Executions.createComponents(
"/decision_comment_window.zul", null, args));
window.setTitle(decisionModel.getName() + " decision");
if (isManufacturing) {
Checkbox checkbox = (Checkbox) Path
.getComponent("/decisionCommentWindow/emergency_change_checkbox_id");
checkbox.setChecked(workflow.getEmergencyChange());//I have Null pointer here because checkbox is null
}
...
java code:
right access in .zul file:
note: I access to parameter using arg accessor
It is working for my ZK version!!!
I created a zul and set arg in main zul. send a parameter and I want to change this parameter. For example:
if I save button cliked and changing ReadOnly true, How to change ReadOnly in main.zul;
Try it:
more info:http://books.zkoss.org/wiki/ZK_Developer%27s_Reference/MVVM/Advanced/Pass_Arguments_to_Include_Component
You can do this :
create this controller :
change your zul from this :
to :
Now you just need to implement the doOk method there. If its a button that just close that window you can do the following in the zul :
edit:
Mine first solution was correct for your problem. You just have the next problem because you work wrong. Your problem is that you want your caller to influence the target. Just give params and let the controller of your target do the work.
It's like a car factory, they say your car can drive up to 200km/hr, but you as controller of the car, do you drive 200 km/hr or when its not specified, can you still drive the car?
You also don't need to make dubbelposts for the same issue. You could make an issue for the nullpointer but the title is almost the same and what's in the post also.
edit:
If you need to set the title => put the title in the args and claim in in your code. otherwise, I edited the controller class so you have your window variable.(or you make yourself a public getter and setter for the window)