Re: [java-gnome-hackers] More thougths about TreeView and related
Brought to you by:
afcowie
|
From: Andrew C. <an...@op...> - 2008-03-24 06:02:02
|
On Sun, 2008-03-16 at 18:27 -0300, Vreixo Formoso Lopes wrote:
> 1. It would be much better to have a protected method and let its
> subclasses (ListStore, TreeStore...) overwrite it
Approved (as already discussed)
> 2. A problem of the TreeModel as abstract class design
> is that it allows users to call setValue() on
> TreeModels that do not have such method, for example
> TreeModelFilter, of course getting the
> UnsupportedOperationException. I wonder, however,
> whether we could implement dispatch() in such models.
> For example, in TreeModelFilter we could delegate the
> operations in the base model easily. What do you think
> about this?
Sounds like a good idea. Make sure you [unit] test the hell out of it
though - the relationship between those pseudo TreeModels and their
underlying ("child?!?") model is tricky.
You can add tests to ValidateTreeModel or a new class as you see fit.
> 3. I've noticed TreeSortable interface is still not
> implemented. Is it by design, or just missing
> coverage? At a first sight, it seems setSortColumn()
> in TreeViewColumn is enough
I implemented that this week, actually, but it was crashing on me (due
to something else), so that's when I decided to change the error
behaviour. I've already merged my work into the 'treestore' branch you
sent me. I'll publish it in my repo when I get a chance (assuming I
don't finish my part and merge it to 'mainline')
> However, this
> do not allow us to sort elements in a ComboBox, for
> example. And there is a missing feature: the
> gtk_tree_sortable_set_sort_func(), very useful for
> handling non-trivial sort in an easy way.
I always recommend people (and wrote up the docs to this effect) to add
a column to their model that contains the sort ordering and then just
tell the TreeViewColumn to sort based on that column. Quick, easy, and a
hell of a lot less effort than calling back to Java every time.
So it's not something I need personally.
If you really do need it, go ahead. You can use TreeModelFilter's
VISIBLE signal & setVisibleCallback() as a roadmap. The interesting bit
is in GtkTreeModelFilterOverride.c
Kinda sucks that those are on TreeSortable and not just on
TreeModelSort. It will therefore be a pain in the ass to implement
everywhere. I would imagine you have better things to do.
Personally, I'd stick with sorting on a known column via
TreeViewColumn's setSortColumn() or TreeModelSort's setSortColumn().
> 4. DataColumnPixbuf has a bug.
The fix for that you submitted has been merged.
AfC
Vancouver
--
Andrew Frederick Cowie
Operational Dynamics is an operations and engineering consultancy
focusing on IT strategy, organizational architecture, systems
review, and effective procedures for change management. We actively
carry out research and development in these areas on behalf of our
clients, and enable successful use of open source in their mission
critical enterprises, worldwide.
http://www.operationaldynamics.com/
Sydney New York Toronto London
|