Author: Alex.Kolonitsky
Date: 2010-09-02 10:37:25 -0400 (Thu, 02 Sep 2010)
New Revision: 19097
Modified:
trunk/examples/output-demo/src/main/webapp/examples/collapsiblePanel.xhtml
trunk/examples/output-demo/src/main/webapp/qunit/accordionHeaders.xhtml
trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractCollapsiblePanel.java
trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractTogglePanel.java
trunk/ui/output/ui/src/main/java/org/richfaces/component/html/HtmlCollapsiblePanel.java
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TogglePanelRenderer.java
trunk/ui/output/ui/src/main/resources/META-INF/pn.taglib.xml
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/AccordionItem.js
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/CollapsiblePanel.js
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/TogglePanel.js
Log:
RF-9274 Accordion rendered wrong in IE8
Modified: trunk/examples/output-demo/src/main/webapp/examples/collapsiblePanel.xhtml
===================================================================
--- trunk/examples/output-demo/src/main/webapp/examples/collapsiblePanel.xhtml 2010-09-02
13:15:31 UTC (rev 19096)
+++ trunk/examples/output-demo/src/main/webapp/examples/collapsiblePanel.xhtml 2010-09-02
14:37:25 UTC (rev 19097)
@@ -28,15 +28,6 @@
</pn:collapsiblePanel>
</h:form>
-
- <p>Result</p>
- <div>
- <ol id="qunit-tests"></ol>
-
- <div id="testDiv" style="margin-top:10px; border:1px solid
#a0a0a0">Main Test Div</div>
-
- </div>
- <h:outputScript name="tests/richfaces-collapsible-panel-qunit.js"
/>
</ui:define>
</ui:composition>
</body>
Modified: trunk/examples/output-demo/src/main/webapp/qunit/accordionHeaders.xhtml
===================================================================
--- trunk/examples/output-demo/src/main/webapp/qunit/accordionHeaders.xhtml 2010-09-02
13:15:31 UTC (rev 19096)
+++ trunk/examples/output-demo/src/main/webapp/qunit/accordionHeaders.xhtml 2010-09-02
14:37:25 UTC (rev 19097)
@@ -42,6 +42,27 @@
content 3
</pn:accordionItem>
</pn:accordion>
+
+ <h:outputLink>
+ <pn:toggleControl targetPanel="panel"
targetItem="@first" event="click"/>
+ |< first
+ </h:outputLink>
+ |
+ <h:outputLink>
+ <pn:toggleControl targetPanel="panel"
targetItem="@prev" event="click"/>
+ <- prev
+ </h:outputLink>
+ |
+ <h:outputLink>
+ <pn:toggleControl targetPanel="panel"
targetItem="@next" event="click"/>
+ next ->
+ </h:outputLink>
+ |
+ <h:outputLink>
+ <pn:toggleControl targetPanel="panel"
targetItem="@last" event="click"/>
+ last >|
+ </h:outputLink>
+
</h:form>
<p>Result</p>
Modified:
trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractCollapsiblePanel.java
===================================================================
---
trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractCollapsiblePanel.java 2010-09-02
13:15:31 UTC (rev 19096)
+++
trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractCollapsiblePanel.java 2010-09-02
14:37:25 UTC (rev 19097)
@@ -22,12 +22,15 @@
package org.richfaces.component;
+import org.richfaces.event.ChangeExpandEvent;
+import org.richfaces.event.ChangeExpandListener;
+import org.richfaces.event.ChangeExpandSource;
+import org.richfaces.event.ItemChangeEvent;
+
import javax.el.MethodExpression;
import javax.faces.component.UIComponent;
+import javax.faces.event.FacesEvent;
-import org.richfaces.event.ChangeExpandSource;
-import org.richfaces.event.ChangeExpandListener;
-
/**
* @author akolonitsky
* @since 2010-08-27
@@ -81,9 +84,18 @@
public abstract MethodExpression getChangeExpandListener();
-
+ @Override
+ public void queueEvent(FacesEvent facesEvent) {
+ ChangeExpandEvent event = null;
+ if ((facesEvent instanceof ItemChangeEvent) && (facesEvent.getComponent()
== this)) {
+ event = new ChangeExpandEvent(this, Boolean.valueOf(((ItemChangeEvent)
facesEvent).getNewItem()));
+ setEventPhase(event);
+ }
+ super.queueEvent(event != null ? event : facesEvent);
+ }
+
// ------------------------------------------------ Event Processing Methods
public void addChangeExpandListener(ChangeExpandListener listener) {
Modified:
trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractTogglePanel.java
===================================================================
---
trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractTogglePanel.java 2010-09-02
13:15:31 UTC (rev 19096)
+++
trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractTogglePanel.java 2010-09-02
14:37:25 UTC (rev 19097)
@@ -383,18 +383,23 @@
@Override
public void queueEvent(FacesEvent event) {
if ((event instanceof ItemChangeEvent) && (event.getComponent() == this))
{
- if (isImmediate()) {
- event.setPhaseId(PhaseId.APPLY_REQUEST_VALUES);
- } else if (isBypassUpdates()) {
- event.setPhaseId(PhaseId.PROCESS_VALIDATIONS);
- } else {
- event.setPhaseId(PhaseId.INVOKE_APPLICATION);
- }
+ setEventPhase(event);
}
super.queueEvent(event);
}
+ protected void setEventPhase(FacesEvent event) {
+ if (isImmediate()) {
+ event.setPhaseId(PhaseId.APPLY_REQUEST_VALUES);
+ } else if (isBypassUpdates()) {
+ event.setPhaseId(PhaseId.PROCESS_VALIDATIONS);
+ } else {
+ event.setPhaseId(PhaseId.INVOKE_APPLICATION);
+ }
+ }
+
+
@Override
public void broadcast(FacesEvent event) throws AbortProcessingException {
super.broadcast(event);
Modified:
trunk/ui/output/ui/src/main/java/org/richfaces/component/html/HtmlCollapsiblePanel.java
===================================================================
---
trunk/ui/output/ui/src/main/java/org/richfaces/component/html/HtmlCollapsiblePanel.java 2010-09-02
13:15:31 UTC (rev 19096)
+++
trunk/ui/output/ui/src/main/java/org/richfaces/component/html/HtmlCollapsiblePanel.java 2010-09-02
14:37:25 UTC (rev 19097)
@@ -40,8 +40,8 @@
public static final String COMPONENT_FAMILY =
"org.richfaces.CollapsiblePanel";
private static final Collection<String> EVENT_NAMES =
Collections.unmodifiableCollection(Arrays.asList(
- "onswitch",
- "onbeforeswitch",
+ "switch",
+ "beforeswitch",
"click",
"dblclick",
"mousedown",
@@ -58,8 +58,8 @@
headerControlClass,
oncomplete,
onbeforedomupdate,
- ononswitch,
- ononbeforeswitch,
+ onswitch,
+ onbeforeswitch,
lang,
title,
style,
@@ -123,20 +123,20 @@
getStateHelper().put(PropertyKeys.onbeforedomupdate, onbeforedomupdate);
}
- public String getOnonswitch() {
- return (String) getStateHelper().eval(PropertyKeys.ononswitch);
+ public String getOnswitch() {
+ return (String) getStateHelper().eval(PropertyKeys.onswitch);
}
- public void setOnonswitch(String ononswitch) {
- getStateHelper().put(PropertyKeys.ononswitch, ononswitch);
+ public void setOnswitch(String onswitch) {
+ getStateHelper().put(PropertyKeys.onswitch, onswitch);
}
- public String getOnonbeforeswitch() {
- return (String) getStateHelper().eval(PropertyKeys.ononbeforeswitch);
+ public String getOnbeforeswitch() {
+ return (String) getStateHelper().eval(PropertyKeys.onbeforeswitch);
}
- public void setOnonbeforeswitch(String ononbeforeswitch) {
- getStateHelper().put(PropertyKeys.ononbeforeswitch, ononbeforeswitch);
+ public void setOnbeforeswitch(String onbeforeswitch) {
+ getStateHelper().put(PropertyKeys.onbeforeswitch, onbeforeswitch);
}
public String getLang() {
Modified:
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TogglePanelRenderer.java
===================================================================
---
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TogglePanelRenderer.java 2010-09-02
13:15:31 UTC (rev 19096)
+++
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TogglePanelRenderer.java 2010-09-02
14:37:25 UTC (rev 19097)
@@ -159,7 +159,7 @@
HandlersChain handlersChain = new HandlersChain(context, component);
handlersChain.addInlineHandlerFromAttribute(ON + eventName);
handlersChain.addBehaviors(eventName);
- handlersChain.addAjaxSubmitFunction();
+// handlersChain.addAjaxSubmitFunction();
String handler = handlersChain.toScript();
if (handler != null) {
Modified: trunk/ui/output/ui/src/main/resources/META-INF/pn.taglib.xml
===================================================================
--- trunk/ui/output/ui/src/main/resources/META-INF/pn.taglib.xml 2010-09-02 13:15:31 UTC
(rev 19096)
+++ trunk/ui/output/ui/src/main/resources/META-INF/pn.taglib.xml 2010-09-02 14:37:25 UTC
(rev 19097)
@@ -132,12 +132,12 @@
</attribute>
<attribute>
<description></description>
- <name>ononswitch</name>
+ <name>onswitch</name>
<type>java.lang.String</type>
</attribute>
<attribute>
<description></description>
- <name>ononbeforeswitch</name>
+ <name>onbeforeswitch</name>
<type>java.lang.String</type>
</attribute>
<attribute>
Modified:
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/AccordionItem.js
===================================================================
---
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/AccordionItem.js 2010-09-02
13:15:31 UTC (rev 19096)
+++
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/AccordionItem.js 2010-09-02
14:37:25 UTC (rev 19097)
@@ -41,7 +41,14 @@
this.index = options["index"];
this.getTogglePanel().getItems()[this.index] = this;
- rf.Event.bindById(this.id + ":header", "click",
this.__onHeaderClick, this)
+ rf.Event.bindById(this.id + ":header", "click",
this.__onHeaderClick, this);
+
+ if (this.isSelected()) {
+ var item = this;
+ $(this.togglePanelId).ready(function () {
+ item.__fitToHeight(item.getTogglePanel());
+ });
+ }
},
/***************************** Public Methods
****************************************************************/
@@ -83,15 +90,8 @@
__enter : function () {
var parentPanel = this.getTogglePanel();
if (parentPanel.isKeepHeight) {
- this.__content().hide();
- var h = parentPanel.getInnerHeight();
-
- var items = parentPanel.getItems();
- for (var i = 0; i < items.length; i++) {
- h -= items[i].__header().outerHeight();
- }
-
- this.__content().height(h - 20); // 20 it is padding top and bottom
+ this.__content().hide(); // TODO ?
+ this.__fitToHeight(parentPanel);
}
this.__content().show();
@@ -101,6 +101,17 @@
return this.__fireEnter();
},
+ __fitToHeight : function (parentPanel) {
+ var h = parentPanel.getInnerHeight();
+
+ var items = parentPanel.getItems();
+ for (var i = 0; i < items.length; i++) {
+ h -= items[i].__header().outerHeight();
+ }
+
+ this.__content().height(h - 20); // 20 it is padding top and bottom
+ },
+
getHeight : function (recalculate) {
if (recalculate || !this.__height) {
this.__height = $(rf.getDomElement(this.id)).outerHeight(true)
Modified:
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/CollapsiblePanel.js
===================================================================
---
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/CollapsiblePanel.js 2010-09-02
13:15:31 UTC (rev 19096)
+++
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/CollapsiblePanel.js 2010-09-02
14:37:25 UTC (rev 19097)
@@ -40,6 +40,9 @@
rf.ui.TogglePanel.call(this, componentId, options);
this.switchMode = options.switchMode;
+ this.__addUserEventHandler("beforeswitch");
+ this.__addUserEventHandler("switch");
+
this.items = [
new RichFaces.ui.CollapsiblePanelItem(
this.id + ":content", {"index":0,
"togglePanelId":this.id, "switchMode":this.switchMode,
"name":"true"}),
Modified:
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/TogglePanel.js
===================================================================
---
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/TogglePanel.js 2010-09-02
13:15:31 UTC (rev 19096)
+++
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/TogglePanel.js 2010-09-02
14:37:25 UTC (rev 19097)
@@ -159,12 +159,16 @@
this.options = options;
this.activeItem = this.options.activeItem;
this.items = this.options.items;
+
+ this.__addUserEventHandler("itemchange");
+ this.__addUserEventHandler("beforeitemchange");
},
- /***************************** Public Methods
********************************************************************/
+ /***************************** Public Methods
****************************************************************/
/**
* @methodOf
+ *
* @name TogglePanel#getSelectItem
*
* @return {String} name of current selected panel item
@@ -360,6 +364,16 @@
/**
* @private
+ * */
+ __addUserEventHandler : function (name) {
+ var handler = this.options["on" + name];
+ if (handler) {
+ rf.Event.bindById(this.id, name, handler);
+ }
+ },
+
+ /**
+ * @private
* @param {Number} index - array index
*
* @return {TogglePanelItem}