Author: nbelaevski
Date: 2009-03-23 20:36:32 -0400 (Mon, 23 Mar 2009)
New Revision: 13131
Modified:
trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/tree/TreeTestBean.java
trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/tree/swing/Album.java
trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/tree/swing/AudioLibrary.java
trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/tree/swing/Performer.java
trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/tree/swing/Song.java
Log:
https://jira.jboss.org/jira/browse/RF-6560
Modified:
trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/tree/TreeTestBean.java
===================================================================
---
trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/tree/TreeTestBean.java 2009-03-24
00:35:31 UTC (rev 13130)
+++
trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/tree/TreeTestBean.java 2009-03-24
00:36:32 UTC (rev 13131)
@@ -24,6 +24,8 @@
import java.util.ArrayList;
import java.util.List;
+import javax.faces.context.FacesContext;
+
import org.ajax4jsf.bean.tree.rich.AudioLibrary;
import org.apache.commons.digester.Digester;
import org.apache.commons.digester.xmlrules.DigesterLoader;
@@ -98,21 +100,28 @@
UITree tree = ((UITreeNode) dropEvent.getSource()).getUITree();
TreeRowKey<Object> dropNodeKey = (TreeRowKey<Object>)
dropEvent.getDropValue();
- TreeNode<Object> dropNode = tree.getTreeNode(dropNodeKey);
-
TreeRowKey<Object> draggedNodeKey = (TreeRowKey<Object>)
dropEvent.getDragValue();
- TreeNode<Object> draggedNode = tree.getTreeNode(draggedNodeKey);
//mark destination node as wanting rerendering
tree.addRequestKey(dropNodeKey);
Object state = null;
if(null != draggedNodeKey) {
+ Object newKey;
+ Object draggedNode = tree.getTreeNode(draggedNodeKey);
+ if (draggedNode == null) {
+ draggedNode = tree.getRowData(draggedNodeKey);
+ newKey = null;
+ } else {
+ newKey = System.currentTimeMillis();
+ }
+
// 1. mark its parent as wanting rerendering
tree.addRequestKey(draggedNodeKey.getParentKey());
// 2. remove node from tree
state = tree.removeNode(draggedNodeKey);
+
// 3. add the node at the new place
- tree.addNode(dropNodeKey, draggedNode, System.currentTimeMillis(), state);
+ tree.addNode(FacesContext.getCurrentInstance(), dropNodeKey, draggedNode,
newKey, state);
}
}
Modified:
trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/tree/swing/Album.java
===================================================================
---
trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/tree/swing/Album.java 2009-03-24
00:35:31 UTC (rev 13130)
+++
trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/tree/swing/Album.java 2009-03-24
00:36:32 UTC (rev 13131)
@@ -20,11 +20,16 @@
*/
package org.ajax4jsf.bean.tree.swing;
-import org.richfaces.model.SwingTreeNodeImpl;
+import javax.swing.tree.DefaultMutableTreeNode;
-public class Album extends SwingTreeNodeImpl {
+public class Album extends DefaultMutableTreeNode {
- private String title;
+ /**
+ *
+ */
+ private static final long serialVersionUID = 2429534355312790317L;
+
+ private String title;
private Integer year;
/**
@@ -60,8 +65,7 @@
}
public void addSong(Song song) {
- addChild(song);
- song.setParent(this);
+ add(song);
}
/**
Modified:
trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/tree/swing/AudioLibrary.java
===================================================================
---
trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/tree/swing/AudioLibrary.java 2009-03-24
00:35:31 UTC (rev 13130)
+++
trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/tree/swing/AudioLibrary.java 2009-03-24
00:36:32 UTC (rev 13131)
@@ -20,13 +20,17 @@
*/
package org.ajax4jsf.bean.tree.swing;
-import org.richfaces.model.SwingTreeNodeImpl;
+import javax.swing.tree.DefaultMutableTreeNode;
-public class AudioLibrary extends SwingTreeNodeImpl {
+public class AudioLibrary extends DefaultMutableTreeNode {
- public void addPerformer(Performer performer) {
- addChild(performer);
- performer.setParent(this);
+ /**
+ *
+ */
+ private static final long serialVersionUID = 181713372792437222L;
+
+ public void addPerformer(Performer performer) {
+ add(performer);
}
public String getType() {
Modified:
trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/tree/swing/Performer.java
===================================================================
---
trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/tree/swing/Performer.java 2009-03-24
00:35:31 UTC (rev 13130)
+++
trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/tree/swing/Performer.java 2009-03-24
00:36:32 UTC (rev 13131)
@@ -20,11 +20,16 @@
*/
package org.ajax4jsf.bean.tree.swing;
-import org.richfaces.model.SwingTreeNodeImpl;
+import javax.swing.tree.DefaultMutableTreeNode;
-public class Performer extends SwingTreeNodeImpl {
+public class Performer extends DefaultMutableTreeNode {
- private String name;
+ /**
+ *
+ */
+ private static final long serialVersionUID = -1721901324378505571L;
+
+ private String name;
/**
* Gets value of library field.
@@ -59,8 +64,7 @@
}
public void addAlbum(Album album) {
- addChild(album);
- album.setParent(this);
+ add(album);
}
public String getType() {
Modified:
trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/tree/swing/Song.java
===================================================================
---
trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/tree/swing/Song.java 2009-03-24
00:35:31 UTC (rev 13130)
+++
trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/tree/swing/Song.java 2009-03-24
00:36:32 UTC (rev 13131)
@@ -20,11 +20,16 @@
*/
package org.ajax4jsf.bean.tree.swing;
-import org.richfaces.model.SwingTreeNodeImpl;
+import javax.swing.tree.DefaultMutableTreeNode;
-public class Song extends SwingTreeNodeImpl {
+public class Song extends DefaultMutableTreeNode {
- private String title;
+ /**
+ *
+ */
+ private static final long serialVersionUID = 6994524192598771802L;
+
+ private String title;
/**
* Gets value of album field.