Author: pyaschenko
Date: 2009-02-26 11:04:24 -0500 (Thu, 26 Feb 2009)
New Revision: 12762
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-item.js
trunk/ui/tree/src/main/resources/org/richfaces/renderkit/html/scripts/tree.js
Log:
https://jira.jboss.org/jira/browse/RF-5746
Modified: trunk/ui/tree/src/main/config/component/tree.xml
===================================================================
--- trunk/ui/tree/src/main/config/component/tree.xml 2009-02-26 15:43:16 UTC (rev 12761)
+++ trunk/ui/tree/src/main/config/component/tree.xml 2009-02-26 16:04:24 UTC (rev 12762)
@@ -172,6 +172,11 @@
<description>JavaScript handler to be called on right click.
Returning false prevents default browser context menu from being
displayed</description>
</property>
+ <property>
+ <name>rightClickSelection</name>
+ <classname>boolean</classname>
+ <description>Allow to select tree item using mouse right
click</description>
+ </property>
<property hidden="true">
<name>varState</name>
Modified: trunk/ui/tree/src/main/java/org/richfaces/renderkit/TreeRendererBase.java
===================================================================
--- trunk/ui/tree/src/main/java/org/richfaces/renderkit/TreeRendererBase.java 2009-02-26
15:43:16 UTC (rev 12761)
+++ trunk/ui/tree/src/main/java/org/richfaces/renderkit/TreeRendererBase.java 2009-02-26
16:04:24 UTC (rev 12762)
@@ -680,7 +680,7 @@
}
private static final String[] OPTIONS_ATTRIBUTES_LIST = {
"showConnectingLines", "toggleOnClick",
- "disableKeyboardNavigation"};
+ "disableKeyboardNavigation", "rightClickSelection"};
public String getOptions(FacesContext context, UITree tree) {
Map<String, Object> attributes = tree.getAttributes();
Modified:
trunk/ui/tree/src/main/resources/org/richfaces/renderkit/html/scripts/tree-item.js
===================================================================
---
trunk/ui/tree/src/main/resources/org/richfaces/renderkit/html/scripts/tree-item.js 2009-02-26
15:43:16 UTC (rev 12761)
+++
trunk/ui/tree/src/main/resources/org/richfaces/renderkit/html/scripts/tree-item.js 2009-02-26
16:04:24 UTC (rev 12762)
@@ -422,7 +422,7 @@
toggleSelection: function(e) {
if (e && !e[Richfaces.TreeSelectEvent] &&
!Richfaces.eventIsSynthetic(e)) {
if (e && e.type == "mousedown" /* can be keydown */) {
- if(Event.isLeftClick(e)) {
+ if((this.tree.rightClickSelection && Event.isRightClick(e)) ||
Event.isLeftClick(e)) {
var src = Event.element(e);
if(src.tagName &&
/^(input|select|option|button|textarea)$/i.test(src.tagName))
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 2009-02-26
15:43:16 UTC (rev 12761)
+++
trunk/ui/tree/src/main/resources/org/richfaces/renderkit/html/scripts/tree.js 2009-02-26
16:04:24 UTC (rev 12762)
@@ -84,6 +84,7 @@
this.toggleOnClick = options.toggleOnClick;
this.showConnectingLines = options.showConnectingLines;
this.disableKeyboardNavigation = options.disableKeyboardNavigation;
+ this.rightClickSelection = options.rightClickSelection;
var options = Object.extend({
columnCount: 0