-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Tabpanel tp = new Tabpanel(); tp.appendChild(Executions.createComponents(newTabFile, null, null)); // here is error mainTabbox.getTabpanels().appendChild(tp);
03.02.2010 18:45:42 org.zkoss.zk.ui.impl.UiEngineImpl handleError:1114 SEVERE: >>java.lang.NullPointerException >> at org.zkoss.zk.scripting.bsh.BSHInterpreter.prepareDetachedNS(BSHInterpreter.java:316) >> at org.zkoss.zk.scripting.bsh.BSHInterpreter.access$1200(BSHInterpreter.java:89) >> at org.zkoss.zk.scripting.bsh.BSHInterpreter$NSCListener.parentChanged(BSHInterpreter.java:522) >> at org.zkoss.zk.ui.impl.ScopeListeners.notifyParentChanged(ScopeListeners.java:108) >> at org.zkoss.zk.ui.impl.SimpleScope.notifyParentChanged(SimpleScope.java:107) >> at org.zkoss.zk.ui.AbstractComponent.setParent(AbstractComponent.java:1034) >> at org.zkoss.zk.ui.AbstractComponent.insertBefore(AbstractComponent.java:1155) >> at org.zkoss.zk.ui.AbstractComponent.appendChild(AbstractComponent.java:1213) >> at com.core.explorer.MainLayoutComposer.selectActiveTab(MainLayoutComposer.java:140) >>...
For a workaround, Can you try to modify
tp.appendChild(Executions.createComponents(newTabFile, null, null))
to
(Executions.createComponents(newTabFile, tp, null)) ???
This should be a bug. Please post to bug and let us track it.
Unless spec has said root element can't be appended as child afterward, I didn't see any of this.
Hi
I have tested similar code on ZK 5.0.1, and it's working, maybe you could try to update.
<zk> <button label="Create Tabpanel"> <attribute name="onClick"><![CDATA[ Tabpanel tp = new Tabpanel(); tp.appendChild(Executions.createComponents("hello.zul", null, null)); tabpanels.appendChild(tp); ]]> </attribute> </button> <tabbox width="500px"> <tabs> <tab label="tab1" /> </tabs> <tabpanels id="tabpanels"> </tabpanels> </tabbox> </zk>
if the exception still happened, could you provide more detail about the executing situation?
Thanks PeterKuo,
This solution work perfectly (or I couldn't catch it), otherwise it's create new component and couldn't append it :(
What I should do to post a bug?
samchuang,
I do it in java class (not in zul code) which is controller.
ZUL: <borderlayout id="main" apply="com.core.explorer.MainLayoutComposer"> JAVA: public class MainLayoutComposer extends GenericForwardComposer implements ComposerExt
A little bit later i check it with last freshly build.
@PeterKuo
It's work perfectly, but with small bug, it's didn't bind data to combobox, I think there is a problem, when it's try to bind data to component.
Executions.createComponents(newTabFile, tp, null); // didn't bind data. Tabpanel tp = new Tabpanel(); tp.appendChild(Executions.createComponents(newTabFile, null, null)); // Bind data
I've create bug. But if need a little bit more information, pls, write me email ;)
Link to bug. P.S. Read comments!
Hi
the bug is there. thanks for your test~~
maybe you have some special behavior that will cause the problem. because, in my zul test, it also use Java and the same code in your java
Tabpanel tp = new Tabpanel();
tp.appendChild(Executions.createComponents("hello.zul", null, null));
tabpanels.appendChild(tp);
Asked: 2010-02-03 11:06:55 +0800
Seen: 883 times
Last updated: Feb 09 '10