Author: Alex.Kolonitsky
Date: 2011-01-12 07:53:23 -0500 (Wed, 12 Jan 2011)
New Revision: 20963
Modified:
trunk/examples/output-demo/src/main/webapp/qunit/panelMenu.xhtml
trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractPanelMenu.java
trunk/ui/output/ui/src/main/java/org/richfaces/component/UIPanelMenuGroup.java
trunk/ui/output/ui/src/main/java/org/richfaces/component/UIPanelMenuItem.java
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/PanelMenuGroupRenderer.java
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/PanelMenuItemRenderer.java
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/panelMenuGroup.js
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/panelMenuItem.js
Log:
RF-9928: panelMenu: "selectable" groups problems
Modified: trunk/examples/output-demo/src/main/webapp/qunit/panelMenu.xhtml
===================================================================
--- trunk/examples/output-demo/src/main/webapp/qunit/panelMenu.xhtml 2011-01-12 12:35:17
UTC (rev 20962)
+++ trunk/examples/output-demo/src/main/webapp/qunit/panelMenu.xhtml 2011-01-12 12:53:23
UTC (rev 20963)
@@ -59,7 +59,7 @@
itemChangeListener="#{modalPanel.itemChangeEventListener}"
- <pn:panelMenuGroup label="Group 1">
+ <pn:panelMenuGroup label="Group 1"
selectable="true">
<pn:panelMenuItem>Item 1.1</pn:panelMenuItem>
<pn:panelMenuItem>Item 1.2</pn:panelMenuItem>
<pn:panelMenuItem>Item 1.3</pn:panelMenuItem>
Modified: trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractPanelMenu.java
===================================================================
---
trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractPanelMenu.java 2011-01-12
12:35:17 UTC (rev 20962)
+++
trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractPanelMenu.java 2011-01-12
12:53:23 UTC (rev 20963)
@@ -197,8 +197,8 @@
return getItem(itemName, this);
}
- private static AbstractPanelMenuItem getItem(String itemName, UIComponent comp) {
- if (comp instanceof AbstractPanelMenu) {
+ private AbstractPanelMenuItem getItem(String itemName, UIComponent comp) {
+ if (this != comp && comp instanceof AbstractPanelMenu) {
return null;
}
Modified: trunk/ui/output/ui/src/main/java/org/richfaces/component/UIPanelMenuGroup.java
===================================================================
---
trunk/ui/output/ui/src/main/java/org/richfaces/component/UIPanelMenuGroup.java 2011-01-12
12:35:17 UTC (rev 20962)
+++
trunk/ui/output/ui/src/main/java/org/richfaces/component/UIPanelMenuGroup.java 2011-01-12
12:53:23 UTC (rev 20963)
@@ -43,6 +43,11 @@
}
@Override
+ public Boolean isSelectable() {
+ return (Boolean) getStateHelper().eval(UIPanelMenuItem.PropertyKeys.selectable,
Boolean.FALSE);
+ }
+
+ @Override
public PanelMenuMode getMode() {
return (PanelMenuMode) getStateHelper().eval(UIPanelMenuItem.PropertyKeys.mode,
getPanelMenu().getGroupMode());
}
Modified: trunk/ui/output/ui/src/main/java/org/richfaces/component/UIPanelMenuItem.java
===================================================================
---
trunk/ui/output/ui/src/main/java/org/richfaces/component/UIPanelMenuItem.java 2011-01-12
12:35:17 UTC (rev 20962)
+++
trunk/ui/output/ui/src/main/java/org/richfaces/component/UIPanelMenuItem.java 2011-01-12
12:53:23 UTC (rev 20963)
@@ -32,6 +32,9 @@
public class UIPanelMenuItem extends AbstractPanelMenuItem {
public enum PropertyKeys {
+ selectable,
+ unselectable,
+
mode,
label,
name,
@@ -44,6 +47,22 @@
render
}
+ public Boolean isSelectable() {
+ return (Boolean) getStateHelper().eval(PropertyKeys.selectable, Boolean.TRUE);
+ }
+
+ public void setSelectable(Boolean selectable) {
+ getStateHelper().put(PropertyKeys.selectable, selectable);
+ }
+
+ public Boolean isUnselectable() {
+ return (Boolean) getStateHelper().eval(PropertyKeys.unselectable,
Boolean.FALSE);
+ }
+
+ public void setUnselectable(Boolean unselectable) {
+ getStateHelper().put(PropertyKeys.unselectable, unselectable);
+ }
+
public PanelMenuMode getMode() {
return (PanelMenuMode) getStateHelper().eval(PropertyKeys.mode,
getPanelMenu().getItemMode());
}
Modified:
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/PanelMenuGroupRenderer.java
===================================================================
---
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/PanelMenuGroupRenderer.java 2011-01-12
12:35:17 UTC (rev 20962)
+++
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/PanelMenuGroupRenderer.java 2011-01-12
12:53:23 UTC (rev 20963)
@@ -160,6 +160,8 @@
options.put("expandSingle", panelMenuGroup.isExpandSingle());
options.put("bubbleSelection", panelMenuGroup.isBubbleSelection());
options.put("expanded", panelMenuGroup.isExpanded());
+ options.put("selectable", panelMenuGroup.isSelectable());
+ options.put("unselectable", panelMenuGroup.isUnselectable());
addEventOption(context, panelMenuGroup, options, COLLAPSE);
addEventOption(context, panelMenuGroup, options, EXPAND);
Modified:
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/PanelMenuItemRenderer.java
===================================================================
---
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/PanelMenuItemRenderer.java 2011-01-12
12:35:17 UTC (rev 20962)
+++
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/PanelMenuItemRenderer.java 2011-01-12
12:53:23 UTC (rev 20963)
@@ -152,6 +152,8 @@
options.put("disabled", panelMenuItem.isDisabled());
options.put("mode", panelMenuItem.getMode());
options.put("name", panelMenuItem.getName());
+ options.put("selectable", panelMenuItem.isSelectable());
+ options.put("unselectable", panelMenuItem.isUnselectable());
addEventOption(context, panelMenuItem, options, UNSELECT);
addEventOption(context, panelMenuItem, options, SELECT);
Modified:
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/panelMenuGroup.js
===================================================================
---
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/panelMenuGroup.js 2011-01-12
12:35:17 UTC (rev 20962)
+++
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/panelMenuGroup.js 2011-01-12
12:53:23 UTC (rev 20963)
@@ -120,14 +120,13 @@
* @param {Hash} options - params
* */
init : function (componentId, options) {
- $super.constructor.call(this, componentId);
- this.options = $.extend(this.options, __DEFAULT_OPTIONS, options || {});
+ $super.constructor.call(this, componentId, $.extend({}, __DEFAULT_OPTIONS,
options || {}));
if (!this.options.disabled) {
var menuGroup = this;
if (!this.options.selectable) {
- //TODO nick - this can be replaced by jQuery.delegate on menu itself
+ //TODO nick - this can be replaced by jQuery.delegate on menu itself
this.__header().bind("click", function () {
return menuGroup.switchExpantion();
});
@@ -248,6 +247,10 @@
*
* */
onCompleteHandler : function () {
+ if (this.options.selectable) {
+ $super.onCompleteHandler.call(this);
+ }
+
EXPAND_ITEM.execClient(this, this.expanded());
},
@@ -341,14 +344,14 @@
},
__fireCollapse : function () {
- //TODO nick - 'new' should be removed
+ //TODO nick - 'new' should be removed
return new rf.Event.fireById(this.id, "collapse", {
id: this.id
});
},
__fireExpand : function () {
- //TODO nick - 'new' should be removed
+ //TODO nick - 'new' should be removed
return new rf.Event.fireById(this.id, "expand", {
id: this.id
});
Modified:
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/panelMenuItem.js
===================================================================
---
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/panelMenuItem.js 2011-01-12
12:35:17 UTC (rev 20962)
+++
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/panelMenuItem.js 2011-01-12
12:53:23 UTC (rev 20963)
@@ -28,9 +28,9 @@
var __DEFAULT_OPTIONS = {
disabled : false,
selectable: true,
- mode: "client",
unselectable: false,
highlight: true,
+ mode: "client",
stylePrefix: "rf-pm-itm",
itemStep: 20
};