[richfaces-svn-commits] JBoss Rich Faces SVN: r335 - 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
Tue Apr 10 07:20:28 EDT 2007
Author: a.izobov
Date: 2007-04-10 07:20:28 -0400 (Tue, 10 Apr 2007)
New Revision: 335
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:
event support(onmouseout and onmouseover) for menuGroup and menuItem changed
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-10 11:02:40 UTC (rev 334)
+++ trunk/richfaces/dropdown-menu/src/main/java/org/richfaces/renderkit/html/DropDownMenuRendererBase.java 2007-04-10 11:20:28 UTC (rev 335)
@@ -193,11 +193,16 @@
flcloseonclick=0;
}
if(itemId != null){
- buffer
- .append(".addItem('")
- .append(itemId)
- .append("',")
- .append(flcloseonclick+")");
+ function = new JSFunction("addItem");
+ function.addParameter(itemId);
+ function.addParameter(new Integer(flcloseonclick));
+
+ ScriptOptions options = new ScriptOptions(kid);
+ options.addOption("onmouseout", kid.getAttributes().get("onmouseout"));
+ options.addOption("onmouseover", kid.getAttributes().get("onmouseover"));
+ function.addParameter(options);
+ buffer.append('.');
+ function.appendScript(buffer);
}
}
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-10 11:02:40 UTC (rev 334)
+++ trunk/richfaces/dropdown-menu/src/main/resources/org/richfaces/renderkit/html/scripts/menu.js 2007-04-10 11:20:28 UTC (rev 335)
@@ -194,6 +194,8 @@
} // if
tmpLayer.style.visibility = 'hidden';
+ tmpLayer.style.left = "-"+tmpLayer.clientWidth;
+// Element.hide(tmpLayer);
} // else
},
@@ -459,7 +461,7 @@
this.bottom = this.top + dim.height;
this.right = this.left + dim.width;
-
+
this.layerdim = Element.getDimensions(this.layer);
var options = Exadel.Menu.Layers.layers[this.layer.id].options;
@@ -518,9 +520,9 @@
this.layer = $(layer);
this.show = function() {
- if (!Exadel.Menu.Layers.isVisible(this.layer)){
- this.reposition();
- Exadel.Menu.Layers.LMPopUp(this.layer, false);
+ if (!Exadel.Menu.Layers.isVisible(this.layer)){
+ this.reposition();
+ Exadel.Menu.Layers.LMPopUp(this.layer, false);
}
}.bind(this);
}
@@ -815,68 +817,73 @@
},
//addItem: function(itemId, hoverClass, plainClass, hoverStyle, plainStyle){
- addItem: function(itemId, flag_close_onclick){
+ addItem: function(itemId, flag_close_onclick, options) {
var dis = this;
var item = {};
- //item.hoverClass = hoverClass;// = hoverClass.split(" ");
- //item.plainClass = plainClass;//.split(" ");
- //if (hoverStyle) item.hoverStyle = Exadel.extractCamelizedRules(hoverStyle);
- //if (plainStyle) item.plainStyle = Exadel.extractCamelizedRules(plainStyle);
item.id = itemId;
item.obj = $(itemId);
item.menu = this;
+ item.options = options || {};
+ if (item.options.onmouseover != ""){
+ item.eventOnMouseOver = new Function("event",item.options.onmouseover).bindAsEventListener(item);
+ }
+ if (item.options.onmouseout != ""){
+ item.eventOnMouseOut = new Function("event",item.options.onmouseout).bindAsEventListener(item);
+ }
this.items[itemId] = item;
+
var onmouseover =
function(e){
- //if (this.hoverClass) $(this.id).className = this.hoverClass;
- //if(this.hoverStyle) {
- // Exadel.replaceStyleHash($(this.id), this.plainStyle, this.hoverStyle);
- //}
this.menu.closeMinors(this.id);
+ if (this.eventOnMouseOver) {
+ var reltg = (e.relatedTarget) ? e.relatedTarget : e.fromElement;
+ while (reltg && reltg != this.obj && reltg.nodeName != 'BODY')
+ reltg = reltg.parentNode;
+ if (reltg == this.obj) return;
+ this.eventOnMouseOver();
+ }
}.bindAsEventListener(item);
- //var onmouseout =
- // function(e){
- //if (this.plainClass) $(this.id).className = this.plainClass;
- //if(this.hoverStyle) {
- // Exadel.replaceStyleHash($(this.id), this.hoverStyle, this.plainStyle);
- //}
- // }.bindAsEventListener(item);
+
+ var onmouseout =
+ function(e){
+ if (this.eventOnMouseOut) {
+ var reltg = (e.relatedTarget) ? e.relatedTarget : e.toElement;
+ while (reltg && reltg != this.obj && reltg.nodeName != 'BODY')
+ reltg = reltg.parentNode;
+ if (reltg == this.obj) return;
+ this.eventOnMouseOut();
+ }
+ }.bindAsEventListener(item);
var onmouseclick =
function(e){
-
- var menuLayer = item.menu;
- //if (menuLayer.level>0) {
+ var menuLayer = item.menu;
while (menuLayer.level > 0) {
menuLayer = Exadel.Menu.Layers.layers[(Exadel.Menu.Layers.father[menuLayer.id])];
}
if (menuLayer && menuLayer.eventOnItemSelect) menuLayer.eventOnItemSelect();
- //}
-
- Exadel.Menu.Layers.shutdown();
+ Exadel.Menu.Layers.shutdown();
}.bindAsEventListener(item);
-
var binding = new Exadel.Menu.Layer.Binding (
item.id,
"mouseover",
onmouseover);
-
this.bindings.push(binding);
binding.refresh();
- //binding = new Exadel.Menu.Layer.Binding (
- // item.id,
- // "mouseout",
- // onmouseout);
- //this.bindings.push(binding);
- //binding.refresh();
- if (flag_close_onclick==1){
binding = new Exadel.Menu.Layer.Binding (
item.id,
- "click",
- onmouseclick);
+ "mouseout",
+ onmouseout);
this.bindings.push(binding);
binding.refresh();
+ if (flag_close_onclick==1){
+ binding = new Exadel.Menu.Layer.Binding (
+ item.id,
+ "click",
+ onmouseclick);
+ this.bindings.push(binding);
+ binding.refresh();
}
return this;
More information about the richfaces-svn-commits
mailing list