ingoem/scala-swing — pull request #15 by kenbot (2012-01-02 07:57:22+00:00)
Title: Incub

Hi Ingo,
Sorry for my long inactivity this last year -- I've now improved the Tree-view design in a number of respects. TreeDemo contains examples of most of the desired use cases.

1) Internal/External model split. TreeModels are now either External (virtual descriptions of some arbitrary external structure) or Internal (an eagerly-initialised internally stored tree structure copied from some external structure).

2) A way to update, edit, add and remove nodes, for external and internal models. All models have update(), remove(), insertUnder(), insertAfter() and insertBefore() methods.

Using an internal representation gives you these for free, whereas an external model needs them provided with the makeUpdatableWith(), makeInsertableWith() and makeRemovableWith() methods.

3) Tree.Path is now IndexedSeq instead of List.

4) map and filter methods for TreeModels. Currently the ExternalTreeModel has to turn itself into an InternalTreeModel to do a map, which is not very satisfactory.

5) ListView has been integrated into the CellView abstraction. There is unfortunately a minor backwards-compat problem -- the componentFor method in existing subclasses of ListView.Renderer would need to be marked "override". I'm not sure how much of a problem this is, but this is as close as I can get without jettisoning the (IMHO beneficial) CellInfo abstraction.

The ListView integration is in a separate commit to the Tree stuff, so it can be safely left out if you think it's a bit hairy at this stage.

NB
Table hasn't been integrated yet; it can't have a straight renderer method, it needs to be per-row/column. I suspect that RenderableCells and EditableCells will have to be snipped or eliminated to fit Table into the system.