Author: sergeyhalipov
Date: 2007-05-21 08:04:05 -0400 (Mon, 21 May 2007)
New Revision: 818
Modified:
trunk/richfaces/panelmenu/src/main/java/org/richfaces/renderkit/PanelMenuRenderer.java
trunk/richfaces/panelmenu/src/main/resources/org/richfaces/renderkit/html/scripts/panelMenu.js
Log:
Fix expandSingle behaviour.
Modified:
trunk/richfaces/panelmenu/src/main/java/org/richfaces/renderkit/PanelMenuRenderer.java
===================================================================
---
trunk/richfaces/panelmenu/src/main/java/org/richfaces/renderkit/PanelMenuRenderer.java 2007-05-21
11:21:27 UTC (rev 817)
+++
trunk/richfaces/panelmenu/src/main/java/org/richfaces/renderkit/PanelMenuRenderer.java 2007-05-21
12:04:05 UTC (rev 818)
@@ -60,21 +60,15 @@
List flatList = new LinkedList();
Map levels = new HashMap();
- Object singleOpen = component.getAttributes().get("singleOpen");
+ boolean expandSingle = ((UIPanelMenu)component).isExpandSingle();
- if (singleOpen!=null){
- singleOpen = singleOpen.toString();
- } else {
- singleOpen = "false";
- }
-
flatten(component.getChildren(), flatList, levels, 0);
panelMenu
.append("new PanelMenu('")
.append(component.getClientId(context).toString())
.append("',")
- .append(singleOpen.toString())
+ .append(new Boolean(expandSingle).toString())
.append(");\n");
String iconPosition = ((UIPanelMenu)component).getIconItemPosition();
String iconPositionTopLevel = ((UIPanelMenu)component).getIconItemTopPosition();
Modified:
trunk/richfaces/panelmenu/src/main/resources/org/richfaces/renderkit/html/scripts/panelMenu.js
===================================================================
---
trunk/richfaces/panelmenu/src/main/resources/org/richfaces/renderkit/html/scripts/panelMenu.js 2007-05-21
11:21:27 UTC (rev 817)
+++
trunk/richfaces/panelmenu/src/main/resources/org/richfaces/renderkit/html/scripts/panelMenu.js 2007-05-21
12:04:05 UTC (rev 818)
@@ -11,7 +11,7 @@
PanelMenu.prototype = {
initialize: function(myId,so){
this.childObj = new Array();
- this.SingleOpen = so;
+ this.expandSingle = so;
this.lastExpanded = null;
this.is = 'panelMenu';
PanelMenuStorage[myId] = this;}};
@@ -33,6 +33,14 @@
this.childObj = new Array();
this.parentObj = PanelMenuStorage[ids.parentId];
this.parentObj.childObj.push(this);
+ var parent = this.parentObj;
+ while (parent) {
+ if (parent.is && "panelMenu" == parent.is) {
+ this.expandSingle = parent.expandSingle;
+ break;
+ }
+ parent = parent.parentObj;
+ }
this.obj = $(ids.myId);
this.content = this._getDirectChildrenByTag(this.obj,"TD")[level+1];
this.iconAlign = iconAlign;
@@ -60,8 +68,7 @@
}
}
if (opened){
- if (this.parentObj.is=='panelMenu')
- this.parentObj.lastExpanded = this;
+ this.parentObj.lastExpanded = this;
this.expand();
} else {
this.expanded = false;
@@ -157,6 +164,7 @@
form.submit();
}
},
+
itemClicked: function(e){
if(this.action){
if (this.action=='panelMenuNodeAction'){
@@ -170,7 +178,7 @@
this.trigger(e);
}
} else {
- if (this.parentObj.is=='panelMenu'&&this.parentObj.SingleOpen){
+ if (this.parentObj.expandSingle){
if (this.parentObj.lastExpanded!=null){
this.parentObj.lastExpanded.collapse();
}
@@ -206,7 +214,7 @@
this.trigger(e);
}
} else {
- if (this.parentObj.is=='panelMenu'&&this.parentObj.SingleOpen){
+ if (this.parentObj.expandSingle){
if (this.parentObj.lastExpanded!=null){
this.parentObj.lastExpanded.collapse();
}