[richfaces-svn-commits] JBoss Rich Faces SVN: r11859 - in trunk/ui/tree/src/main: java/org/richfaces/renderkit and 2 other directories.
richfaces-svn-commits at lists.jboss.org
richfaces-svn-commits at lists.jboss.org
Wed Dec 17 18:05:19 EST 2008
Author: nbelaevski
Date: 2008-12-17 18:05:19 -0500 (Wed, 17 Dec 2008)
New Revision: 11859
Modified:
trunk/ui/tree/src/main/config/component/tree.xml
trunk/ui/tree/src/main/java/org/richfaces/renderkit/TreeRendererBase.java
trunk/ui/tree/src/main/resources/org/richfaces/renderkit/html/scripts/tree-selection.js
trunk/ui/tree/src/main/resources/org/richfaces/renderkit/html/scripts/tree.js
trunk/ui/tree/src/main/templates/htmlTree.jspx
Log:
https://jira.jboss.org/jira/browse/RF-4478
Modified: trunk/ui/tree/src/main/config/component/tree.xml
===================================================================
--- trunk/ui/tree/src/main/config/component/tree.xml 2008-12-17 20:10:53 UTC (rev 11858)
+++ trunk/ui/tree/src/main/config/component/tree.xml 2008-12-17 23:05:19 UTC (rev 11859)
@@ -310,6 +310,11 @@
<property hidden="true">
<name>rowKeyConverter</name>
</property>
+
+ <property>
+ <name>disableKeyboardNavigation</name>
+ <classname>boolean</classname>
+ </property>
</component>
&listeners;
Modified: trunk/ui/tree/src/main/java/org/richfaces/renderkit/TreeRendererBase.java
===================================================================
--- trunk/ui/tree/src/main/java/org/richfaces/renderkit/TreeRendererBase.java 2008-12-17 20:10:53 UTC (rev 11858)
+++ trunk/ui/tree/src/main/java/org/richfaces/renderkit/TreeRendererBase.java 2008-12-17 23:05:19 UTC (rev 11859)
@@ -26,6 +26,7 @@
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
+import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
@@ -45,6 +46,7 @@
import org.ajax4jsf.model.DataVisitor;
import org.ajax4jsf.renderkit.AjaxRendererUtils;
import org.ajax4jsf.renderkit.ComponentsVariableResolver;
+import org.ajax4jsf.renderkit.RendererUtils;
import org.richfaces.component.UITree;
import org.richfaces.component.UITreeNode;
import org.richfaces.component.nsutils.NSUtils;
@@ -672,6 +674,25 @@
input.restoreOrigValue();
}
}
+
+ private static final String[] OPTIONS_ATTRIBUTES_LIST = { "showConnectingLines", "toggleOnClick",
+ "disableKeyboardNavigation"};
+
+ public String getOptions(FacesContext context, UITree tree) {
+ Map<String, Object> attributes = tree.getAttributes();
+ RendererUtils utils = getUtils();
+
+ Map<String, Object> options = new HashMap<String, Object>();
+ for (String optionAttributeName : OPTIONS_ATTRIBUTES_LIST) {
+ Object value = attributes.get(optionAttributeName);
+
+ if (utils.shouldRenderAttribute(value)) {
+ options.put(optionAttributeName, value);
+ }
+ }
+
+ return ScriptUtils.toScript(options);
+ }
}
class Flag {
Modified: trunk/ui/tree/src/main/resources/org/richfaces/renderkit/html/scripts/tree-selection.js
===================================================================
--- trunk/ui/tree/src/main/resources/org/richfaces/renderkit/html/scripts/tree-selection.js 2008-12-17 20:10:53 UTC (rev 11858)
+++ trunk/ui/tree/src/main/resources/org/richfaces/renderkit/html/scripts/tree-selection.js 2008-12-17 23:05:19 UTC (rev 11859)
@@ -3,8 +3,10 @@
initialize: function(tree) {
this.tree = tree;
- this.eventKeyDown = this.processKeyDown.bindAsEventListener(this);
- Event.observe(document, "keydown", this.eventKeyDown);
+ if (!this.tree.disableKeyboardNavigation) {
+ this.eventKeyDown = this.processKeyDown.bindAsEventListener(this);
+ Event.observe(document, "keydown", this.eventKeyDown);
+ }
this.eventLostFocus = this.processLostFocus.bindAsEventListener(this);
Event.observe(document, "click", this.eventLostFocus);
@@ -17,7 +19,10 @@
this.activeItem = null;
this.tree = null;
- Event.stopObserving(document, "keydown", this.eventKeyDown);
+ if (this.eventKeyDown) {
+ Event.stopObserving(document, "keydown", this.eventKeyDown);
+ }
+
Event.stopObserving(document, "click", this.eventLostFocus);
},
Modified: trunk/ui/tree/src/main/resources/org/richfaces/renderkit/html/scripts/tree.js
===================================================================
--- trunk/ui/tree/src/main/resources/org/richfaces/renderkit/html/scripts/tree.js 2008-12-17 20:10:53 UTC (rev 11858)
+++ trunk/ui/tree/src/main/resources/org/richfaces/renderkit/html/scripts/tree.js 2008-12-17 23:05:19 UTC (rev 11859)
@@ -64,7 +64,7 @@
Tree.CLASS_AJAX_SELECTED_LISTENER_FLAG = "ajax_selected_listener_flag";
Tree.addMethods({
- initialize: function($super, id, input, switchType, events, onAjaxSelect, toggleOnClick, showConnectingLines) {
+ initialize: function($super, id, input, switchType, events, onAjaxSelect, options) {
$super();
this.childs = [];
this.elements = {};
@@ -79,9 +79,10 @@
this.element.component=this;
this.inputId = input;
this.input = $(this.inputId);
- this.toggleOnClick = toggleOnClick;
- this.showConnectingLines = showConnectingLines;
-
+ this.toggleOnClick = options.toggleOnClick;
+ this.showConnectingLines = options.showConnectingLines;
+ this.disableKeyboardNavigation = options.disableKeyboardNavigation;
+
var options = Object.extend({
columnCount: 0
}, arguments[1] || {}
Modified: trunk/ui/tree/src/main/templates/htmlTree.jspx
===================================================================
--- trunk/ui/tree/src/main/templates/htmlTree.jspx 2008-12-17 20:10:53 UTC (rev 11858)
+++ trunk/ui/tree/src/main/templates/htmlTree.jspx 2008-12-17 23:05:19 UTC (rev 11859)
@@ -60,8 +60,7 @@
function(event) {
#{this:getAjaxScript(context, component)}
},
- #{component.toggleOnClick},
- #{component.showConnectingLines}
+ #{this:getOptions(context, component)}
);
#{this:getScriptContributions(context, component)}
</script>
More information about the richfaces-svn-commits
mailing list