[richfaces-svn-commits] JBoss Rich Faces SVN: r280 - in trunk/richfaces/dropdown-menu/src/main: resources/org/richfaces/renderkit/html/scripts and 1 other directory.
richfaces-svn-commits at lists.jboss.org
richfaces-svn-commits at lists.jboss.org
Thu Apr 5 08:56:58 EDT 2007
Author: d.bulahov
Date: 2007-04-05 08:56:57 -0400 (Thu, 05 Apr 2007)
New Revision: 280
Modified:
trunk/richfaces/dropdown-menu/src/main/java/org/richfaces/renderkit/html/DropDownMenuRendererBase.java
trunk/richfaces/dropdown-menu/src/main/resources/org/richfaces/renderkit/html/scripts/menu.js
Log:
Development. Has added "hideDelay" functional in javascript
Modified: trunk/richfaces/dropdown-menu/src/main/java/org/richfaces/renderkit/html/DropDownMenuRendererBase.java
===================================================================
--- trunk/richfaces/dropdown-menu/src/main/java/org/richfaces/renderkit/html/DropDownMenuRendererBase.java 2007-04-05 09:24:16 UTC (rev 279)
+++ trunk/richfaces/dropdown-menu/src/main/java/org/richfaces/renderkit/html/DropDownMenuRendererBase.java 2007-04-05 12:56:57 UTC (rev 280)
@@ -137,7 +137,7 @@
function.addParameter(component.getAttributes().get("hideDelay"));
}
else{
- function.addParameter("null");
+ function.addParameter(""+300);
}
function.appendScript(buffer);
if (component instanceof UIMenuGroup) {
Modified: trunk/richfaces/dropdown-menu/src/main/resources/org/richfaces/renderkit/html/scripts/menu.js
===================================================================
--- trunk/richfaces/dropdown-menu/src/main/resources/org/richfaces/renderkit/html/scripts/menu.js 2007-04-05 09:24:16 UTC (rev 279)
+++ trunk/richfaces/dropdown-menu/src/main/resources/org/richfaces/renderkit/html/scripts/menu.js 2007-04-05 12:56:57 UTC (rev 280)
@@ -212,11 +212,11 @@
setLMTO: function (ratio) {
if(!ratio){
- ratio = 1;
+ ratio = this.timeoutLength;
}
if (this.useTimeouts) {
clearTimeout(this.timeoutFlag);
- this.timeoutFlag = setTimeout('Exadel.Menu.Layers.shutdown()', this.timeoutLength * ratio);
+ this.timeoutFlag = setTimeout('Exadel.Menu.Layers.shutdown()', ratio);
}
},
@@ -237,7 +237,7 @@
this.shutdown();
this.detectWidth();
this.LMPopUp(menuName, false);
- this.setLMTO(4);
+ this.setLMTO(4*this.timeoutLength);
}
};
@@ -569,67 +569,6 @@
Exadel.Menu.Layer = Class.create();
-Exadel.Menu.Layer.mouseover =
- function(e){
- Exadel.Menu.MouseIn=true;
- Exadel.Menu.Layers.clearLMTO();
- Event.stop(e);
- }.bindAsEventListener();
-
-Exadel.Menu.Layer.mouseout =
- function(e){
- Exadel.Menu.MouseIn = false;
- if (!Exadel.Menu.selectOpen) {
- Exadel.Menu.Layers.setLMTO();
- }
- Event.stop(e);
- }.bindAsEventListener();
-
-Exadel.Menu.Layer.openSelect = function(event){
- Exadel.Menu.selectOpen = true;
- var ClickInput = Exadel.Menu.Layer.ClickInput.bindAsEventListener(this);
- Event.observe(Event.element(event), "click", Exadel.Menu.Layer.ClickInput);
-
-}
-Exadel.Menu.Layer.closeSelect = function(event){
- Exadel.Menu.selectOpen = false;
-
- var ClickInput = Exadel.Menu.Layer.ClickInput.bindAsEventListener(this);
- Event.stopObserving(Event.element(event), "click", Exadel.Menu.Layer.ClickInput);
- if (Exadel.Menu.MouseIn == false){
- Exadel.Menu.Layers.setLMTO();
- }
-}
-
-Exadel.Menu.Layer.OnKeyPress = function(event){
-
- if(event.keyCode==13){
- Exadel.Menu.Layers.setLMTO();
- }
-}
-
-
-Exadel.Menu.Layer.MouseoverInInput = function(event){
-//alert("event rabotaet "+ event.target);
-var ClickInput = Exadel.Menu.Layer.ClickInput.bindAsEventListener(this);
-Event.observe(Event.element(event), "click", Exadel.Menu.Layer.ClickInput);
-
-
-}
-
-Exadel.Menu.Layer.ClickInput = function(event){
- //alert("event rabotaet dsds ");
- Event.stop(event || window.event);
- return false;
-}
-
-Exadel.Menu.Layer.MouseoutInInput = function(event){
- var ClickInput = Exadel.Menu.Layer.ClickInput.bindAsEventListener(this);
- Event.stopObserving(Event.element(event), "click", Exadel.Menu.Layer.ClickInput);
-
-}
-
-
Exadel.Menu.Layer.prototype = {
initialize: function(id,delay, hideDelay){
Exadel.Menu.Layers.listl.push(id);
@@ -637,84 +576,154 @@
this.layer = $(id);
this.level = 0;
this.delay = delay;
+ if (hideDelay){
+ this.hideDelay=hideDelay;
+ }
+ else{
+ this.hideDelay=hideDelay;
+ }
Exadel.Menu.fitLayerToContent(this.layer);
this.items = new Array();
Exadel.Menu.Layers.layers[id] = this;
this.bindings = new Array();
+
+
+ this.mouseover =
+ function(e){
+ Exadel.Menu.MouseIn=true;
+ Exadel.Menu.Layers.clearLMTO();
+ Event.stop(e);
+ }.bindAsEventListener(this);
+
+ this.mouseout =
+ function(e){
+ Exadel.Menu.MouseIn = false;
+ if (!Exadel.Menu.selectOpen) {
+ Exadel.Menu.Layers.setLMTO(this.hideDelay);
+ }
+ Event.stop(e);
+ }.bindAsEventListener(this);
+
+
+
var binding = new Exadel.Menu.Layer.Binding (
this.id,
"mouseover",
- Exadel.Menu.Layer.mouseover);
+ this.mouseover);
this.bindings.push(binding);
binding.refresh();
binding = new Exadel.Menu.Layer.Binding (
this.id,
"mouseout",
- Exadel.Menu.Layer.mouseout);
+ this.mouseout);
this.bindings.push(binding);
binding.refresh();
- $A(this.layer.getElementsByTagName("select"))
- .each(
- function(select) {
- Event.observe(select, "focus", Exadel.Menu.Layer.openSelect);
- Event.observe(select, "blur", Exadel.Menu.Layer.closeSelect);
-
- var MouseoverInInput = Exadel.Menu.Layer.MouseoverInInput.bindAsEventListener(this);
- var MouseoutInInput = Exadel.Menu.Layer.MouseoutInInput.bindAsEventListener(this);
- Event.observe(select, "mouseover", MouseoverInInput);
- Event.observe(select, "mouseout", MouseoutInInput);
+ arrayinp=$A(this.layer.getElementsByTagName("select"));
+ for(i=0; i<arrayinp.length; i++){
+ var openSelectb = this.openSelect.bindAsEventListener(this);
+ var closeSelectb = this.closeSelect.bindAsEventListener(this);
+ Event.observe(arrayinp[i], "focus", openSelectb);
+ Event.observe(arrayinp[i], "blur", closeSelectb);
+ //var MouseoverInInputb = Exadel.Menu.Layer.MouseoverInInput.bindAsEventListener(this);
+ var MouseoverInInputb = this.MouseoverInInput.bindAsEventListener(this);
+ //var MouseoutInInputb = Exadel.Menu.Layer.MouseoutInInput.bindAsEventListener(this);
+ var MouseoutInInputb = this.MouseoutInInput.bindAsEventListener(this);
+ Event.observe(arrayinp[i], "mouseover", MouseoverInInputb);
+ Event.observe(arrayinp[i], "mouseout", MouseoutInInputb);
- var OnKeyPress = Exadel.Menu.Layer.OnKeyPress.bindAsEventListener(this);
- Event.observe(select, "keypress", OnKeyPress);
-
- }
- );
+ //var OnKeyPressb = Exadel.Menu.Layer.OnKeyPress.bindAsEventListener(this);
+ var OnKeyPressb = this.OnKeyPress.bindAsEventListener(this);
+ Event.observe(arrayinp[i], "keypress", OnKeyPressb);
+ }
- $A(this.layer.getElementsByTagName("input"))
- .each(
- function(input) {
- //alert("add event");
- Event.observe(input, "focus", Exadel.Menu.Layer.openSelect);
- Event.observe(input, "blur", Exadel.Menu.Layer.closeSelect);
-
-
- var MouseoverInInput = Exadel.Menu.Layer.MouseoverInInput.bindAsEventListener(this);
- var MouseoutInInput = Exadel.Menu.Layer.MouseoutInInput.bindAsEventListener(this);
- Event.observe(input, "mouseover", MouseoverInInput);
- Event.observe(input, "mouseout", MouseoutInInput);
-
- var OnKeyPress = Exadel.Menu.Layer.OnKeyPress.bindAsEventListener(this);
- Event.observe(input, "keypress", OnKeyPress);
-
- }
- );
-
+ arrayinp=$A(this.layer.getElementsByTagName("input"));
+ for(i=0; i<arrayinp.length; i++){
+ var openSelectb = this.openSelect.bindAsEventListener(this);
+ var closeSelectb = this.closeSelect.bindAsEventListener(this);
+ Event.observe(arrayinp[i], "focus", openSelectb);
+ Event.observe(arrayinp[i], "blur", closeSelectb);
+ //var MouseoverInInputb = Exadel.Menu.Layer.MouseoverInInput.bindAsEventListener(this);
+ var MouseoverInInputb = this.MouseoverInInput.bindAsEventListener(this);
+ //var MouseoutInInputb = Exadel.Menu.Layer.MouseoutInInput.bindAsEventListener(this);
+ var MouseoutInInputb = this.MouseoutInInput.bindAsEventListener(this);
+ Event.observe(arrayinp[i], "mouseover", MouseoverInInputb);
+ Event.observe(arrayinp[i], "mouseout", MouseoutInInputb);
+ var OnKeyPressb = this.OnKeyPress.bindAsEventListener(this);
+ Event.observe(arrayinp[i], "keypress", OnKeyPressb);
+ }
- $A(this.layer.getElementsByTagName("textarea"))
- .each(
- function(textarea) {
- Event.observe(textarea, "focus", Exadel.Menu.Layer.openSelect);
- Event.observe(textarea, "blur", Exadel.Menu.Layer.closeSelect);
-
- var MouseoverInInput = Exadel.Menu.Layer.MouseoverInInput.bindAsEventListener(this);
- var MouseoutInInput = Exadel.Menu.Layer.MouseoutInInput.bindAsEventListener(this);
- Event.observe(textarea, "mouseover", MouseoverInInput);
- Event.observe(textarea, "mouseout", MouseoutInInput);
- }
- );
+ arrayinp=$A(this.layer.getElementsByTagName("textarea"));
+ for(i=0; i<arrayinp.length; i++){
+ var openSelectb = this.openSelect.bindAsEventListener(this);
+ var closeSelectb = this.closeSelect.bindAsEventListener(this);
+ Event.observe(arrayinp[i], "focus", openSelectb);
+ Event.observe(arrayinp[i], "blur", closeSelectb);
+ //var MouseoverInInputb = Exadel.Menu.Layer.MouseoverInInput.bindAsEventListener(this);
+ var MouseoverInInputb = this.MouseoverInInput.bindAsEventListener(this);
+ //var MouseoutInInputb = Exadel.Menu.Layer.MouseoutInInput.bindAsEventListener(this);
+ var MouseoutInInputb = this.MouseoutInInput.bindAsEventListener(this);
+ Event.observe(arrayinp[i], "mouseover", MouseoverInInputb);
+ Event.observe(arrayinp[i], "mouseout", MouseoutInInputb);
+ }
-
-
-
-
if(window.A4J && A4J.AJAX ){
var listener = new A4J.AJAX.Listener(this.rebind.bindAsEventListener(this));
A4J.AJAX.AddListener(listener);
}
},
+
+
+
+ openSelect: function(event){
+ Exadel.Menu.selectOpen = true;
+ var ClickInputb = this.ClickInput.bindAsEventListener(this);
+ Event.observe(Event.element(event), "click", this.ClickInput);
+
+ },
+
+
+ closeSelect: function(event){
+ Exadel.Menu.selectOpen = false;
+ var ClickInputb = this.ClickInput.bindAsEventListener(this);
+ Event.stopObserving(Event.element(event), "click", this.ClickInput);
+ if (Exadel.Menu.MouseIn == false){
+ Exadel.Menu.Layers.setLMTO(this.hideDelay);
+ }
+ },
+
+
+
+ OnKeyPress: function(event){
+
+ if(event.keyCode==13){
+ Exadel.Menu.Layers.setLMTO(this.hideDelay);
+ }
+ },
+
+
+ MouseoverInInput: function(event){
+ //alert("event rabotaet "+ event.target);
+ var ClickInputb = this.ClickInput.bindAsEventListener(this);
+ Event.observe(Event.element(event), "click", this.ClickInput);
+ },
+
+
+ ClickInput: function(event){
+ //alert("event rabotaet dsds ");
+ Event.stop(event || window.event);
+ return false;
+ },
+
+
+ MouseoutInInput: function(event){
+ var ClickInputb = this.ClickInput.bindAsEventListener(this);
+ Event.stopObserving(Event.element(event), "click", this.ClickInput);
+
+ },
+
rebind:function(){
$A(this.bindings)
.each(
@@ -864,7 +873,7 @@
var dis = this;
var onmouseout =
function(e){
- Exadel.Menu.Layers.setLMTO();
+ Exadel.Menu.Layers.setLMTO(this.hideDelay);
Exadel.Menu.Layers.clearPopUpTO();
}.bindAsEventListener(this);
@@ -880,7 +889,8 @@
// }
return this;
},
- asSubMenu: function(parent, refLayerName, evtName, options){
+
+ asSubMenu: function(parentv, refLayerName, evtName, options){
this.options = options || {};
if (this.options.onclose != ""){
this.eventOnClose = new Function("event",this.options.onclose).bindAsEventListener(this);
@@ -893,17 +903,29 @@
evtName = 'onmouseover';
}
evtName = this.eventJsToPrototype(evtName);
- this.level = Exadel.Menu.Layers.layers[parent].level + 1;
- Exadel.Menu.Layers.father[this.id] = parent;
+ this.level = Exadel.Menu.Layers.layers[parentv].level + 1;
+ Exadel.Menu.Layers.father[this.id] = parentv;
if(!refLayerName){
- refLayerName = 'ref' + parent;
+ refLayerName = 'ref' + parentv;
}
var refLayer = $(refLayerName);
- this.refItem = Exadel.Menu.Layers.layers[parent].items[refLayerName];
+ this.refItem = Exadel.Menu.Layers.layers[parentv].items[refLayerName];
this.refItem.childMenu = this;
var binding = new Exadel.Menu.Layer.Binding(refLayerName, evtName, this.showMe.bindAsEventListener(this));
this.bindings.push(binding);
binding.refresh();
+
+
+ // set parents hideDelay
+ var menuLayer=this;
+ while (menuLayer.level > 0) {
+ menuLayer = Exadel.Menu.Layers.layers[(Exadel.Menu.Layers.father[menuLayer.id])];
+ }
+ if (menuLayer && menuLayer.hideDelay){
+ this.hideDelay=menuLayer.hideDelay;
+ }
+
+
return this;
},
asContextMenu: function(parent, evt){
@@ -919,7 +941,7 @@
var dis = this;
var onmouseout =
function(e){
- Exadel.Menu.Layers.setLMTO();
+ Exadel.Menu.Layers.setLMTO(this.hideDelay);
Exadel.Menu.Layers.clearPopUpTO();
}.bindAsEventListener(this);
evt = this.eventJsToPrototype(evt);
More information about the richfaces-svn-commits
mailing list