0

Error writing 'checked' on type org.zkoss.zul.Checkbox [closed]

asked 2013-05-08 07:15:49 +0800

davout gravatar image davout
1435 3 18

updated 2013-05-08 07:18:12 +0800

I'm getting an error with a MVVM Tree after a UI action to insert a new node.

The error being:

EVERE: >>org.zkoss.zel.ELException: Error writing 'checked' on type org.zkoss.zul.Checkbox

java.lang.IllegalArgumentException at sun.reflect.GeneratedMethodAccessor70.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.zkoss.zel.BeanELResolver.setValue(BeanELResolver.java:171) at org.zkoss.zel.CompositeELResolver.setValue(CompositeELResolver.java:83) at org.zkoss.zel.CompositeELResolver.setValue(CompositeELResolver.java:83) at org.zkoss.xel.zel.XelELResolver.setValue(XelELResolver.java:114) at org.zkoss.bind.xel.zel.BindELResolver.setValue(BindELResolver.java:102) at org.zkoss.zel.impl.parser.AstValue.setValue(AstValue.java:244) at org.zkoss.zel.impl.ValueExpressionImpl.setValue(ValueExpressionImpl.java:256) at org.zkoss.xel.zel.ELXelExpression.setValue(ELXelExpression.java:50) at org.zkoss.bind.impl.BindEvaluatorXImpl.setValue(BindEvaluatorXImpl.java:50) at org.zkoss.bind.impl.LoadPropertyBindingImpl.load(LoadPropertyBindingImpl.java:81) at org.zkoss.bind.impl.BinderImpl.loadOnPropertyChange(BinderImpl.java:312) at org.zkoss.bind.impl.BinderImpl.access$100(BinderImpl.java:95) at org.zkoss.bind.impl.BinderImpl$QueueListener.onEvent(BinderImpl.java:237)

The associated ZUL code is: [code] <tree model="@bind(vm.categories)" vflex="true" checkmark="true" selecteditem="@bind vm.selectedCategory)"> <auxhead> <auxheader colspan="3"> <button label="Add category" onclick="@command('addCategory')"/> <space/> <button label="Delete category" onclick="@command('deleteCategory')" disabled="@load(empty vm.selectedCategory)"/> <space width="15%"/> <button label="Top" onclick="@command('moveCategoryTop')" disabled="@load(empty vm.selectedCategory)"/> <space/> <button label="Up" onclick="@command('moveCategoryUp')" disabled="@load(empty vm.selectedCategory)"/> <space/> <button label="Down" onclick="@command('moveCategoryDown')" disabled="@load(empty vm.selectedCategory)"/> <space/> <button label="Bottom" onclick="@command('moveCategoryBottom')" disabled="@load(empty vm.selectedCategory)"/> <space/> </auxheader> </auxhead> <treecols> <treecol label="Category/criteria hierarchy"/> <treecol label="Type"/> <treecol label="Scorable"/> </treecols> <template name="model" var="c" status="cs"> <treeitem checkable="@load(c.nodeTypeID eq 1)" draggable="@load(c.nodeTypeID eq 2)" droppable="@load(c.nodeTypeID eq 1)" ondrop="@command('onDropCriteria')"> <treerow> <treecell> <textbox value="@bind(c.data.title)" inplace="true" visible="@load(c.nodeTypeID eq 1)"/> <label value="@load(c.data.title)" visible="@load(!(c.nodeTypeID eq 1))"/> </treecell> <treecell label="@load(c.data.nodeTypeTitle)"/> <treecell> <checkbox checked="@bind(c.data.scorable)" visible="@load(c.nodeTypeID eq 1)"/> <label value="@load(c.data.scorable)" visible="@load(c.nodeTypeID eq 2)"/> </treecell>
</treerow> </treeitem> </template> </tree> [/code] The error is run time and occurs on the 'checkbox' tag shown below:

<treecell> <checkbox checked="@bind(c.data.scorable)" visible="@load(c.nodeTypeID eq 1)"/> <label value="@load(c.data.scorable)" visible="@load(c.nodeTypeID eq 2)"/> </treecell>

The tree starts with multiple top level nodes displayed. If I append a new top level node to the bottom of the tree everything works fine. If I insert a new top level node at some point other than the bottom then this error crops up.

Any suggestions?

delete flag offensive retag edit

The question has been closed for the following reason "the question is answered, right answer was accepted" by davout
close date 2013-05-08 20:52:42

Comments

I've fixed this problem by introducing a MVVM converter that intercepts a check for 'null' value coming through from the binding.

davout ( 2013-05-08 20:52:25 +0800 )edit

Question tools

Follow

RSS

Stats

Asked: 2013-05-08 07:15:49 +0800

Seen: 42 times

Last updated: May 08 '13

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More