This content has been marked as final.
Show 4 replies
-
1. Re: Rich:tree and drag and drop how-to
nbelaevski Feb 11, 2008 8:28 AM (in response to fabmars)"fabmars" wrote:
Curiously, setting a dragListener and a dropListener is not the solution, as the dragListener may be called AFTER the dropListener (on my 3.1.4GA it happens once in a while anyway).
Yes, you're right. That needs to be reviewed, so I've dropped a note into JIRA: http://jira.jboss.com/jira/browse/RF-2227.
What can be done for now? You can use TreeNode itself as row data, e.g.:public class MyTreeNode implements TreeNode { ... public Object getData() { return this; } ... }
And then bind drag/drop values to data:<rich:tree var="node" dragValue="#{node}" dropValue="#{node}"> ... </...>
That'll make dragged & dropped nodes available in drag (or drop) events -
2. Re: Rich:tree and drag and drop how-to
tulip Feb 13, 2008 7:26 PM (in response to fabmars)Could you please specify the RichFaces version you are using. I am using Richfaces version 3.1.3GA and tried the above code and get a ClassCastException for the second line in processDrop().
org.richfaces.component.html.HtmlTreeNode cannot be cast to org.richfaces.component.html.HtmlTreeNode
Thanks -
3. Re: Rich:tree and drag and drop how-to
tulip Feb 13, 2008 7:35 PM (in response to fabmars)oops -- correction - i get a classCastexception for the FIRST line of code and not the second line
HtmlTreeNode source = (HtmlTreeNode)dragEvent.getSource();
Thanks -
4. Re: Rich:tree and drag and drop how-to
fabmars Feb 14, 2008 10:00 AM (in response to fabmars)It depends how your tree is written in the xhtml page. If the direct parent of the treeNodde is the teee itself, it will work, but if you're using some components inbetween, you have to call getParent() as many times to get back to the tree...