Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[udig-devel] notes on map item provider work (for legend view)

Naz and I have both had a go at sorting out how MapItemProvider is handled.

RFC Page: http://udig.refractions.net/confluence/display/UDIG/Legend+View

History: MapItemProvider is responsible for listing the "children" when displaying the map in a tree view (such as in the project view or  layers view). This generated implementation has been hacked up to have a custom toString(), only list layers (rather than viewport model etc…) and and to load the children in a lazy fashion using a background Job.

Jody:
1) Backed up the hacked MapItemProvider as LazyMapLayerProvider
2) Made MapItemProviderDecorator wrap around a normal generated MapItemProvider.

Naz:
1) Backuped up the hacked MapItemProvider and called it MapItemLayerOld
2) Regenerated the MapItemProvider from scratch (yay!)
3) Created a LazyMapLayerItemProvider as a subclass of AbstractLazyLoadingItemProvider; has a generated MapItemProvider as a delegate. This was wrapped around the germinated MapItemProvider in order to lazily load Layers and only list layers as as the children. Hooked this up to LayerView - and it all worked!
4) Created a second one MapLegendItemProvider subclass AbstractLazyLoadingItemProvider as above but listing LegendItems.

Notes:
- ProjectsView has a custom MapItemProvider that does not list any children.
- The custom getText( element ) will display only the Layer name (rather than the default which lists the object type)
- Original hacked MapITemProvider internally had a descriptor for the Viewport model - we are ignoring that for now

Plan:
1) We are going to try and put these bits of work together and see where it gets us :-)
2) We will use the name LazyMapLayerProvider for LayersView (rather than the name MapItemLayerOld) mostly because we still intend for it to be used
3) We will create a MapNoItemProvider that does not return *any* children - to be used as the "default" used by the ProjectItemProviderAdaptorFactory for things like the Projects view - this will ensure we don't accidentally load the layers (unless the developer is explicitly using some of the implementations that uses lazy loading)
4) We will merge in LegendView code (update the DnD code to use legend Items) and hook it into MapLegendItemProvider allowing it to list legend items. We expect some work is needed on the generated LayerLegendItem provider getText() and getIcon() methods.
5) Review docs and submit pull request

-- 
Jody Garnett


Back to the top