Author: sergeyhalipov
Date: 2008-03-26 15:58:30 -0400 (Wed, 26 Mar 2008)
New Revision: 7278
Modified:
trunk/ui/modal-panel/src/main/config/component/modalPanel.xml
trunk/ui/modal-panel/src/main/java/org/richfaces/component/UIModalPanel.java
trunk/ui/modal-panel/src/main/java/org/richfaces/renderkit/ModalPanelRendererBase.java
trunk/ui/modal-panel/src/main/templates/org/richfaces/htmlModalPanel.jspx
Log:
http://jira.jboss.com/jira/browse/RF-2464
Modified: trunk/ui/modal-panel/src/main/config/component/modalPanel.xml
===================================================================
--- trunk/ui/modal-panel/src/main/config/component/modalPanel.xml 2008-03-26 19:45:31 UTC
(rev 7277)
+++ trunk/ui/modal-panel/src/main/config/component/modalPanel.xml 2008-03-26 19:58:30 UTC
(rev 7278)
@@ -166,7 +166,7 @@
<defaultvalue>false</defaultvalue>
</property>
- <property el="true">
+ <property>
<name>visualOptions</name>
<classname>java.lang.Object</classname>
<description>Defines options that were specified on the client
side</description>
Modified: trunk/ui/modal-panel/src/main/java/org/richfaces/component/UIModalPanel.java
===================================================================
---
trunk/ui/modal-panel/src/main/java/org/richfaces/component/UIModalPanel.java 2008-03-26
19:45:31 UTC (rev 7277)
+++
trunk/ui/modal-panel/src/main/java/org/richfaces/component/UIModalPanel.java 2008-03-26
19:58:30 UTC (rev 7278)
@@ -46,7 +46,7 @@
public static final String COMPONENT_FAMILY = "org.richfaces.ModalPanel";
- private Map<String, String> visualOptions;
+ private Map<String, Object> visualOptions;
/**
* Shadow depth.
@@ -146,7 +146,7 @@
}
if (null == this.visualOptions) {
- this.visualOptions = new HashMap<String, String>();
+ this.visualOptions = new HashMap<String, Object>();
}
return this.visualOptions;
}
@@ -185,18 +185,18 @@
}
}
- protected Map<String, String> prepareVisualOptions(Object value) {
+ protected Map<String, Object> prepareVisualOptions(Object value) {
if (null == value) {
- return new HashMap<String, String>();
+ return new HashMap<String, Object>();
} else if (value instanceof Map) {
- return (Map<String, String>) value;
+ return (Map<String, Object>) value;
} else if (value instanceof String) {
String s = (String) value;
if (!s.startsWith("{")) {
s = "{" + s + "}";
}
try {
- return new HashMap<String, String>(new JSONMap(s));
+ return new HashMap<String, Object>(new JSONMap(s));
} catch (JSONException e) {
throw new FacesException(e);
}
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-03-26
19:45:31 UTC (rev 7277)
+++
trunk/ui/modal-panel/src/main/java/org/richfaces/renderkit/ModalPanelRendererBase.java 2008-03-26
19:58:30 UTC (rev 7278)
@@ -29,6 +29,7 @@
import javax.faces.component.UIComponent;
import javax.faces.context.ExternalContext;
import javax.faces.context.FacesContext;
+import javax.faces.context.ResponseWriter;
import org.ajax4jsf.javascript.ScriptUtils;
import org.ajax4jsf.renderkit.ComponentVariables;
@@ -69,7 +70,7 @@
if (null != clnId) {
panel.setShowWhenRendered(new Boolean((String) clnId).booleanValue());
- Map<String, String> visualOptions = (Map<String, String>)
panel.getVisualOptions();
+ Map<String, Object> visualOptions = (Map<String, Object>)
panel.getVisualOptions();
Iterator<Entry<String, String>> it = rqMap.entrySet().iterator();
while ( it.hasNext()) {
Map.Entry<String, String> entry = it.next();
@@ -144,12 +145,11 @@
StringBuffer result = new StringBuffer();
if (panel.isKeepVisualState() || panel.isShowWhenRendered()) {
- result.append("Event.observe(window, \"load\", function() {");
result.append("Richfaces.showModalPanel('" + panel.getClientId(context)
+ "', {");
- Iterator<Map.Entry<String, String>> it = ((Map<String, String>)
panel.getVisualOptions()).entrySet().iterator();
+ Iterator<Map.Entry<String, Object>> it = ((Map<String, Object>)
panel.getVisualOptions()).entrySet().iterator();
while (it.hasNext()) {
- Map.Entry<String, String> entry = it.next();
+ Map.Entry<String, Object> entry = it.next();
result.append(entry.getKey() + ": '" + entry.getValue() +
"'");
if (it.hasNext()) {
@@ -157,7 +157,7 @@
}
}
- result.append("});}.bind());");
+ result.append("});");
}
return result.toString();
}
@@ -166,4 +166,24 @@
RendererUtils.writeEventHandlerFunction(context, component, eventName);
}
+ public void writeVisualOptions(FacesContext context, UIModalPanel panel)
+ throws IOException {
+ StringBuffer result = new StringBuffer();
+ ResponseWriter writer = context.getResponseWriter();
+
+ Iterator<Map.Entry<String, Object>> it = ((Map<String, Object>)
panel.getVisualOptions()).entrySet().iterator();
+ if (it.hasNext()) {
+ result.append(",\n");
+ }
+ while (it.hasNext()) {
+ Map.Entry<String, Object> entry = it.next();
+
+ result.append(entry.getKey() + ": '" + entry.getValue() +
"'");
+ if (it.hasNext()) {
+ result.append(",\n");
+ }
+ }
+
+ writer.writeText(result, null);
+ }
}
Modified: trunk/ui/modal-panel/src/main/templates/org/richfaces/htmlModalPanel.jspx
===================================================================
--- trunk/ui/modal-panel/src/main/templates/org/richfaces/htmlModalPanel.jspx 2008-03-26
19:45:31 UTC (rev 7277)
+++ trunk/ui/modal-panel/src/main/templates/org/richfaces/htmlModalPanel.jspx 2008-03-26
19:58:30 UTC (rev 7278)
@@ -183,7 +183,9 @@
showWhenRendered: #{component.showWhenRendered},
selectBehavior: "#{component.tridentIVEngineSelectBehavior}",
- autosized: #{component.autosized}
+ autosized: #{component.autosized}
+
+ <f:call name="writeVisualOptions" />
});
</script>
</div>