Author: pgolawski
Date: 2008-08-01 03:42:16 -0400 (Fri, 01 Aug 2008)
New Revision: 9855
Modified:
trunk/sandbox/ui/extendedDataTable/src/main/java/org/richfaces/renderkit/AbstractExtendedTableRenderer.java
trunk/sandbox/ui/extendedDataTable/src/main/java/org/richfaces/renderkit/html/TableDragDropRenderer.java
trunk/sandbox/ui/extendedDataTable/src/main/templates/org/richfaces/htmlExtendedDataTable.jspx
Log:
fix xml format - add CDATA inside script
Modified:
trunk/sandbox/ui/extendedDataTable/src/main/java/org/richfaces/renderkit/AbstractExtendedTableRenderer.java
===================================================================
---
trunk/sandbox/ui/extendedDataTable/src/main/java/org/richfaces/renderkit/AbstractExtendedTableRenderer.java 2008-08-01
06:20:33 UTC (rev 9854)
+++
trunk/sandbox/ui/extendedDataTable/src/main/java/org/richfaces/renderkit/AbstractExtendedTableRenderer.java 2008-08-01
07:42:16 UTC (rev 9855)
@@ -1640,10 +1640,11 @@
}
}
- public void encodeDragDropChildScripts(FacesContext context,
- UIComponent component) throws IOException {
+ public String encodeDragDropChildScripts(FacesContext context,
+ UIDataTable component) throws IOException {
TableDragDropRenderer.getInstance(context).encodeChildScripts(context,
component);
+ return "";
}
public void encodeNamespace(FacesContext context, UIComponent component)
Modified:
trunk/sandbox/ui/extendedDataTable/src/main/java/org/richfaces/renderkit/html/TableDragDropRenderer.java
===================================================================
---
trunk/sandbox/ui/extendedDataTable/src/main/java/org/richfaces/renderkit/html/TableDragDropRenderer.java 2008-08-01
06:20:33 UTC (rev 9854)
+++
trunk/sandbox/ui/extendedDataTable/src/main/java/org/richfaces/renderkit/html/TableDragDropRenderer.java 2008-08-01
07:42:16 UTC (rev 9855)
@@ -8,16 +8,15 @@
import java.util.regex.Matcher;
import java.util.regex.Pattern;
-import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.context.ResponseWriter;
-import org.ajax4jsf.javascript.JSEncoder;
import org.ajax4jsf.javascript.JSFunction;
import org.ajax4jsf.javascript.JSFunctionDefinition;
import org.ajax4jsf.org.w3c.tidy.EntityTable;
import org.ajax4jsf.renderkit.RendererUtils.HTML;
import org.richfaces.component.UIColumn;
+import org.richfaces.component.UIDataTable;
import org.richfaces.json.JSONException;
import org.richfaces.json.JSONObject;
import org.richfaces.renderkit.DragIndicatorRendererBase;
@@ -77,41 +76,28 @@
* table component
* @throws IOException
*/
- public void encodeChildScripts(FacesContext context, UIComponent component)
+ public void encodeChildScripts(FacesContext context, UIDataTable component)
throws IOException {
// new DragIndicatorRendererBase().encodeChildScripts(context,
// component);
new DragIndicatorRendererBase() {
public void encodeChildScripts(FacesContext context,
- UIComponent component) throws IOException {
+ UIDataTable component) throws IOException {
+
+ ResponseWriter responseWriter = context.getResponseWriter();
+ responseWriter.write("\nvar elt = $(\""+
component.getBaseClientId(context) +":dataTable_indicator\");\n");
+ responseWriter.write("elt.markers = {};\n");
+ responseWriter.write("elt.indicatorTemplates = {};\n");
+
super.encodeChildScripts(context, component);
// redefine DEFAULT marker to be like REJECT marker
- ResponseWriter responseWriter = context.getResponseWriter();
+
responseWriter.write("elt.markers['" + DEFAULT +
"'] = \"");
responseWriter.write(getPredefinedMarker(context, REJECT));
responseWriter.write("\";\n");
+ responseWriter.write("createDragIndicator(elt, '',
'');\n");
+
}
-
- protected String getPredefinedMarker(FacesContext context, Object facetName)
{
- if (MARKERS_PREDEFINED.contains(facetName)) {
- StringBuffer buff = new StringBuffer();
- JSEncoder encoder = new JSEncoder();
- String source = "<img alt='' border='0'
width='16' height='16' src='" +
- getResource("/org/richfaces/renderkit/html/images/" + facetName +
".gif").getUri(context, null) +"' />";
- char chars[] = source.toString().toCharArray();
- for (int i = 0; i < chars.length; i++) {
- char c = chars[i];
- if (!encoder.compile(c)) {
- buff.append(encoder.encode(c));
- } else {
- buff.append(c);
- }
- }
- return buff.toString();
- }
-
- throw new IllegalArgumentException("No predefined marker with [" +
facetName + "] name exists!");
- }
}.encodeChildScripts(context, component);
}
Modified:
trunk/sandbox/ui/extendedDataTable/src/main/templates/org/richfaces/htmlExtendedDataTable.jspx
===================================================================
---
trunk/sandbox/ui/extendedDataTable/src/main/templates/org/richfaces/htmlExtendedDataTable.jspx 2008-08-01
06:20:33 UTC (rev 9854)
+++
trunk/sandbox/ui/extendedDataTable/src/main/templates/org/richfaces/htmlExtendedDataTable.jspx 2008-08-01
07:42:16 UTC (rev 9855)
@@ -56,11 +56,9 @@
<f:call name="encodeNamespace" />
<script type="text/javascript">
- var elt = $("#{clientId}:dataTable_indicator");
- elt.markers = {};
- elt.indicatorTemplates = {};
- <f:call name="encodeDragDropChildScripts" />
- createDragIndicator(elt, '', '');
+ //<![CDATA[
+ #{this:encodeDragDropChildScripts(context, component)};
+ //]]>
</script>
</div>
<span id="#{clientId}:dataTable_indicator_span" />