>Deriving my tree nodes from java.lang.Object I get the desired behavior.
>I'm just puzzled: doesn't org.python.core.PyInstance derive from
>java.lang.Object too ?
This is kind of a mismatch between the Java and Python views of the
world. What you say is true on the Java side of things, but the Python
side of things doesn't inherently know about PyInstance or
java.lang.Object. Jython does not automatically assume that Jython
classes are intended to be subclasses of java.lang.Object, therefore,
you can't override java.lang.Object methods unless you explicitly
x = X()
gives you an AttributeError -- class X doesn't define a toString()
y = Y()
returns something like 'org.python.proxies.__main__$Y$0@...'
If your class derives from java.lang.Object, Jython will work things so
that the toString() call invokes your code (by creating a proxy Java
method). If not, then a toString() call from the Java side will bounce
up the ordinary Java hierarchy looking for a toString() to invoke.
That's what happens when a Swing tree makes a Java side toString() call.
Did that make sense? (And Samuele, did I get the details right...)