Class CachingTreeContentProvider
- java.lang.Object
-
- com._1c.g5.v8.dt.navigator.providers.CachingTreeContentProvider
-
- All Implemented Interfaces:
IContentProvider
,IStructuredContentProvider
,ITreeContentProvider
public class CachingTreeContentProvider extends Object implements ITreeContentProvider
The implementation ofITreeContentProvider
for caching children ofFilteringTreeContentProvider
.Provides the following features:
- Caches the children for the specific list of
Class
'es. For the specificClass
instance firstly it tries to find its children in cache and if it was successful returns the cached children, otherwise gets children fairly, caches them and returns them.- Caches the all children that were got. It is very useful for the serial calls of methods
hasChildren(Object)
andgetChildren(Object)
.Important notes:
- The cache drops if only the input was changed. If the customer wants to drop the cache without input changes he needs to recreate
CachingTreeContentProvider
.- The cache size isn't limited, so the customers should keep it in mind.
CachingTreeContentProvider
is the lightweight implementation of a caching tree content provider, so it is better to use it for dialogs, and don't use it, for example, in the navigation tools.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
CachingTreeContentProvider.CachingKeyProvider
The caching elements key provider.
-
Constructor Summary
Constructors Constructor Description CachingTreeContentProvider(FilteringTreeContentProvider innerTreeContentProvider, CachingTreeContentProvider.CachingKeyProvider keyProvider)
Construct a new instance with the given inner tree content provider to call it methods and cache children.CachingTreeContentProvider(FilteringTreeContentProvider innerTreeContentProvider, Class<?>... classes)
Construct a new instance with the given inner tree content provider to call it methods and cache children.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
dispose()
Object[]
getChildren(Object parentElement)
Object[]
getElements(Object inputElement)
Object
getParent(Object element)
boolean
hasChildren(Object element)
void
inputChanged(Viewer viewer, Object oldInput, Object newInput)
-
-
-
Constructor Detail
-
CachingTreeContentProvider
public CachingTreeContentProvider(FilteringTreeContentProvider innerTreeContentProvider, Class<?>... classes)
Construct a new instance with the given inner tree content provider to call it methods and cache children. Providedclasses
children will be cached.- Parameters:
innerTreeContentProvider
- the given innerFilteringTreeContentProvider
, can not benull
classes
- the specific list ofClass
'es to cache their children, can not benull
-
CachingTreeContentProvider
public CachingTreeContentProvider(FilteringTreeContentProvider innerTreeContentProvider, CachingTreeContentProvider.CachingKeyProvider keyProvider)
Construct a new instance with the given inner tree content provider to call it methods and cache children. ProvidedkeyProvider
will be used to cache children.- Parameters:
innerTreeContentProvider
- the given innerFilteringTreeContentProvider
, can not benull
keyProvider
- the cache key provider to use to cache children, can not benull
- See Also:
CachingTreeContentProvider.CachingKeyProvider
-
-
Method Detail
-
dispose
public void dispose()
- Specified by:
dispose
in interfaceIContentProvider
-
inputChanged
public void inputChanged(Viewer viewer, Object oldInput, Object newInput)
- Specified by:
inputChanged
in interfaceIContentProvider
-
getElements
public Object[] getElements(Object inputElement)
- Specified by:
getElements
in interfaceIStructuredContentProvider
- Specified by:
getElements
in interfaceITreeContentProvider
-
getChildren
public Object[] getChildren(Object parentElement)
- Specified by:
getChildren
in interfaceITreeContentProvider
-
getParent
public Object getParent(Object element)
- Specified by:
getParent
in interfaceITreeContentProvider
-
hasChildren
public boolean hasChildren(Object element)
- Specified by:
hasChildren
in interfaceITreeContentProvider
-
-