Opened 9 years ago

Closed 8 years ago

#22 closed enhancement (fixed)

tree nodes for layer management

Reported by: ahocevar Owned by:
Priority: major Milestone: 0.5
Component: GeoExt.tree Version:
Keywords: Cc:
State: Commit

Description

The attached patch provides several node types for dealing with layers in a tree:

  • TriStateCheckboxNode: a node with a third checkbox state, which indicates if none, some or all of its children are checked
  • LayerNode: a node representing a layer
  • LayerContainer: a node populating ifself with the layers from the provided layer store
  • BaseLayerContainer: same as above, but only with base layers
  • OverlayLayerContainer: same as above, but only for overlays
  • LayerParamsNode: a node representing arrays of layer params (e.g. of OpenLayers.Layer.WMS). Can be used for layer grouping or for adding CQL filters.

The patch also contains an example where users can play around with the layer configuration.

Attachments (6)

treenodes.patch (41.3 KB) - added by ahocevar 9 years ago.
treenodes.2.patch (42.7 KB) - added by ahocevar 9 years ago.
updated to work with trunk
22.patch (42.7 KB) - added by tschaub 8 years ago.
updates to respect layer order
treenodes.3.patch (42.7 KB) - added by dwins 8 years ago.
treenodes.4.patch (38.9 KB) - added by ahocevar 8 years ago.
LayerNode, LayerContainer, BaseLayerContainer and OverlayLayerContainer with tests and example
22.2.patch (37.2 KB) - added by tschaub 8 years ago.
trivially tweaked patch

Download all attachments as: .zip

Change History (25)

Changed 9 years ago by ahocevar

comment:1 Changed 9 years ago by ahocevar

treenodes.patch depends on the latest patch for #4

comment:2 Changed 9 years ago by ahocevar

  • State changed from Review to Needs more work

It should also be noted that there is still room for improvements, especially the following three:

  • The containers should not load nodes in the render method, but should use a custom loader to do that.
  • The code for finding layers by their name once they become available should be moved from the layer node to the layer store.
  • I was unable to find a way to make TristateCheckboxNode to inherit from Ext.tree.TreeNode instead of Ext.tree.AsyncTreeNode without taking the functionality to load children specified in the tree configuration. So it may be better to move the tristate functionality from the node into the ui, which could then be used by either an AsyncTreeNode or a plain TreeNode.

comment:3 Changed 9 years ago by ahocevar

  • State changed from Needs more work to Review

The above notes shouldn't keep us from using these nodes, they are just a reminder that things can be improved. Moving these notes to a separate ticket and marking this ticket for review.

comment:4 Changed 9 years ago by ahocevar

Dependant ticket #24 created. Note that these refactorings won't have any impact on the API of the nodes.

Changed 9 years ago by ahocevar

updated to work with trunk

comment:5 Changed 9 years ago by ahocevar

  • State changed from Review to Needs more work

comment:6 Changed 9 years ago by ahocevar

  • Component changed from widgets.MapPanel to widgets.tree

comment:7 Changed 9 years ago by ahocevar

(In [262]) updated to treenodes.2.patch, but only TristateCheckboxNode, LayerNode and LayerContainer (see #22)

comment:8 Changed 8 years ago by tschaub

(In [333]) Adding some docs for layerStore config property (see #22).

comment:9 Changed 8 years ago by tschaub

(In [335]) Adding a layer tree example (see #22 - requires wms cap reader)

comment:10 Changed 8 years ago by tschaub

Would be good for addLayerNode to take an index. And the index should be the child index for the node (not the record index in the store).

I'd also expect the first record in a layer store (bottom of draw order) to be at the bottom of the tree.

comment:11 Changed 8 years ago by tschaub

(In [336]) Respect layer order when adding to the container. (see #22)

Changed 8 years ago by tschaub

updates to respect layer order

Changed 8 years ago by dwins

comment:12 Changed 8 years ago by dwins

I found and fixed a bug with double-clicking; the LayerNode didn't support calling toggleCheck() with no arguments as expected by Ext.

comment:13 Changed 8 years ago by dwins

(In [402]) Fixed bug with double-click handling on layertree, see #22

comment:14 Changed 8 years ago by ahocevar

  • State changed from Needs more work to Review

comment:15 Changed 8 years ago by ahocevar

  • Owner set to ahocevar
  • State changed from Review to Needs more work

New patch with more tests and an example that follows our example coding style is in preparation, will upload tomorrow morning.

Changed 8 years ago by ahocevar

LayerNode, LayerContainer, BaseLayerContainer and OverlayLayerContainer with tests and example

comment:16 Changed 8 years ago by ahocevar

  • Owner ahocevar deleted
  • State changed from Needs more work to Review

The above patch does not contain the LayerParamsNode, but has verbose tests and should be a solid base for further improvements beyond milestone 0.1.

Tests pass in FF3 and IE7. Please review.

comment:17 Changed 8 years ago by ahocevar

Forgot to mention that the latest patch also does not contain the TristateCheckboxNode. BTW, the reason for the reduced feature set of the latest patch is that some advanced features from previous patches have not been discussed/tested enough.

Changed 8 years ago by tschaub

trivially tweaked patch

comment:18 Changed 8 years ago by tschaub

  • State changed from Review to Commit

Looks good Andreas. Thanks for the work on this. Only change in my patch was to use CacheFly in the example (see #61).

Please commit.

comment:19 Changed 8 years ago by ahocevar

  • Resolution set to fixed
  • Status changed from new to closed

(In [808]) added tree nodes and containers. r=tschaub (closes #22)

Note: See TracTickets for help on using tickets.