Hey Martin,

This sounds like a great idea. One option that came to mind was Apache Giraph 
[1],
but it might be too specific for our needs. I like defining our own interface 
and classes
since we're really doing something small and don't need an extra dependency to 
another
lib.

+1 from me!

Thanks!

Cheers,
Chris

[1] http://giraph.apache.org/

On Oct 20, 2012, at 4:28 AM, Martin Desruisseaux wrote:

> Hello all
> 
> I'm still following the chain of dependencies for getting metadata in... I 
> will need to represent the metadata as a tree. In Geotk, I used the Swing 
> TreeNode interface. Despite being defined in a javax.swing sub-package, this 
> was a truly generic interface usable without any dependency to Swing 
> components. However this have a number of issues:
> 
> * TreeNode uses old API (java.util.Enumeration, DefaultTreeNode use
>   java.util.Vector)
> * They forgot the getUserObject() method (there is a
>   setUserObject(...) in MutableTreeNode interface but no corresponding
>   getUserObject()) and I don't think that Oracle will fix that for
>   compatibility reasons. In Geotk, this situation forced us to
>   redefine all Swing TreeNode interfaces and implementations anyway,
>   extending the Swing type with the addition of the missing
>   getUserObject() method.
> * Using Swing TreeNode interface is cheap up to JDK8, but may not be
>   cheap anymore in a modularized JDK9 since it may force the JVM to
>   load an otherwise unneeded Swing module.
> * Swing is being phased out, to be replaced by JavaFX.
> * The TreeNode interface alone is not sufficient. We actually need
>   (most of the time) a TreeTableNode interface similar to the one
>   defined in SwingLab.
> 
> 
> I'm tempted to abandon the usage of Swing interface. This raise the question 
> about which alternative to use. The JavaFX class (TreeItem) is probably too 
> dedicated to rendering in a JavaFX scene. Consequently I'm tempted to define 
> our own interfaces in a org.apache.sis.util.tree package. The interfaces 
> would be TreeNode and TreeTableNode. The TreeNode methods would be:
> 
> * TreeNode getParent();
> * List<TreeNode> children();
> * Object getUserObject();
> 
> 
> The TreeTableNode interface would have in addition:
> 
> * int getColumnCount()
> * Class<?> getColumnClass(int)
> * Object getValueAt(int)
> * void setValueAt(int, Object)
> * boolean isEditable(int)
> 
> 
> I think this is about everything we need. What do people think?
> 
>    Martin
> 

Reply via email to