You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Glen Stampoultzis <gs...@iinet.net.au> on 2003/11/18 08:47:15 UTC

Re: Getting access to the visit from within the Taco's tree model.

(Non-static) Inner classes have (hidden) references to the enclosing 
class.  I believe this is the cause of the problem.

At 04:14 PM 18/11/2003, you wrote:
>I am sorry, please bear with me, but isn't the model a local class? Are 
>you storing the model in the page?
>
>-Harish
>
>Glen Stampoultzis wrote:
>
>>I traced through this pretty carefully.  What is actually happening is 
>>that the model is holding a reference to an old instance of the page 
>>(because it's an inner class) that is no longer part of the current cycle.
>>The _engine variable gets set and cleared on the attach and detach so old 
>>instances will no longer have any way to refer back to the engine.
>>-- Glen
>>At 03:43 PM 18/11/2003, you wrote:
>>
>>>That doesn't sound right, may be there is another problem, 'cause the 
>>>engine should be attached to the page as soon as it is instantiated or 
>>>retrieved from the pool. The rewind/render happens after the page is loaded.
>>>
>>>-Harish
>>>
>>>Glen Stampoultzis wrote:
>>>
>>>>Yes.  I thought of that one.  Unfortunately is appears that calling 
>>>>getPage() at that point in the render will return a page object that 
>>>>hasn't had the _engine attached which causes an error during the call 
>>>>to getVisit().
>>>>Regards,
>>>>Glen
>>>>
>>>>At 02:38 PM 18/11/2003, you wrote:
>>>>
>>>>>How are you specifying the model for your tree?  Can you define it as 
>>>>>a nested or anonymous class from within your component/page?
>>>>>Something like this?
>>>>>
>>>>>public class MyComponent extends BaseComponent
>>>>>{
>>>>>    public ITreeDataModel getTreeDataModel()
>>>>>    {
>>>>>        return new ITreeDataModel()
>>>>>        {
>>>>>            private MyVisit visit = (MyVisit) 
>>>>> MyComponent.this.getPage().getVisit();
>>>>>
>>>>>            // Insert tree model implementation here...
>>>>>        };
>>>>>    }
>>>>>}
>>>>>
>>>>>Paul Ferraro
>>>>>
>>>>>Glen Stampoultzis wrote:
>>>>>
>>>>>>
>>>>>>I'm using taco-tree at the moment and I'm struggling with one issue 
>>>>>>regarding accessing the visit object from within the tree.
>>>>>>
>>>>>>I would like to know if this is possible?  From what I can see the 
>>>>>>visit is being passed correctly all the way up during the rendering 
>>>>>>stage but it doesn't get passed on to the model at all.  I assume 
>>>>>>this is a problem with other components that have models also?
>>>>>>
>>>>>>Regards,
>>>>>>
>>>>>>
>>>>>>Glen Stampoultzis
>>>>>>gstamp@iinet.net.au
>>>>>>http://members.iinet.net.au/~gstamp/glen/
>>>>>>
>>>>>>
>>>>>>---------------------------------------------------------------------
>>>>>>To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>>>>>>For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>---------------------------------------------------------------------
>>>>>To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>>>>>For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>>>>
>>>>
>>>>Glen Stampoultzis
>>>>gstamp@iinet.net.au
>>>>http://members.iinet.net.au/~gstamp/glen/
>>>
>>>
>>>
>>>---------------------------------------------------------------------
>>>To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>>>For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>>
>>Glen Stampoultzis
>>gstamp@iinet.net.au
>>http://members.iinet.net.au/~gstamp/glen/
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>


Glen Stampoultzis
gstamp@iinet.net.au
http://members.iinet.net.au/~gstamp/glen/