Author: dmorozov
Date: 2008-08-14 08:17:45 -0400 (Thu, 14 Aug 2008)
New Revision: 10092
Modified:
trunk/ui/modal-panel/src/main/java/org/richfaces/renderkit/ModalPanelRendererBase.java
Log:
https://jira.jboss.org/jira/browse/RF-2466
Modified:
trunk/ui/modal-panel/src/main/java/org/richfaces/renderkit/ModalPanelRendererBase.java
===================================================================
---
trunk/ui/modal-panel/src/main/java/org/richfaces/renderkit/ModalPanelRendererBase.java 2008-08-14
12:11:18 UTC (rev 10091)
+++
trunk/ui/modal-panel/src/main/java/org/richfaces/renderkit/ModalPanelRendererBase.java 2008-08-14
12:17:45 UTC (rev 10092)
@@ -64,11 +64,17 @@
UIModalPanel panel = (UIModalPanel)component;
ExternalContext exCtx = context.getExternalContext();
Map<String, String> rqMap = exCtx.getRequestParameterMap();
- Object clnId = rqMap.get(panel.getClientId(context) + "OpenedState");
+ Object panelOpenState = rqMap.get(panel.getClientId(context) +
"OpenedState");
if (panel.isKeepVisualState()) {
- if (null != clnId) {
- panel.setShowWhenRendered(Boolean.parseBoolean((String) clnId));
+ if (null != panelOpenState) {
+ // Bug
https://jira.jboss.org/jira/browse/RF-2466
+ // Incorrect old:
+ // panel.setShowWhenRendered(Boolean.parseBoolean((String) clnId));
+ // ShowWhenRendered can be settled separately with modal panel
"showWhenRendered" attribute
+ // so we should combine ShowWhenRendered || KeepVisualState &&
(OpenedState==TRUE) against rewriting
+ boolean showWhenRendered = panel.isShowWhenRendered() ||
Boolean.parseBoolean((String) panelOpenState);
+ panel.setShowWhenRendered(showWhenRendered);
Map<String, Object> visualOptions = (Map<String, Object>)
panel.getVisualOptions();
Iterator<Entry<String, String>> it = rqMap.entrySet().iterator();
@@ -83,7 +89,7 @@
}
}
}
-
+
protected Class getComponentClass() {
return UIModalPanel.class;
}
@@ -144,7 +150,10 @@
public String getShowScript(FacesContext context, UIModalPanel panel) {
StringBuffer result = new StringBuffer();
- if (panel.isKeepVisualState() || panel.isShowWhenRendered()) {
+ // Bug
https://jira.jboss.org/jira/browse/RF-2466
+ // We are already processed KeepVisualState and current open state in
+ // doDecode, so no need to check panel.isKeepVisualState() here.
+ if (/*panel.isKeepVisualState() || */panel.isShowWhenRendered()) {
result.append("Richfaces.showModalPanel('" + panel.getClientId(context)
+ "', {");
Iterator<Map.Entry<String, Object>> it = ((Map<String, Object>)
panel.getVisualOptions()).entrySet().iterator();