/**
* Called when a null model is about to be retrieved in order to allow a subclass to provide an
* initial model.
* <p>
* By default this implementation looks components in the parent chain owning a
* {@link IComponentInheritedModel} to provide a model for this component via
* {@link IComponentInheritedModel#wrapOnInheritance(Component)}.
* <p>
* For example a {@link FormComponent} has the opportunity to instantiate a model on the fly
* using its {@code id} and the containing {@link Form}'s model, if the form holds a
* {@link CompoundPropertyModel}.
*
* @return The model
*/
protected IModel<?> initModel()
{
IModel<?> foundModel = null;
// Search parents for IComponentInheritedModel (i.e. CompoundPropertyModel)
for (Component current = getParent(); current != null; current = current.getParent())
{
// Get model
// Don't call the getModel() that could initialize many in between
// completely useless models.
// IModel model = current.getDefaultModel();
IModel<?> model = current.getModelImpl();
if (model instanceof IWrapModel && !(model instanceof IComponentInheritedModel))
{
model = ((IWrapModel<?>)model).getWrappedModel();
}
if (model instanceof IComponentInheritedModel)
{
// return the shared inherited
foundModel = ((IComponentInheritedModel<?>)model).wrapOnInheritance(this);
setFlag(FLAG_INHERITABLE_MODEL, true);
break;
}
}
// No model for this component!
return foundModel;
}
Welcome to the world of evidence! Evidence-based teaching is effective teaching, and we bring you the most effective methods. Read on to find out more.
R. Miller, Y. Ioannidis, and R. Ramakrishnan. VLDB '93: Proceedings of the 19th International Conference on Very Large Data Bases, page 120--133. San Francisco, CA, USA, Morgan Kaufmann Publishers Inc., (1993)
C. Britton, S. Jones, M. Kutar, M. Loomes, and B. Robinson. First International Conference on Theory and Application of Diagrams, page 376--391. Edinburgh, Scotland, UK, Springer Berlin, (September 2000)
M. Frank, A. Agarwal, and M. Vernon. Proceedings of the Sixth ACM SIGPLAN Symposium on Principles &
Practice of Parallel Programming, June 18--21, 1997, ACM, (1997)
O. Corby, R. Dieng, and C. Hébert. Conceptual Structures: Logical, Linguistic, and Computational
Issues, 8th International Conference on Conceptual Structures,
ICCS 2000, Darmstadt, Germany, August 14-18, 2000, Proceedings, volume 1867 of LNCS, page 468--482. Springer, (2000)