I am trying to show a Tree based on calculated items of a transient class.
If I show the calculated collection as a table, no problem.
If I add the annotations to show it as a Tree, exceptions are thrown. It seams that OX tries to get data for items from the DB and there is not such a table.
TreeEditor by default uses a reader that points to data. You should write another editor pointing to a custom reader. Put in your editors.xml something like this:
Your reader implementation must implement ITreeViewReader, which is quite simple. Also, check the class code org.openxava.web.editors.TreeViewReaderImpl in OpenXava/src folder.
Hope this helps,
Federico
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
1.- Add the editor to my new file xava/editors.xml
2.- Implement my.application.MyTreeViewReaderImpl
3.- Anotate my tree member with @Editor( value="MyTreeViewEditor")
.. and MyTreeViewReaderImpl is never used
:(
What am I missing?
Thanks.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Even if I get a TransientTreeViewReaderImpl working, the code keeps trying to get the model from the DB (?) before asking the my transient reader for the data.
I copy the exception below, thrown when the tree should start to be painted:
It is definitively a bug. Meanwhile, you can try to fix it in your copy, and submit the code changes. I browsed through the TreeViewParser.parseGroups() method and it seems that Tab might be the one trying to read from data. Try to make it work without the tree annotations and editor. When you have it working, then add the tree annotations and editors.
Hope this helps,
Federico
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
I am trying to show a Tree based on calculated items of a transient class.
If I show the calculated collection as a table, no problem.
If I add the annotations to show it as a Tree, exceptions are thrown. It seams that OX tries to get data for items from the DB and there is not such a table.
Code follows:
The main module:
The tree node class, a transient one:
So, is it possible to show a transient tree?
Thanks in advance for any help.
Hi JM:
TreeEditor by default uses a reader that points to data. You should write another editor pointing to a custom reader. Put in your editors.xml something like this:
Your reader implementation must implement ITreeViewReader, which is quite simple. Also, check the class code org.openxava.web.editors.TreeViewReaderImpl in OpenXava/src folder.
Hope this helps,
Federico
Seams really easy.
But, I can not get it working.
1.- Add the editor to my new file xava/editors.xml
2.- Implement my.application.MyTreeViewReaderImpl
3.- Anotate my tree member with @Editor( value="MyTreeViewEditor")
.. and MyTreeViewReaderImpl is never used
:(
What am I missing?
Thanks.
Hi,
I think I found the problem:
OpenXava 4.2.2 (2011-8-16)
Class File ./org/openxava/web/editors/TreeView.java
Line 511
where it says
should be
Right?
Cheers!
Hi JM:
Can you put the editors.xml, and your classes code here?
Also, when you run it, did you see any SEVERE message?
Federico
Hi JM:
Did you test it with the change, also for data? If it works please report it as a bug so that it can be fixed.
Federico
I would not need to test it since
is always false… right?
Added as a bug.
Cheers
Hi again:
Even if I get a TransientTreeViewReaderImpl working, the code keeps trying to get the model from the DB (?) before asking the my transient reader for the data.
I copy the exception below, thrown when the tree should start to be painted:
Thanks for any hint.
Hi,
A bit more info, just in case it could facilitate any response to my questions.
tries to build a TableModel asking the database, in order to initialize the ITreeViewReader, even if the model is transient (as it is now the case)
Cheers
Hi JM:
It is definitively a bug. Meanwhile, you can try to fix it in your copy, and submit the code changes. I browsed through the TreeViewParser.parseGroups() method and it seems that Tab might be the one trying to read from data. Try to make it work without the tree annotations and editor. When you have it working, then add the tree annotations and editors.
Hope this helps,
Federico