Richard, This is how wrapped models work by design. They need to know the component they are assigned to to be able to find the resource bundle. And the owning component needs to know its parent to be able to look in all resource locators (component, package, application, ...).
It is the same with components which want to work with their markup - they need to be either component-with-associated-markup, like Page or Panel, or they need to know their parent-with-associated-markup to be able to find the piece in markup which is for this component. It may look to you that it is wrong/inconsistent/... but actually this is by design. I hope it is clearer now. On Sun, Jan 9, 2011 at 3:01 AM, richard emberson <richard.ember...@gmail.com > wrote: > > > On 01/08/2011 05:16 PM, Jeremy Thomerson wrote: > >> Not all that amazing. This is happening*during construction* which >> always >> leaves objects in fragile states. It's assumed that you can't start >> monkeying around with an object's state until construction is completed >> (and >> not expect side effects). >> > > From the ResourceModelTest.java > > IModel model = new ResourceModel("test.label"); > > Model is constructed. > Can you call model.getObject() yet? No. > > Label l = new Label("testlabel", model); > > Component containing Model is constructed. > Can you call model.getObject() yet? No. > > add(l); > > Parent Component containing Component which contains > the Model is constructed. > Can you call model.getObject() yet? Finally, Yes. > > If the advice to a user is to not print any debugging information about > any state until the application is completely constructed, then, that, > in generally, really would be amazing. > I think ResourceModel is a special case that depends upon being is > a fully constructed Component tree. Just as a Model which communicates > with a DB can not be interrogated until its connected to the DB. > > As an addition, if such pieces that require some level of supporting > infrastructure prior to interrogation had comments warning the > user that they needed special care, most users would not remember > such admonishments while adding general debugging statements > (especially, if > the object in question (a Model) was one of a number of such types > of objects (Models) where most of the types are safe under examination.) > > > > Richard > -- > Quis custodiet ipsos custodes >