Author: nbelaevski
Date: 2010-11-18 12:10:13 -0500 (Thu, 18 Nov 2010)
New Revision: 20106
Added:
trunk/ui/iteration/api/src/main/java/org/richfaces/event/TreeSelectionChangeEvent.java
trunk/ui/iteration/api/src/main/java/org/richfaces/event/TreeSelectionChangeListener.java
trunk/ui/iteration/api/src/main/java/org/richfaces/event/TreeSelectionChangeSource.java
trunk/ui/iteration/api/src/main/java/org/richfaces/event/TreeToggleSource.java
Removed:
trunk/ui/iteration/api/src/main/java/org/richfaces/event/TreeSelectionEvent.java
trunk/ui/iteration/api/src/main/java/org/richfaces/event/TreeSelectionListener.java
Modified:
trunk/examples/iteration-demo/src/main/java/org/richfaces/demo/TreeBean.java
trunk/examples/iteration-demo/src/main/webapp/tree.xhtml
trunk/examples/richfaces-showcase/src/main/java/org/richfaces/demo/tree/TreeBean.java
trunk/ui/common/ui/src/main/java/org/richfaces/renderkit/RenderKitUtils.java
trunk/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractTree.java
trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/TreeRendererBase.java
trunk/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/tree.js
trunk/ui/iteration/ui/src/main/templates/treeNode.template.xml
Log:
https://jira.jboss.org/browse/RF-9714
https://jira.jboss.org/browse/RF-9717
Modified: trunk/examples/iteration-demo/src/main/java/org/richfaces/demo/TreeBean.java
===================================================================
---
trunk/examples/iteration-demo/src/main/java/org/richfaces/demo/TreeBean.java 2010-11-18
17:01:46 UTC (rev 20105)
+++
trunk/examples/iteration-demo/src/main/java/org/richfaces/demo/TreeBean.java 2010-11-18
17:10:13 UTC (rev 20106)
@@ -30,6 +30,7 @@
import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;
import javax.faces.context.FacesContext;
+import javax.faces.event.AjaxBehaviorEvent;
import javax.swing.tree.TreeNode;
import org.richfaces.component.SwitchType;
@@ -96,13 +97,10 @@
}
public Object getNodeData() {
- return nodeData;
+ FacesContext facesContext = FacesContext.getCurrentInstance();
+ return facesContext.getApplication().evaluateExpressionGet(facesContext,
"#{node}", Object.class);
}
- public void setNodeData(Object nodeData) {
- this.nodeData = nodeData;
- }
-
public Collection<Object> getSelection() {
return selection;
}
@@ -123,4 +121,14 @@
public void setShowCustomClasses(boolean showCustomClasses) {
this.showCustomClasses = showCustomClasses;
}
+
+ public void behaviorToggleListener(AjaxBehaviorEvent event) {
+ FacesContext facesContext = FacesContext.getCurrentInstance();
+ facesContext.addMessage(null, new FacesMessage("Toggle node: " +
getNodeData() + ", source is: " + event.getSource()));
+ }
+
+ public void behaviorSelectionChangeListener(AjaxBehaviorEvent event) {
+ FacesContext facesContext = FacesContext.getCurrentInstance();
+ facesContext.addMessage(event.getComponent().getClientId(facesContext), new
FacesMessage("Selection changed, source is: " + event.getSource()));
+ }
}
Modified: trunk/examples/iteration-demo/src/main/webapp/tree.xhtml
===================================================================
--- trunk/examples/iteration-demo/src/main/webapp/tree.xhtml 2010-11-18 17:01:46 UTC (rev
20105)
+++ trunk/examples/iteration-demo/src/main/webapp/tree.xhtml 2010-11-18 17:10:13 UTC (rev
20106)
@@ -32,6 +32,15 @@
<h:body>
<h:outputScript>
+ function nodesArrayToString(nodes) {
+ var result = new Array();
+ jQuery.each(nodes, function(k, v) {
+ result.push(v.getId());
+ });
+
+ return result.join('');
+ }
+
function getNodeStateString(treeNode) {
return treeNode.isLeaf() ?
'leaf'
@@ -47,13 +56,10 @@
function handleNodeSelect(event) {
var treeNode = RichFaces.$(event.target);
- var selectedNodes = event.rf.data.selection;
- var selection = new Array();
- jQuery.each(selectedNodes, function(k, v) {
- selection.push(v.getId());
- });
+ var oldSelectionString = nodesArrayToString(event.rf.data.oldSelection);
+ var newSelectionString = nodesArrayToString(event.rf.data.newSelection);
- RichFaces.log.info('Select event:\n ' + selection.join(''));
+ RichFaces.log.info('Selection changed from: [' + oldSelectionString + ']
to: [' + newSelectionString + ']');
}
</h:outputScript>
@@ -79,8 +85,6 @@
<h:panelGroup id="rootNodeGroup">
Root node: #{node.data} -
<h:commandLink value="link"
action="#{treeBean.clickNode}">
- <f:setPropertyActionListener value="#{node.data}"
target="#{treeBean.nodeData}" />
-
<f:ajax render=":messages" />
</h:commandLink>
</h:panelGroup>
@@ -89,8 +93,6 @@
<h:panelGroup id="childNodeGroup">
#{node.data} -
<h:commandLink value="link"
action="#{treeBean.clickNode}">
- <f:setPropertyActionListener value="#{node.data}"
target="#{treeBean.nodeData}" />
-
<f:ajax render=":messages" />
</h:commandLink>
</h:panelGroup>
@@ -124,12 +126,29 @@
selectionType="#{treeBean.selectionType}"
toggleType="#{treeBean.toggleType}"
onnodetoggle="handleNodeToggle("#{node.data}", event,
false)"
onselectionchange="handleNodeSelect(event)">
-
+
<it:treeNode ontoggle="handleNodeToggle("#{node.data}",
event, true)">
#{node.data}
</it:treeNode>
</it:tree>
+ Tree with attached behaviors:
+ <h:messages id="treeBehaviorsMessages"
for="behaviorsAttachedTree" />
+ <h:messages id="treeNodeBehaviorsMessages" globalOnly="true"
/>
+
+ <it:tree id="behaviorsAttachedTree" var="node"
value="#{treeBean.rootNodes}"
+ selectionType="#{treeBean.selectionType}"
toggleType="#{treeBean.toggleType}">
+
+ <f:ajax event="nodetoggle"
listener="#{treeBean.behaviorToggleListener}"
render=":form:treeBehaviorsMessages" />
+ <f:ajax event="selectionchange"
listener="#{treeBean.behaviorSelectionChangeListener}"
render=":form:treeBehaviorsMessages :form:treeNodeBehaviorsMessages" />
+
+ <it:treeNode>
+ #{node.data}
+
+ <f:ajax event="toggle"
listener="#{treeBean.behaviorToggleListener}"
render=":form:treeNodeBehaviorsMessages" />
+ </it:treeNode>
+ </it:tree>
+
<a4j:log />
</h:form>
</h:body>
Modified:
trunk/examples/richfaces-showcase/src/main/java/org/richfaces/demo/tree/TreeBean.java
===================================================================
---
trunk/examples/richfaces-showcase/src/main/java/org/richfaces/demo/tree/TreeBean.java 2010-11-18
17:01:46 UTC (rev 20105)
+++
trunk/examples/richfaces-showcase/src/main/java/org/richfaces/demo/tree/TreeBean.java 2010-11-18
17:10:13 UTC (rev 20106)
@@ -36,7 +36,7 @@
import org.richfaces.demo.tree.model.CD;
import org.richfaces.demo.tree.model.Company;
import org.richfaces.demo.tree.model.Country;
-import org.richfaces.event.TreeSelectionEvent;
+import org.richfaces.event.TreeSelectionChangeEvent;
/**
* @author Ilya Shaikovsky
@@ -88,7 +88,7 @@
return company;
}
- private void selectionListener(TreeSelectionEvent event) {
+ private void selectionListener(TreeSelectionChangeEvent event) {
//TODO: implement when ready
}
Modified: trunk/ui/common/ui/src/main/java/org/richfaces/renderkit/RenderKitUtils.java
===================================================================
---
trunk/ui/common/ui/src/main/java/org/richfaces/renderkit/RenderKitUtils.java 2010-11-18
17:01:46 UTC (rev 20105)
+++
trunk/ui/common/ui/src/main/java/org/richfaces/renderkit/RenderKitUtils.java 2010-11-18
17:10:13 UTC (rev 20106)
@@ -385,6 +385,7 @@
}
//TODO - create special method for event handlers that will return String?
+ //TODO - add check for 'disabled'?
public static Object getAttributeAndBehaviorsValue(FacesContext facesContext,
UIComponent component,
ComponentAttribute componentAttribute) {
if (facesContext == null) {
Copied:
trunk/ui/iteration/api/src/main/java/org/richfaces/event/TreeSelectionChangeEvent.java
(from rev 20105,
trunk/ui/iteration/api/src/main/java/org/richfaces/event/TreeSelectionEvent.java)
===================================================================
---
trunk/ui/iteration/api/src/main/java/org/richfaces/event/TreeSelectionChangeEvent.java
(rev 0)
+++
trunk/ui/iteration/api/src/main/java/org/richfaces/event/TreeSelectionChangeEvent.java 2010-11-18
17:10:13 UTC (rev 20106)
@@ -0,0 +1,67 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.richfaces.event;
+
+import java.util.Collection;
+
+import javax.faces.component.UIComponent;
+import javax.faces.event.FacesEvent;
+import javax.faces.event.FacesListener;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+public class TreeSelectionChangeEvent extends FacesEvent {
+
+ private static final long serialVersionUID = 6292604445872458007L;
+
+ private Collection<Object> oldSelection;
+
+ private Collection<Object> newSelection;
+
+ public TreeSelectionChangeEvent(UIComponent component, Collection<Object>
oldSelection, Collection<Object> newSelection) {
+ super(component);
+
+ this.oldSelection = oldSelection;
+ this.newSelection = newSelection;
+ }
+
+ @Override
+ public boolean isAppropriateListener(FacesListener listener) {
+ return listener instanceof TreeSelectionChangeListener;
+ }
+
+ @Override
+ public void processListener(FacesListener listener) {
+ ((TreeSelectionChangeListener) listener).processSelection(this);
+ }
+
+ public Collection<Object> getOldSelection() {
+ return oldSelection;
+ }
+
+ public Collection<Object> getNewSelection() {
+ return newSelection;
+ }
+
+}
Copied:
trunk/ui/iteration/api/src/main/java/org/richfaces/event/TreeSelectionChangeListener.java
(from rev 20105,
trunk/ui/iteration/api/src/main/java/org/richfaces/event/TreeSelectionListener.java)
===================================================================
---
trunk/ui/iteration/api/src/main/java/org/richfaces/event/TreeSelectionChangeListener.java
(rev 0)
+++
trunk/ui/iteration/api/src/main/java/org/richfaces/event/TreeSelectionChangeListener.java 2010-11-18
17:10:13 UTC (rev 20106)
@@ -0,0 +1,34 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.richfaces.event;
+
+import javax.faces.event.FacesListener;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+public interface TreeSelectionChangeListener extends FacesListener {
+
+ public void processSelection(TreeSelectionChangeEvent event);
+
+}
Copied:
trunk/ui/iteration/api/src/main/java/org/richfaces/event/TreeSelectionChangeSource.java
(from rev 20105,
trunk/ui/iteration/api/src/main/java/org/richfaces/event/TreeSelectionListener.java)
===================================================================
---
trunk/ui/iteration/api/src/main/java/org/richfaces/event/TreeSelectionChangeSource.java
(rev 0)
+++
trunk/ui/iteration/api/src/main/java/org/richfaces/event/TreeSelectionChangeSource.java 2010-11-18
17:10:13 UTC (rev 20106)
@@ -0,0 +1,34 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.richfaces.event;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+public interface TreeSelectionChangeSource {
+
+ public void addSelectionChangeListener(TreeSelectionChangeListener listener);
+
+ public void removeSelectionchangeListener(TreeSelectionChangeListener listener);
+
+}
Deleted: trunk/ui/iteration/api/src/main/java/org/richfaces/event/TreeSelectionEvent.java
===================================================================
---
trunk/ui/iteration/api/src/main/java/org/richfaces/event/TreeSelectionEvent.java 2010-11-18
17:01:46 UTC (rev 20105)
+++
trunk/ui/iteration/api/src/main/java/org/richfaces/event/TreeSelectionEvent.java 2010-11-18
17:10:13 UTC (rev 20106)
@@ -1,67 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc. and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.richfaces.event;
-
-import java.util.Collection;
-
-import javax.faces.component.UIComponent;
-import javax.faces.event.FacesEvent;
-import javax.faces.event.FacesListener;
-
-/**
- * @author Nick Belaevski
- *
- */
-public class TreeSelectionEvent extends FacesEvent {
-
- private static final long serialVersionUID = 6292604445872458007L;
-
- private Collection<Object> oldSelection;
-
- private Collection<Object> newSelection;
-
- public TreeSelectionEvent(UIComponent component, Collection<Object>
oldSelection, Collection<Object> newSelection) {
- super(component);
-
- this.oldSelection = oldSelection;
- this.newSelection = newSelection;
- }
-
- @Override
- public boolean isAppropriateListener(FacesListener listener) {
- return listener instanceof TreeSelectionListener;
- }
-
- @Override
- public void processListener(FacesListener listener) {
- ((TreeSelectionListener) listener).processSelection(this);
- }
-
- public Collection<Object> getOldSelection() {
- return oldSelection;
- }
-
- public Collection<Object> getNewSelection() {
- return newSelection;
- }
-
-}
Deleted:
trunk/ui/iteration/api/src/main/java/org/richfaces/event/TreeSelectionListener.java
===================================================================
---
trunk/ui/iteration/api/src/main/java/org/richfaces/event/TreeSelectionListener.java 2010-11-18
17:01:46 UTC (rev 20105)
+++
trunk/ui/iteration/api/src/main/java/org/richfaces/event/TreeSelectionListener.java 2010-11-18
17:10:13 UTC (rev 20106)
@@ -1,34 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc. and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.richfaces.event;
-
-import javax.faces.event.FacesListener;
-
-/**
- * @author Nick Belaevski
- *
- */
-public interface TreeSelectionListener extends FacesListener {
-
- public void processSelection(TreeSelectionEvent event);
-
-}
Copied: trunk/ui/iteration/api/src/main/java/org/richfaces/event/TreeToggleSource.java
(from rev 20105,
trunk/ui/iteration/api/src/main/java/org/richfaces/event/TreeSelectionListener.java)
===================================================================
--- trunk/ui/iteration/api/src/main/java/org/richfaces/event/TreeToggleSource.java
(rev 0)
+++
trunk/ui/iteration/api/src/main/java/org/richfaces/event/TreeToggleSource.java 2010-11-18
17:10:13 UTC (rev 20106)
@@ -0,0 +1,34 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.richfaces.event;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+public interface TreeToggleSource {
+
+ public void addToggleListener(TreeToggleListener listener);
+
+ public void removeToggleListener(TreeToggleListener listener);
+
+}
Modified: trunk/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractTree.java
===================================================================
---
trunk/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractTree.java 2010-11-18
17:01:46 UTC (rev 20105)
+++
trunk/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractTree.java 2010-11-18
17:10:13 UTC (rev 20106)
@@ -50,8 +50,8 @@
import org.richfaces.context.ExtendedVisitContext;
import org.richfaces.context.ExtendedVisitContextMode;
import org.richfaces.convert.SequenceRowKeyConverter;
-import org.richfaces.event.TreeSelectionEvent;
-import org.richfaces.event.TreeSelectionListener;
+import org.richfaces.event.TreeSelectionChangeEvent;
+import org.richfaces.event.TreeSelectionChangeListener;
import org.richfaces.model.ExtendedTreeDataModelImpl;
import org.richfaces.model.SwingTreeNodeDataModelImpl;
import org.richfaces.model.TreeDataModel;
@@ -253,8 +253,8 @@
public void broadcast(FacesEvent event) throws AbortProcessingException {
super.broadcast(event);
- if (event instanceof TreeSelectionEvent) {
- TreeSelectionEvent selectionEvent = (TreeSelectionEvent) event;
+ if (event instanceof TreeSelectionChangeEvent) {
+ TreeSelectionChangeEvent selectionEvent = (TreeSelectionChangeEvent) event;
final Collection<Object> newSelection =
selectionEvent.getNewSelection();
@@ -325,15 +325,15 @@
return new TreeComponentState();
}
- public void addSelectionListener(TreeSelectionListener listener) {
+ public void addSelectionChangeListener(TreeSelectionChangeListener listener) {
addFacesListener(listener);
}
- public TreeSelectionListener[] getSelectionListeners() {
- return (TreeSelectionListener[]) getFacesListeners(TreeSelectionListener.class);
+ public TreeSelectionChangeListener[] getSelectionChangeListeners() {
+ return (TreeSelectionChangeListener[])
getFacesListeners(TreeSelectionChangeListener.class);
}
- public void removeSelectionListener(TreeSelectionListener listener) {
+ public void removeSelectionChangeListener(TreeSelectionChangeListener listener) {
removeFacesListener(listener);
}
Modified:
trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/TreeRendererBase.java
===================================================================
---
trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/TreeRendererBase.java 2010-11-18
17:01:46 UTC (rev 20105)
+++
trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/TreeRendererBase.java 2010-11-18
17:10:13 UTC (rev 20106)
@@ -45,7 +45,7 @@
import org.richfaces.component.AbstractTreeNode;
import org.richfaces.component.MetaComponentResolver;
import org.richfaces.component.SwitchType;
-import org.richfaces.event.TreeSelectionEvent;
+import org.richfaces.event.TreeSelectionChangeEvent;
import org.richfaces.log.Logger;
import org.richfaces.log.RichfacesLogger;
@@ -262,7 +262,7 @@
}
if (newSelection != null) {
- new TreeSelectionEvent(component, Sets.newHashSet(selection),
newSelection).queue();
+ new TreeSelectionChangeEvent(component, Sets.newHashSet(selection),
newSelection).queue();
}
PartialViewContext pvc = context.getPartialViewContext();
Modified:
trunk/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/tree.js
===================================================================
---
trunk/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/tree.js 2010-11-18
17:01:46 UTC (rev 20105)
+++
trunk/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/tree.js 2010-11-18
17:10:13 UTC (rev 20106)
@@ -398,34 +398,34 @@
},
__updateSelection: function() {
- var oldSelection = this.__selectedNodeId;
- var nodeId = this.__selectionInput.val();
+ var oldSelection = new Array();
+ var newSelection = new Array();
- if (oldSelection == nodeId) {
+ var oldSelectionId = this.__selectedNodeId;
+ var newSelectionId = this.__selectionInput.val();
+
+ if (oldSelectionId == newSelectionId) {
return;
}
- if (oldSelection) {
- var oldSelectionNode = richfaces.$(oldSelection);
+ if (oldSelectionId) {
+ var oldSelectionNode = richfaces.$(oldSelectionId);
if (oldSelectionNode) {
oldSelectionNode.__setSelected(false);
+ oldSelection.push(oldSelectionNode);
}
}
- var newSelectionNode;
- var selection = new Array();
-
- if (nodeId) {
- newSelectionNode = richfaces.$(nodeId);
+ if (newSelectionId) {
+ var newSelectionNode = richfaces.$(newSelectionId);
+ if (newSelectionNode) {
+ newSelectionNode.__setSelected(true);
+ newSelection.push(newSelectionNode);
+ }
}
- if (newSelectionNode) {
- newSelectionNode.__setSelected(true);
- selection.push(newSelectionNode);
- }
-
- this.__selectedNodeId = nodeId;
- richfaces.Event.fire(this.__treeRootElt, "selectionchange", {selection:
selection});
+ this.__selectedNodeId = newSelectionId;
+ richfaces.Event.fire(this.__treeRootElt, "selectionchange", {oldSelection:
oldSelection, newSelection: newSelection});
}
});
Modified: trunk/ui/iteration/ui/src/main/templates/treeNode.template.xml
===================================================================
--- trunk/ui/iteration/ui/src/main/templates/treeNode.template.xml 2010-11-18 17:01:46 UTC
(rev 20105)
+++ trunk/ui/iteration/ui/src/main/templates/treeNode.template.xml 2010-11-18 17:10:13 UTC
(rev 20106)
@@ -24,6 +24,8 @@
<cdk:call expression="addClientEventHandlers(facesContext,
component)" />
+ <cdk:call expression="addClientEventHandlers(facesContext,
component)" />
+
<div class="#{concatClasses('rf-trn',
component.attributes['styleClass'],
tree.attributes['nodeClass'])}">
<span class="#{concatClasses(nodeState.handleClass,
component.attributes['handleClass'],
tree.attributes['handleClass'])}"></span>