You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by we...@apache.org on 2006/10/19 15:57:30 UTC
svn commit: r465628 - in /myfaces/tobago/trunk/theme:
scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/script/
standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/
Author: weber
Date: Thu Oct 19 06:57:29 2006
New Revision: 465628
URL: http://svn.apache.org/viewvc?view=rev&rev=465628
Log:
TOBAGO-161 (DblClick on treeFolder should toggle expand state)
Modified:
myfaces/tobago/trunk/theme/scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/script/tree.js
myfaces/tobago/trunk/theme/standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js
myfaces/tobago/trunk/theme/standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tree.js
Modified: myfaces/tobago/trunk/theme/scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/script/tree.js
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/script/tree.js?view=diff&rev=465628&r1=465627&r2=465628
==============================================================================
--- myfaces/tobago/trunk/theme/scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/script/tree.js (original)
+++ myfaces/tobago/trunk/theme/scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/script/tree.js Thu Oct 19 06:57:29 2006
@@ -322,18 +322,7 @@
|| treeResources.getImage("openfoldericon.gif");
this.width = width;
this.childNodes = [];
-// FIXME: page:form
- this.onclick
- = mutable
- ? "storeMarker(this.parentNode, '" + treeHiddenId + "')"
- : selectable
- ? "toggleSelect(this.parentNode, '" + treeHiddenId
- + "', '" + treeResources.getImage("unchecked.gif")
- + "', '" + treeResources.getImage("checked.gif")
- + "')"
- : "Tobago.submitAction('" + id + "')";
- this.onfocus = "storeMarker(this.parentNode, '" + treeHiddenId + "')";
-// this.ondblclick = "toggle(this.parentNode, '" + treeHiddenId + "')";
+ this.onfocus = "storeMarker(this.parentNode, '" + treeHiddenId + "')";
if (this.expanded) {
var hidden = document.getElementById(this.treeHiddenId);
@@ -443,19 +432,16 @@
if (this.marked) {
itemStyle += " tree-item-marker";
}
- if (this.action && !this.disabled) {
- str += '<a class="' + itemStyle + '" href="' + this.action + '" id="'
- + this.id + '-anchor">' + this.label + '</a>';
- } else {
// TODO: mozilla shoud use href="javascript:;" and ie href="#"
- str += '<a class="' + itemStyle + '"';
- if (!this.disabled) {
- str += ' href="#"' + ' onclick="' + this.onclick + '"'
- + ' onfocus="' + this.onfocus + '"';
- }
- str += '>'
- + this.label + '</a>';
+ str += '<a class="' + itemStyle + '"';
+ if (!this.disabled) {
+ str += ' href="' + Tobago.EMPTY_HREF + '"'
+ + ' onclick="Tobago.Tree.onClick(this)"'
+ + ' ondblclick="Tobago.Tree.onDblClick(this)"'
+ + ' onfocus="' + this.onfocus + '"';
}
+ str += '>'
+ + this.label + '</a>';
str += '</div>';
}
if (this.isFolder) {
@@ -523,6 +509,50 @@
this.childNodes[this.childNodes.length] = node;
return node;
};
+
+TreeNode.prototype.onClick = function() {
+ LOG.debug("click on tree;");
+ this.singleClick = true;
+ setTimeout(Tobago.bind(this, "doOnClick"), Tobago.Tree.DBL_CLICK_TIMEOUT);
+}
+
+TreeNode.prototype.doOnClick = function() {
+ if (!this.singleClick) {
+ return;
+ }
+
+ LOG.debug("doClick on tree;");
+ this.singleClick = false;
+ if (this.action && !this.disabled) {
+ // str += '<a class="' + itemStyle + '" href="' + this.action + '" id="'
+ // + this.id + '-anchor">' + this.label + '</a>';
+
+ // not yet supported see TreeNodeRenderer r464525 line 278
+ } else {
+ if (this.mutable) {
+ storeMarker(Tobago.element(this.id), this.treeHiddenId);
+ } else if (this.selectable) {
+ toggleSelect(Tobago.element(this.id),
+ this.treeHiddenId,
+ this.treeResources.getImage("unchecked.gif"),
+ this.treeResources.getImage("checked.gif"));
+ } else {
+ Tobago.submitAction(this.id);
+ }
+
+ }
+}
+
+TreeNode.prototype.onDblClick = function() {
+ LOG.debug("dblclick on tree;");
+ this.singleClick = false;
+ toggle(Tobago.element(this.id),
+ this.treeHiddenId,
+ this.treeResources.getImage("openfoldericon.gif"),
+ this.treeResources.getImage("foldericon.gif"));
+}
+
+
// ////////////////////////////////////////////////// listTree
Modified: myfaces/tobago/trunk/theme/standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js?view=diff&rev=465628&r1=465627&r2=465628
==============================================================================
--- myfaces/tobago/trunk/theme/standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js (original)
+++ myfaces/tobago/trunk/theme/standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js Thu Oct 19 06:57:29 2006
@@ -60,6 +60,8 @@
*/
SUB_COMPONENT_SEP: "::",
+ EMPTY_HREF: window.all ? "#" : "javascript:;",
+
/**
* regexp to find non valid javascript name characters in scriptIds
*/
Modified: myfaces/tobago/trunk/theme/standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tree.js
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tree.js?view=diff&rev=465628&r1=465627&r2=465628
==============================================================================
--- myfaces/tobago/trunk/theme/standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tree.js (original)
+++ myfaces/tobago/trunk/theme/standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tree.js Thu Oct 19 06:57:29 2006
@@ -28,4 +28,20 @@
} catch(ex) {
// ignore
}
+};
+
+Tobago.Tree.onClick = function(element) {
+ var treeNode = Tobago.treeNodes[element.parentNode.id];
+ if (treeNode) {
+ treeNode.onClick();
+ }
+};
+
+Tobago.Tree.DBL_CLICK_TIMEOUT = 300;
+
+Tobago.Tree.onDblClick = function(element) {
+ var treeNode = Tobago.treeNodes[element.parentNode.id];
+ if (treeNode) {
+ treeNode.onDblClick();
+ }
};