treemodel

example/tutorial for using TreeModel+AbstractTreeModel?

I have a database containing a hierarchy that I want to display within a JTree. Is there a good example/tutorial for TreeModel and/or AbstractTreeModel that explains how to implement a custom treemodel? I'm going through a lot of head-scratching and can't seem to find some code out there which is a good starting point. edit: I did find...

questions on "virtual trees" (custom TreeModel) in Swing

OK, I couldn't really find a decent example for a custom TreeModel in Swing that uses more than the basic features, so I wrote my own (code follows below) so I can ask questions about it, rather than about a more complicated application that's the one I really want to write when I understand how to write it. Apologies for the fact that t...

How do I read or write GTK TreeStores from/to files?

Hi! I'm new to this. How do I store a TreeStore to a file? I can store specific values from the underlaying TreeStore through the TreeModel interface, but is there any way of "grabbing" the whole underlaying TreeStore as a value, or do I have to traverse the TreeStore, storing a row at a time? /J ...

How can I show a flat representation of a TreeStore in a TreeView?

Hi! I have a TreeStore with objects that I view and manipulate through a GTK TreeView/TreeModel setup. I also have a TreeView showing a treeModelSort of the treeStore, which I use for sorting on columns like name and date. The problem is, that the sort mechanism only sorts the rootnodes, even if a underlaying childnode has e.g. a date...

TreeModel backed by Lists

I want to build a TreeModel from some Lists that contain the source data. Now, there's an utility class called DynamicUtilTreeNode that can be used to build trees from arrays, Vectors and Hashtables, but... not from Lists?! Of course I could use the List's toArray() method, but it gives a clone array of the List's state at the moment, so...

Java: How to display an XML file in a JTree

Hi, I would like to have a way to display the contents of an XML file in a JTree. I have already accomplished this using DOM, by implementing a custom TreeModel (and TreeCellRenderer). However it is very clunky (much workaround-ery and hackery) and rather rough around the edges. Is anyone aware of a way to get a JTree to display the co...

Java Swing: how do I define how a JTree displays the "user object"?

Hello, everyone! When using a JTree, a "user object" of a DefaultMutableTreeNode can be set. This can be of any kind, but to display it, its toString() value is used. This is not what I need. How can I change the way a user object is displayed? NOTE: My user object has to be something different than a String to be able to maintain map...

Creating a complex tree model in Qt

I'm writing an IRC Client (yes another one). Long story short. I'm writing a Server dialogue that keeps a list of this: Identity Networks Channels Addresses I have 3 different list views that will be for the Networks, Channels and Addresses. When the user changes the Identity (combo box). The network listview will...

store state/expanded nodes of a jtree for restoring state

Hi, I am working with JTree. I would like to know what is best the way to know which nodes are expanded in a JTree, so as to save its state (i.e. save all expanded paths). So that if I call model.reload() the Jtree would not stay collapsed, but I will be able to restore its original state to the user. I.e. all expanded nodes will be ex...

How to fill Gtk::TreeModelColumn with a large dataset without locking up the application

Hello, I need to fill in a large (maybe not so much - several thousands of entries) dataset to a Gtk::TreeModelColumn. How do I do that without locking up the application. Is it safe to put the processing into separate thread? What parts of the application do I have to protect with a lock then? Is it only the Gtk::TreemodelColumn class,...