Author: Alex.Kolonitsky
Date: 2011-01-19 07:26:33 -0500 (Wed, 19 Jan 2011)
New Revision: 21078
Modified:
trunk/examples/output-demo/src/main/webapp/qunit/panelMenu.xhtml
trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractPanelMenuGroup.java
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/panelMenuGroup.js
Log:
RF-10159: Panel Menu - @itemMode, @groupMode attributes has not effect
RF-10174: PanelMenu: JS error on page unload
Modified: trunk/examples/output-demo/src/main/webapp/qunit/panelMenu.xhtml
===================================================================
--- trunk/examples/output-demo/src/main/webapp/qunit/panelMenu.xhtml 2011-01-19 12:23:59
UTC (rev 21077)
+++ trunk/examples/output-demo/src/main/webapp/qunit/panelMenu.xhtml 2011-01-19 12:26:33
UTC (rev 21078)
@@ -57,6 +57,8 @@
topItemDisableIconLeft="disc"
topGroupDisableIconLeft="disc"
itemChangeListener="#{modalPanel.itemChangeEventListener}"
+ expandEvent="dblclick"
+ collapseEvent="dblclick"
<pn:panelMenuGroup label="Group 1"
selectable="true">
Modified:
trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractPanelMenuGroup.java
===================================================================
---
trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractPanelMenuGroup.java 2011-01-19
12:23:59 UTC (rev 21077)
+++
trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractPanelMenuGroup.java 2011-01-19
12:26:33 UTC (rev 21078)
@@ -161,12 +161,35 @@
@Attribute(defaultValue = "getPanelMenu().isExpandSingle()")
public abstract boolean isExpandSingle();
- @Attribute(defaultValue = "click")
- public abstract String getCollapseEvent();
+ @Attribute(generate = false)
+ public String getCollapseEvent() {
+ String value = (String) getStateHelper().eval(Properties.collapseEvent);
+ if (value != null) {
+ return value;
+ }
- @Attribute(defaultValue = "click")
- public abstract String getExpandEvent();
+ return getPanelMenu().getCollapseEvent();
+ }
+ public void setCollapseEvent(String collapseEvent) {
+ getStateHelper().put(Properties.collapseEvent, collapseEvent);
+ }
+
+
+ @Attribute(generate = false)
+ public String getExpandEvent() {
+ String value = (String) getStateHelper().eval(Properties.expandEvent);
+ if (value != null) {
+ return value;
+ }
+
+ return getPanelMenu().getExpandEvent();
+ }
+
+ public void setExpandEvent(String expandEvent) {
+ getStateHelper().put(Properties.expandEvent, expandEvent);
+ }
+
@Attribute(defaultValue = "getPanelMenu().isBubbleSelection()")
public abstract boolean isBubbleSelection();
@@ -176,7 +199,7 @@
// ------------------------------------------------ Html Attributes
enum Properties {
- iconLeftDisabled, iconLeftExpanded, iconRightCollapsed, iconRightDisabled,
iconRightExpanded, disabledClass, styleClass, iconLeftCollapsed
+ iconLeftDisabled, iconLeftExpanded, iconRightCollapsed, iconRightDisabled,
iconRightExpanded, disabledClass, styleClass, expandEvent, collapseEvent,
iconLeftCollapsed
}
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-19
12:23:59 UTC (rev 21077)
+++
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/panelMenuGroup.js 2011-01-19
12:26:33 UTC (rev 21078)
@@ -30,6 +30,8 @@
expandSingle : true,
bubbleSelection : true,
stylePrefix : "rf-pm-gr",
+ expandEvent: "click",
+ collapseEvent: "click",
// TODO we should use selectionType = {none, selectable, unselectable}
selectable : false,
@@ -127,9 +129,24 @@
if (!this.options.selectable) {
//TODO nick - this can be replaced by jQuery.delegate on menu itself
- this.__header().bind("click", function () {
- return menuGroup.switchExpantion();
- });
+ if (this.options.expandEvent == this.options.collapseEvent) {
+ this.__header().bind(this.options.expandEvent, function () {
+ menuGroup.switchExpantion();
+ });
+
+ } else {
+ this.__header().bind(this.options.expandEvent, function () {
+ if (menuGroup.collapsed()) {
+ return menuGroup.expand();
+ }
+ });
+
+ this.__header().bind(this.options.collapseEvent, function () {
+ if (menuGroup.expanded()) {
+ return menuGroup.collapse();
+ }
+ });
+ }
}
if (this.options.selectable || this.options.bubbleSelection) {