|Re: Lazy Loading in JFace [message #519819 is a reply to message #518463]
||Tue, 09 March 2010 23:06
|| Craig Foote
Registered: July 2009
I'm not sure about the lazy loading but I have used the |
I instanciated one in my content provider and made #getChildren call its
#getChildren. The object passed to its #getChildren must adapt to
IDeferredWorkbenchAdapter so you need to write a factory and adapter. The
manager requests the adapter from the Platform and calls its
#getDeferredChildren. When you declare an 'adapters' extension that
adapts the input object to IDeferredWorkbenchAdapter, code the adapter
such that it gets the children of the adapted object in this method. As
each child is created, add it to the provided 'collector'.
The result of all this is that the ContentProvider#getChildren call to
DeferredTreeContentManager#getChildren will immediately return a
'PendingUpdateAdapter' displaying 'Pending...'. As children are added to
the 'collector', new nodes are added to the tree. When the last is added
and #getDeferredChildren completes, the PendingUpdateAdapter is removed.
The call to #getDeferredChildren is done in a job and the new nodes are
added to the tree in a thread-smart way making the tree interactive-
capable while they're being created. Pretty slick.
This makes me think that 'lazy' implies child nodes are created and
rendered as needed but 'deferred' in multi-threaded. Just a guess though.
On Thu, 04 Mar 2010 03:24:57 -0500, Aravindhan.A wrote:
> In JFace tree viewer, the get Children() method is called only on the
> click of the parent node... which in turn fetches the data...
> I thought this is a kind of lazy loading.... because setInput() doesn't
> fetch the whole data and, only when you expand your tree nodes it
> fetches the needed data either locally or from a db call.
> Recently, i came across this class DeferredTreeContentManager.... and
> now i see arguments on Deferred Loading Vs Lazy Loading...
> r is it tht lazy loading is achieved thro the implementation of this
> DeferredTreeContentManager class...???
> Need some info on this... whr do i find a snippet on
> Regards, Aravind
Powered by FUDForum
. Page generated in 0.02863 seconds