Hi,

the tree implementation does what many other Wicket component do too:

If you don't provide a model, it tries to find one in one of its parental components. (Note that the tree uses the model to store the expanded nodes.)

Since you have a CompoundPropertyModel in the page, it will create a PropertyModel for that - but "tree" isn't a valid property.

You can override AbstractTree#initModel() to skip the model lookup:

    protected IModel<?> initModel()
    {
        return newModel();
    }

Hope this helps
Sven


Am 19.12.2017 um 21:10 schrieb Conny Kühne:
Hi,

don't know whether this is a bug so I'll ask here first. In the wicket tree
examples, when I get a WicketRuntimeException in the
org.apache.wicket.examples.tree.BeginnersTreePage when I set a model to the
page as follows:

public BeginnersTreePage()
{
   setDefaultModel(new CompoundPropertyModel<String>("bla")); // <-- this is
the new line
   add(new DefaultNestedTree<Foo>("tree", new FooProvider()) {
   ...

The exception is
Root cause:

org.apache.wicket.WicketRuntimeException: Property could not be resolved for
class: class java.lang.String expression: tree
      at
org.apache.wicket.core.util.lang.PropertyResolver.getGetAndSet(PropertyResolver.java:393)
      at
org.apache.wicket.core.util.lang.PropertyResolver.getObjectWithGetAndSet(PropertyResolver.java:355)
      at
org.apache.wicket.core.util.lang.PropertyResolver.getObjectWithGetAndSet(PropertyResolver.java:261)
      at
org.apache.wicket.core.util.lang.PropertyResolver.getValue(PropertyResolver.java:111)
      at
org.apache.wicket.model.AbstractPropertyModel.getObject(AbstractPropertyModel.java:86)
      at
org.apache.wicket.extensions.markup.html.repeater.tree.AbstractTree.getModelObject(AbstractTree.java:161)
      at
org.apache.wicket.extensions.markup.html.repeater.tree.AbstractTree.getState(AbstractTree.java:240)
      at
org.apache.wicket.extensions.markup.html.repeater.tree.nested.Subtree.isVisible(Subtree.java:136)
      at org.apache.wicket.Component.determineVisibility(Component.java:4456)
      at org.apache.wicket.Component.internalBeforeRender(Component.java:943)
      at org.apache.wicket.Component.beforeRender(Component.java:1018)

--
Sent from: http://apache-wicket.1842946.n4.nabble.com/Users-forum-f1842947.html

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to