Hi, I have the question about correctness of Component#setDefaultModel (Component#setModelImpl) method behavior. I expect that the flag FLAG_INHERITABLE_MODEL should be checked there and turned off if the provided model is not a IComponentInheritedModel.
Let check the next code: public MyPanel(String id) { super(id); ... form.setModel(new CompoundPropertyModel(this)); DropDownChoice ddc = new DropDownChoice("variant", Arrays.ofList(...)) { // p1 @Override protected void onInitialize() { super.onInitialize(); setModel(new DefaultingWrapModel(getModel(), Model.of("default value")); // p2 } }; ddc.setNullValid(false); ddc.setRequired(true); form.add(ddc); ... } In the (p1) the DDC will initialize with CompoundPropertyModel and the FLAG_INHERITABLE_MODEL will be turned on soon by the first invocation of FormComponent#getModel(). In the (p2) we wrap the DDC model with the model which provide the default value (DefaultingWrapModel implements IWrapModel). So we change the model, but the FLAG_INHERITABLE_MODEL is still turned on. On the Component#detach() event, the method Component#setModelImpl(null) will be invoked for the ddc and the DefaultingWrapModel instance will be lost // reset the model to null when the current model is a IWrapModel and // the model that created it/wrapped in it is a IComponentInheritedModel // The model will be created next time. if (getFlag(FLAG_INHERITABLE_MODEL)) { setModelImpl(null); setFlag(FLAG_INHERITABLE_MODEL, false); } I think that such behavior is unexpected. Am I right :) ? Thanks -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/1-4-15-FLAG-INHERITABLE-MODEL-and-default-model-change-tp3252093p3252093.html Sent from the Users forum mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org