Author: nbelaevski
Date: 2010-10-31 21:13:46 -0400 (Sun, 31 Oct 2010)
New Revision: 19810
Modified:
sandbox/trunk/ui/tree-actual/ui/src/main/java/org/richfaces/renderkit/TreeRendererBase.java
sandbox/trunk/ui/tree-actual/ui/src/main/resources/META-INF/resources/org.richfaces/tree.js
sandbox/trunk/ui/tree-actual/ui/src/main/templates/tree.template.xml
Log:
https://jira.jboss.org/browse/RF-9315
Modified:
sandbox/trunk/ui/tree-actual/ui/src/main/java/org/richfaces/renderkit/TreeRendererBase.java
===================================================================
---
sandbox/trunk/ui/tree-actual/ui/src/main/java/org/richfaces/renderkit/TreeRendererBase.java 2010-11-01
01:02:06 UTC (rev 19809)
+++
sandbox/trunk/ui/tree-actual/ui/src/main/java/org/richfaces/renderkit/TreeRendererBase.java 2010-11-01
01:13:46 UTC (rev 19810)
@@ -65,9 +65,9 @@
static final Logger LOGGER = RichfacesLogger.RENDERKIT.getLogger();
- private static final JSReference TOGGLE_PARAMS = new
JSReference("toggleParams");
+ private static final JSReference PARAMS_JS_REF = new
JSReference("params");
- private static final JSReference TOGGLE_SOURCE = new
JSReference("toggleSource");
+ private static final JSReference SOURCE_JS_REF = new
JSReference("source");
private static final String NEW_NODE_TOGGLE_STATE =
"__NEW_NODE_TOGGLE_STATE";
@@ -151,19 +151,18 @@
return UINamingContainer.getSeparatorChar(facesContext) +
TreeDecoderHelper.HELPER_ID;
}
- protected String getAjaxToggler(FacesContext context, UIComponent component) {
+ protected String getAjaxSubmitFunction(FacesContext context, UIComponent component)
{
AbstractTree tree = (AbstractTree) component;
- SwitchType toggleMode = tree.getToggleMode();
- if (toggleMode != SwitchType.ajax) {
+ if (tree.getToggleMode() != SwitchType.ajax && tree.getSelectionMode() !=
SwitchType.ajax) {
return null;
}
JSFunction ajaxFunction = buildAjaxFunction(context, component,
AJAX_FUNCTION_NAME);
AjaxEventOptions eventOptions = buildEventOptions(context, component);
- eventOptions.setAjaxComponent(TOGGLE_SOURCE);
- eventOptions.setClientParameters(TOGGLE_PARAMS);
+ eventOptions.setAjaxComponent(SOURCE_JS_REF);
+ eventOptions.setClientParameters(PARAMS_JS_REF);
if (!eventOptions.isEmpty()) {
ajaxFunction.addParameter(eventOptions);
Modified:
sandbox/trunk/ui/tree-actual/ui/src/main/resources/META-INF/resources/org.richfaces/tree.js
===================================================================
---
sandbox/trunk/ui/tree-actual/ui/src/main/resources/META-INF/resources/org.richfaces/tree.js 2010-11-01
01:02:06 UTC (rev 19809)
+++
sandbox/trunk/ui/tree-actual/ui/src/main/resources/META-INF/resources/org.richfaces/tree.js 2010-11-01
01:13:46 UTC (rev 19810)
@@ -250,8 +250,8 @@
this.__toggleMode = options.toggleMode || 'ajax';
this.__selectionMode = options.selectionMode || 'client';
- if (options.ajaxToggler) {
- this.__ajaxToggler = new Function("event", "toggleSource",
"toggleParams", options.ajaxToggler);
+ if (options.ajaxSubmitFunction) {
+ this.__ajaxSubmitFunction = new Function("event", "source",
"params", options.ajaxSubmitFunction);
}
this.__selectionInput = $(" > .rf-tr-sel-inp", this.elt);
@@ -270,7 +270,7 @@
this.__itemContentClickedHandler = null;
this.__selectionInput = null;
- this.__ajaxToggler = null;
+ this.__ajaxSubmitFunction = null;
},
__itemHandleClicked: function(event) {
@@ -306,7 +306,7 @@
var form = $(richfaces.getDomElement(this.id)).closest('form');
richfaces.submitForm(form, clientParams);
} else {
- this.__ajaxToggler(event, toggleSource + ncSepChar + DECODER_HELPER_ID,
clientParams);
+ this.__ajaxSubmitFunction(event, toggleSource + ncSepChar + DECODER_HELPER_ID,
clientParams);
}
},
@@ -334,7 +334,7 @@
if (this.__selectionMode == 'client') {
this.__updateSelection();
} else {
- this.__ajaxToggler(null, this.id);
+ this.__ajaxSubmitFunction(null, this.id);
}
},
@@ -373,10 +373,8 @@
var newSelectionNode = richfaces.$(nodeId);
if (newSelectionNode) {
newSelectionNode.__setSelected(true);
- this.__selectedNodeId = nodeId;
- } else {
- this.__resetSelection();
}
+ this.__selectedNodeId = nodeId;
}
});
Modified: sandbox/trunk/ui/tree-actual/ui/src/main/templates/tree.template.xml
===================================================================
--- sandbox/trunk/ui/tree-actual/ui/src/main/templates/tree.template.xml 2010-11-01
01:02:06 UTC (rev 19809)
+++ sandbox/trunk/ui/tree-actual/ui/src/main/templates/tree.template.xml 2010-11-01
01:13:46 UTC (rev 19810)
@@ -32,7 +32,7 @@
<cdk:scriptObject name="options">
<cdk:scriptOption attributes="toggleMode"
defaultValue="SwitchType.DEFAULT" />
<cdk:scriptOption name="selectionMode"
value="#{getSelectionMode(facesContext, component)}"
defaultValue="SwitchType.client" />
- <cdk:scriptOption name="ajaxToggler"
value="#{getAjaxToggler(facesContext, component)}" />
+ <cdk:scriptOption name="ajaxSubmitFunction"
value="#{getAjaxSubmitFunction(facesContext, component)}" />
</cdk:scriptObject>
new RichFaces.ui.Tree(#{toScriptArgs(clientId, options)});