Author: a.izobov
Date: 2007-05-21 11:06:42 -0400 (Mon, 21 May 2007)
New Revision: 824
Modified:
trunk/richfaces/dropdown-menu/src/main/resources/org/richfaces/renderkit/html/css/dropdownmenu.xcss
trunk/richfaces/dropdown-menu/src/main/resources/org/richfaces/renderkit/html/scripts/menu.js
trunk/richfaces/dropdown-menu/src/main/templates/org/richfaces/htmlDropDownMenu.jspx
Log:
RF-190,159,141 fixed
Modified:
trunk/richfaces/dropdown-menu/src/main/resources/org/richfaces/renderkit/html/css/dropdownmenu.xcss
===================================================================
---
trunk/richfaces/dropdown-menu/src/main/resources/org/richfaces/renderkit/html/css/dropdownmenu.xcss 2007-05-21
14:51:49 UTC (rev 823)
+++
trunk/richfaces/dropdown-menu/src/main/resources/org/richfaces/renderkit/html/css/dropdownmenu.xcss 2007-05-21
15:06:42 UTC (rev 824)
@@ -19,16 +19,16 @@
background : url(menu_list_bg.gif) repeat-y left;
}
.dr-menu-label {
+ left: 0px;
+ top: 0px;
padding : 2px 5px 2px 5px;
white-space : nowrap;
- position: relative;
width : auto;
- height : 100%;
+ height : auto;
}
.dr-menu-label-unselect {
- border : 1px solid transparent;
- _border-color:tomato;/*For IE6-*/
- _filter:chroma(color=tomato);/*For IE6-*/
+ border : 0px solid transparent;
+ padding : 3px 6px;
}
.dr-menu-label-select {
border : 1px solid #bfbfc0;
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-05-21
14:51:49 UTC (rev 823)
+++
trunk/richfaces/dropdown-menu/src/main/resources/org/richfaces/renderkit/html/scripts/menu.js 2007-05-21
15:06:42 UTC (rev 824)
@@ -27,6 +27,14 @@
} // if
}
+Exadel.Menu.removePx = function(e) {
+ if ((e+"").indexOf("px")!=-1)
+ return (e+"").substring(0,e.length-2);
+ else
+ return e;
+}
+
+
Exadel.Menu.Layers = {
listl: new Array(),
father: {},
@@ -126,17 +134,16 @@
//alert(navigator.userAgent);
if(this.IE || this.NS) {
menuName = $(menuName).id;
+ var menu = $(menuName);
var iframe = $(menuName + "_iframe");
var nsfix = (this.NS ? 7 : 0);
if(on){
- Position.clone(menuName, iframe);
- var dim = Element.getDimensions(iframe);
- iframe.style.top = (iframe.style.pixelTop + Math.round(this.CornerRadius / 2)) +
"px";
- iframe.style.left = (iframe.offsetLeft) + "px";
- iframe.style.width = (dim.width - this.shadowWidth - nsfix) + "px";
+ var dim = Element.getDimensions(menu);
+ iframe.style.top = menu.style.top;
+ iframe.style.left = menu.style.left;
+ iframe.style.width = menu.offsetWidth + "px"
+ iframe.style.height = menu.offsetHeight + "px"
iframe.style.visibility = "visible";
- iframe.style.height = (dim.height - this.CornerRadius - 1 - this.shadowWidth - nsfix)
+ "px";
-
} else {
iframe.style.visibility = "hidden";
}
@@ -195,7 +202,7 @@
} // if
tmpLayer.style.visibility = 'hidden';
- tmpLayer.style.left = "-"+tmpLayer.clientWidth;
+// tmpLayer.style.left = "-"+tmpLayer.clientWidth;
// Element.hide(tmpLayer);
} // else
},
@@ -461,8 +468,14 @@
// screenOffset[1] = 0;
// }
var screenOffset = Position.positionedOffset(this.element);
+ var innerDiv = this.element.lastChild;
var dim = Element.getDimensions(this.element);
-
+
+ var parOffset = Position.cumulativeOffset(this.element);
+ var divOffset = Position.cumulativeOffset(innerDiv);
+ var deltaX = divOffset[0] - parOffset[0];
+ var deltaY = divOffset[1] - parOffset[1];
+
// parent element
this.top = screenOffset[1];
this.left = screenOffset[0];
@@ -510,8 +523,10 @@
if (!foundPos) {
layerPos = this.calcPosition(listPos[0].jointPoint, listPos[0].direction)
}
- this.layer.style.left = layerPos.left + hOffset - this.left + "px";
- this.layer.style.top = layerPos.top + vOffset - this.top + "px";
+ this.layer.style.left = layerPos.left + hOffset - deltaX - this.left + "px";
+ this.layer.style.top = layerPos.top + vOffset - deltaY - this.top + "px";
+
+ this.layer.style.width = this.layer.clientWidth + "px";
Exadel.Menu.Layers.LMPopUp(this.layer.id, false);
Exadel.Menu.Layers.clearLMTO();
@@ -531,9 +546,10 @@
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) &&
+ Exadel.Menu.Layers.isVisible(Exadel.Menu.Layers.father[this.layer.id])) {
+ this.reposition();
+ Exadel.Menu.Layers.LMPopUp(this.layer, false);
}
}.bind(this);
}
@@ -544,9 +560,10 @@
var windowWidth = body.width;
var scrolls = {top:0, left:0};
var screenOffset = Position.positionedOffset(this.element);
- var screenOffsetParent =
Position.positionedOffset(this.element.parentNode.parentNode);
- screenOffset[0]+=screenOffsetParent[0];
- screenOffset[1]+=screenOffsetParent[1];
+ var leftPx = Exadel.Menu.removePx(this.element.parentNode.parentNode.style.left);
+ var topPx = Exadel.Menu.removePx(this.element.parentNode.parentNode.style.top);
+ screenOffset[0]+=Number(leftPx);
+ screenOffset[1]+=Number(topPx);
var cumulativeOffset = Position.cumulativeOffset(this.element);
var labelOffset = [cumulativeOffset[0] - screenOffset[0], cumulativeOffset[1] -
screenOffset[1]];
var dim = Element.getDimensions(this.element);
@@ -562,7 +579,7 @@
dir = options.direction.toUpperCase().indexOf('LEFT')!=-1?1:dir;
dir = options.direction.toUpperCase().indexOf('RIGHT')!=-1?2:dir;
}
-
+
var layerLeft = right;
var layerTop = top;
@@ -629,6 +646,9 @@
this.layer.style.left = layerLeft + "px";
this.layer.style.top = layerTop + "px";
+
+ this.layer.style.width = this.layer.clientWidth + "px";
+
}
/**
* set to true when a dropdown box inside menu receives focus
@@ -663,7 +683,7 @@
Exadel.Menu.MouseIn=true;
Exadel.Menu.Layers.clearLMTO();
- var menuNode = this.layer.parentNode;
+ var menuNode = this.layer.parentNode.parentNode;
menuNode.className='dr-menu-label dr-menu-label-select rich-ddmenu-label
rich-ddmenu-label-select';
Event.stop(e);
@@ -675,7 +695,7 @@
if (!Exadel.Menu.selectOpen) {
Exadel.Menu.Layers.setLMTO(this.hideDelay);
}
- var menuNode = this.layer.parentNode;
+ var menuNode = this.layer.parentNode.parentNode;
menuNode.className='dr-menu-label dr-menu-label-unselect
rich-ddmenu-label rich-ddmenu-label-unselect';
Event.stop(e);
@@ -829,15 +849,15 @@
closeMinors: function(id){
//LOG.a4j_debug('closeMinors ' + this.id +' ' +this.level);
var item = this.items[id];
- if(!item.childMenu){
+// if(!item.childMenu){
//LOG.a4j_debug('hiding menus ' + this.id +' ' +this.level);
- for(var i = this.level + 1; i < Exadel.Menu.Layers.levels.length; i++){
+ for(var i = this.level + (!item.childMenu?1:2); i <
Exadel.Menu.Layers.levels.length; i++){
if(Exadel.Menu.Layers.levels[i]) {
//LOG.a4j_debug('hide ' +Exadel.Menu.Layers.levels[i]);
Exadel.Menu.Layers.levels[i].hideMe();
}
}
- }
+// }
if (item.menu.refItem) {
item.menu.refItem.highLightGroup(true);
}
Modified:
trunk/richfaces/dropdown-menu/src/main/templates/org/richfaces/htmlDropDownMenu.jspx
===================================================================
---
trunk/richfaces/dropdown-menu/src/main/templates/org/richfaces/htmlDropDownMenu.jspx 2007-05-21
14:51:49 UTC (rev 823)
+++
trunk/richfaces/dropdown-menu/src/main/templates/org/richfaces/htmlDropDownMenu.jspx 2007-05-21
15:06:42 UTC (rev 824)
@@ -14,7 +14,7 @@
<h:scripts>
new org.ajax4jsf.framework.resource.PrototypeScript(),
new org.ajax4jsf.framework.ajax.AjaxScript(),
- scripts/menu.js
+ scripts/menu.js
</h:scripts>
<f:clientid var="clientId"/>
@@ -42,9 +42,11 @@
<![CDATA[}]]>
</jsp:scriptlet>
+ <div style="margin: 0px; padding: 0px; border: 0px; position:
relative;">
<vcp:body>
<f:call name="renderChildren" />
</vcp:body>
+ </div>
</div>