Hi Ulrich, My guess (based on quickly looking at your code on my phone): the DeafultNestedTree probably uses a model to store open/closed state or selected states. Since you don't provide it in the constructor, wicket automatically creates a property model since a parent component has a CompoundPropertyModel.
Check if the DNT has additional constructors which take an IModel<Set<RecursiveData>>. Provide your own model and your problem should be fixed :-) // Bas Verstuurd vanaf mijn iPhone > Op 18 aug. 2017 om 15:37 heeft Knaack, Ulrich > <[email protected]> het volgende geschreven: > > Hi, > > I'm trying to display a DefaultNestedTree (id="dataTreeView") within a > Bootstrap Modal<Service> > > Instances of Service contain an ID that I use for retrieving a recursive data > structure from database. > The recursive structure is realized by instances of "RecursiveData" . > See line 15 and method onModelChanged(). > RecursiveData contains self referencing properties "parent" and "children" > > 00 import com.example.Service > 00 > 01 public class DataViewDialog extends Modal<Service> > 02 { > 03 private static final long serialVersionUID = 7766394608644043929L; > 04 > 05 @SpringBean > 06 private RecursiveDataBean dataBean; > 07 > 08 private RecursiveDataTreeProvider treeProvider; > 09 > 10 public DataViewDialog(String id, IModel<Service> model) > 11 { > 12 super(id, model); > 13 > 14 Service service = model.getObject(); > 15 List<RecursiveData> data = > dataBean.getRootDataByServiceId(service.getServiceId()); > 16 > 17 BootstrapForm<Void> form = new BootstrapForm<>("form"); > 18 add(form); > 19 > 20 treeProvider = new RecursiveDataTreeProvider(data); > 21 > 22 DefaultNestedTree<RecursiveData> tree = > 23 new DefaultNestedTree<RecursiveData>("dataTreeView" > 24 , treeProvider) > 25 { > 26 private static final long serialVersionUID = > -7659715973883984412L; > 27 > 28 @Override > 29 protected Component newContentComponent(String id1 > 30 , IModel<RecursiveData> node) > 31 { > 32 return super.newContentComponent(id1, node); > 33 } > 34 }; > 35 > 36 form.add(tree); > 37 > 38 BootstrapAjaxButton close = new BootstrapAjaxButton("close" > 39 , Model.of("schließen"), Buttons.Type.Primary) > 40 { > 41 private static final long serialVersionUID = > 7877084020329862442L; > 42 > 43 @Override > 44 protected void onSubmit(AjaxRequestTarget target, Form<?> form) > 45 { > 46 super.onSubmit(target, form); > 47 appendCloseDialogJavaScript(target); > 48 } > 49 }; > 50 form.add(close); > 51 } > 52 > 53 @Override > 54 protected void onModelChanged() > 55 { > 56 super.onModelChanged(); > 57 String serviceId = getModel().getObject().getServiceId(); > 58 List<RecursiveData> newDataList = > dataBean.getRootDataByServiceId(serviceId); > 59 treeProvider.setRecursiveData(newDataList); > 60 } > 61 } > > I know from debugging that my implementation of ITreeProvider<RecursiveData> > is working well, > also after execution of "onModelChanged()". > > But when the tree is rendered, this error occurs: > > org.apache.wicket.WicketRuntimeException: Property could not be resolved for > class: class com.example.Service expression: dataTreeView > 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) > > Why does Wicket try to resolve a property that doesn't exist within "Service" > ? > > I've tried a version without a BootstrapForm within the Modal, where > "dataTreeView" is attached to the Modal directly. Same problem. > > Mit freundlichen Grüßen > Ulrich Knaack > > Landesamt für Geoinformation und Landesvermessung Niedersachsen (LGLN) > - Landesvermessung und Geobasisinformation - Landesbetrieb - > Fachgebiet 224 - Geodateninfrastruktur > Podbielskistraße 331, 30659 Hannover > Tel.: +49 511 64609-287 > Fax: +49 511 64609-161 > mailto:[email protected] > www.lgln.niedersachsen.de > > > --------------------------------------------------------------------- > 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]
