Author: Alex.Kolonitsky
Date: 2010-11-02 10:21:54 -0400 (Tue, 02 Nov 2010)
New Revision: 19890
Modified:
trunk/examples/output-demo/src/main/webapp/examples/collapsiblePanel.xhtml
trunk/ui/output/ui/src/main/java/org/richfaces/component/UITogglePanel.java
trunk/ui/output/ui/src/main/java/org/richfaces/component/UITogglePanelItem.java
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/CollapsiblePanelRenderer.java
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
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/TogglePanelItem.js
Log:
RF-9562 collapsiblePanel: expanded attribute problems
RF-9434 collapsiblePanel: seems no way to define initial state
Modified: trunk/examples/output-demo/src/main/webapp/examples/collapsiblePanel.xhtml
===================================================================
--- trunk/examples/output-demo/src/main/webapp/examples/collapsiblePanel.xhtml 2010-11-02
14:03:56 UTC (rev 19889)
+++ trunk/examples/output-demo/src/main/webapp/examples/collapsiblePanel.xhtml 2010-11-02
14:21:54 UTC (rev 19890)
@@ -15,7 +15,7 @@
<p>Page</p>
<h:form id="f">
- <pn:collapsiblePanel id="panel">
+ <pn:collapsiblePanel id="panel1" expanded="false"
switchType="server">
<f:facet name="headerExpanded" >
header exanded
</f:facet>
@@ -23,10 +23,34 @@
header collapsed
</f:facet>
- Hello!!!
+ Hello Server!!!
</pn:collapsiblePanel>
+ <pn:collapsiblePanel id="panel2" expanded="false"
switchType="ajax">
+ <f:facet name="headerExpanded" >
+ header exanded
+ </f:facet>
+ <f:facet name="headerCollapsed" >
+ header collapsed
+ </f:facet>
+
+ Hello Ajax!!!
+
+ </pn:collapsiblePanel>
+
+ <pn:collapsiblePanel id="panel3" expanded="false"
switchType="client">
+ <f:facet name="headerExpanded" >
+ header exanded
+ </f:facet>
+ <f:facet name="headerCollapsed" >
+ header collapsed
+ </f:facet>
+
+ Hello client!!!
+
+ </pn:collapsiblePanel>
+
</h:form>
</ui:define>
</ui:composition>
Modified: trunk/ui/output/ui/src/main/java/org/richfaces/component/UITogglePanel.java
===================================================================
--- trunk/ui/output/ui/src/main/java/org/richfaces/component/UITogglePanel.java 2010-11-02
14:03:56 UTC (rev 19889)
+++ trunk/ui/output/ui/src/main/java/org/richfaces/component/UITogglePanel.java 2010-11-02
14:21:54 UTC (rev 19890)
@@ -43,7 +43,8 @@
}
public SwitchType getSwitchType() {
- return (SwitchType) getStateHelper().eval(PropertyKeys.switchType,
SwitchType.DEFAULT);
+ SwitchType type = (SwitchType) getStateHelper().eval(PropertyKeys.switchType,
SwitchType.DEFAULT);
+ return type == null ? SwitchType.DEFAULT : type;
}
public void setSwitchType(SwitchType switchType) {
Modified: trunk/ui/output/ui/src/main/java/org/richfaces/component/UITogglePanelItem.java
===================================================================
---
trunk/ui/output/ui/src/main/java/org/richfaces/component/UITogglePanelItem.java 2010-11-02
14:03:56 UTC (rev 19889)
+++
trunk/ui/output/ui/src/main/java/org/richfaces/component/UITogglePanelItem.java 2010-11-02
14:21:54 UTC (rev 19890)
@@ -44,7 +44,9 @@
}
public SwitchType getSwitchType() {
- return (SwitchType) getStateHelper().eval(PropertyKeys.switchType,
getParent().getSwitchType());
+ SwitchType type = (SwitchType) getStateHelper().eval(PropertyKeys.switchType,
getParent().getSwitchType());
+
+ return type == null ? SwitchType.DEFAULT : type;
}
public void setSwitchType(SwitchType switchType) {
Modified:
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/CollapsiblePanelRenderer.java
===================================================================
---
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/CollapsiblePanelRenderer.java 2010-11-02
14:03:56 UTC (rev 19889)
+++
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/CollapsiblePanelRenderer.java 2010-11-02
14:21:54 UTC (rev 19890)
@@ -77,8 +77,7 @@
String compClientId = component.getClientId(context);
String clientId = requestMap.get(compClientId);
if (clientId != null && clientId.equals(compClientId)) {
- String itemClientId = clientId + (Boolean.parseBoolean(newValue) ?
":content" : ":empty");
- context.getPartialViewContext().getRenderIds().add(itemClientId);
+ context.getPartialViewContext().getRenderIds().add(clientId);
//TODO nick - this should be done on encode, not on decode
addOnCompleteParam(newValue, panel.getClientId());
@@ -191,7 +190,7 @@
break;
case ajax:
- context.getResponseWriter().write(getPlaceHolder(panel.getClientId()
+ ":empty"));
+ writer.write(getPlaceHolder(panel.getClientId() +
":empty"));
break;
case server:
@@ -212,7 +211,8 @@
writer.startElement("div", component);
writer.writeAttribute("id", component.getClientId() +
":content", null);
writer.writeAttribute("class", concatClasses("rf-cp-b",
attributeAsString(component, "bodyClass")), null);
- writer.writeAttribute("style", concatStyles(visible ? "" :
"none", attributeAsString(component, "style")), null);
+ writer.writeAttribute("style",
concatStyles(styleElement("display", visible ? "block" :
"none"),
+ attributeAsString(component,
"style")), null);
renderChildren(context, component);
@@ -223,7 +223,7 @@
writer.startElement("div", component);
writer.writeAttribute("id", component.getClientId() +
":empty", null);
writer.writeAttribute("class", "rf-cp-empty", null);
- writer.writeAttribute("style", styleElement("display",
visible ? "" : "none"), null);
+ writer.writeAttribute("style", styleElement("display",
visible ? "block" : "none"), null);
writer.endElement("div");
}
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-11-02
14:03:56 UTC (rev 19889)
+++
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/CollapsiblePanel.js 2010-11-02
14:21:54 UTC (rev 19890)
@@ -77,11 +77,6 @@
id: this.id,
isExpanded : newItem.getName()
});
- },
-
-
- destroy: function () {
- rf.ui.TogglePanel.destroy.call(this);
}
});
})(jQuery, RichFaces);
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-11-02
14:03:56 UTC (rev 19889)
+++
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/TogglePanel.js 2010-11-02
14:21:54 UTC (rev 19890)
@@ -424,7 +424,7 @@
},
destroy: function () {
- rf.BaseComponent.destroy.call(this);
+ rf.BaseComponent.prototype.destroy.call(this);
}
});
})(jQuery, RichFaces);
Modified:
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/TogglePanelItem.js
===================================================================
---
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/TogglePanelItem.js 2010-11-02
14:03:56 UTC (rev 19889)
+++
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/TogglePanelItem.js 2010-11-02
14:21:54 UTC (rev 19890)
@@ -111,7 +111,7 @@
// class stuff
destroy: function () {
- rf.ui.TogglePanelItem.$super.destroy.call(this);
+ rf.BaseComponent.prototype.destroy.call(this);
}
});
})(jQuery, RichFaces);