-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Hi!
I've found a problem working with ZKEE 6.5.4 related with Toolbar Button's invalidation that don't affects to Toolbarbutton.
The error is "SEVERE [zkoss] [Desktop z_it1:/test.zul] client error: Failed to mount: Cannot read property 'disabled' of undefined"
The error happens after calling "p.getParent().invalidate();" when the panel is minimized. I had to use such invalidation to adjust some other panels in the portal columns space.
One point is that instead of using Button we do use Toolbarbutton, no error happens. My problem is that I prefer the Button style & border to the Toolbarbutton.
Here's a small demo:
test.zul:
<?xml version="1.0" encoding="UTF-8"?>
<?page id="mypage" ?>
<zk>
<window id="mywindow" border="none" apply="test.TestComposer">
<portallayout id="bussinessPortal" maximizedMode="whole" zclass="myportallayout" style="overflow: visible" >
<portalchildren id="ptc1" width="30%" height="100%"/>
<portalchildren id="ptc2" width="70%" height="100%"/>
<portalchildren id="ptc3" width="0%" height="100%" visible="false"/>
</portallayout>
</window>
</zk>
test_portlet.zul:
<?xml version="1.0" encoding="UTF-8"?>
<zk xmlns:h="xhtml" xmlns:zk="zk">
<label>Hello</label>
</zk>
test_portlet2.zul:
<?xml version="1.0" encoding="UTF-8"?>
<zk xmlns:h="xhtml" xmlns:zk="zk">
</zk>
TestComposer.java
public class TestComposer extends GenericForwardComposer {
Window window;
Portallayout bussinessPortal;
Portalchildren ptc1, ptc2, ptc3;
public void doAfterCompose(Component comp) throws Exception {
super.doAfterCompose(comp);
window = (Window)Path.getComponent("//mypage/mywindow");
bussinessPortal = ((Portallayout)comp.getFellow("bussinessPortal"));
ptc1.appendChild(createPanel("Panel 1-1"));
ptc1.appendChild(createPanel("Panel 1-2"));
Panel p =createPanel("Panel 2-1");
Toolbar toolbar=new Toolbar();
toolbar.setId("mytoolbar");
toolbar.setAlign("center");
Button but1=new Button();
but1.setId("mybutton");
but1.setLabel("test button");
but1.setDisabled(false);
toolbar.appendChild(but1);
p.getFellow("Panel 2-1 inc").appendChild(toolbar);
ptc2.appendChild(p);
ptc2.appendChild(createPanel("Panel 2-2"));
ptc2.appendChild(createPanel("Panel 2-3"));
ptc3.appendChild(createPanel("Panel 3-1"));
ptc1.setVisible(true);
ptc2.setVisible(true);
ptc3.setVisible(false);
}
private Panel createPanel(String title) {
Panel p = new Panel();
p.setBorder("normal");
p.setTitle(title);
p.setCollapsible(true);
p.appendChild(new Panelchildren());
p.addEventListener(Events.ON_OPEN, new EventListener() {
@Override
public void onEvent(Event event) throws Exception {
OpenEvent opEvent = (OpenEvent) event;
Panel p=(Panel) opEvent.getTarget();
p.getParent().invalidate();
}
});
Include inc;
if (title.equals("Panel 2-1")) {
inc = new Include("/test7_portlet2.zul");
inc.setId("Panel 2-1 inc");
} else {
inc = new Include("/test7_portlet.zul");
}
inc.setHflex("1");
inc.setVflex("1");
inc.setMode("instant");
inc.afterCompose();
p.getPanelchildren().appendChild(inc);
return p;
}
}
Regards.
Hi cocoes,
This is a ZK bug, I have posted a bug tracker here http://tracker.zkoss.org/browse/ZK-2035
Asked: 2013-11-25 15:43:47 +0800
Seen: 11 times
Last updated: Nov 26 '13