Author: abelevich
Date: 2007-05-17 14:45:27 -0400 (Thu, 17 May 2007)
New Revision: 792
Added:
trunk/sandbox/scrollable-grid/src/main/templates/org/richfaces/scrollable-grid-cells2.jspx
trunk/sandbox/scrollable-grid/src/main/templates/org/richfaces/scrollable-grid-footer-cell.jspx
trunk/sandbox/scrollable-grid/src/main/templates/org/richfaces/scrollable-grid-header-cell.jspx
trunk/sandbox/scrollable-grid/src/main/templates/org/richfaces/scrollable-grid2.jspx
Modified:
trunk/sandbox/scrollable-grid/src/main/templates/org/richfaces/scrollable-grid-cell.jspx
Log:
Modified:
trunk/sandbox/scrollable-grid/src/main/templates/org/richfaces/scrollable-grid-cell.jspx
===================================================================
---
trunk/sandbox/scrollable-grid/src/main/templates/org/richfaces/scrollable-grid-cell.jspx 2007-05-17
11:15:54 UTC (rev 791)
+++
trunk/sandbox/scrollable-grid/src/main/templates/org/richfaces/scrollable-grid-cell.jspx 2007-05-17
18:45:27 UTC (rev 792)
@@ -11,9 +11,11 @@
component="javax.faces.component.UIComponent"
- <td id="#{client_id}:c_#{cell_id}" class="ClientUI_Grid_BC">
- <span id="#{client_id}:bc_#{cell_id}"
style="#{component.attributes['style']}"
class="ClientUI_Grid_BCBody">
- <vcp:body/>
+ <td class="ClientUI_Grid_BC" id="#{client_id}:c_#{cell_id}">
+ <span style="width: #{component.attributes['width']}"
id="#{client_id}:bc_#{cell_id}" class="ClientUI_Grid_BCBody1">
+ <span class="ClientUI_Grid_FCBody"
id="#{client_id}:bcc_#{cell_id}">
+ <vcp:body/>
+ </span>
</span>
</td>
Added:
trunk/sandbox/scrollable-grid/src/main/templates/org/richfaces/scrollable-grid-cells2.jspx
===================================================================
---
trunk/sandbox/scrollable-grid/src/main/templates/org/richfaces/scrollable-grid-cells2.jspx
(rev 0)
+++
trunk/sandbox/scrollable-grid/src/main/templates/org/richfaces/scrollable-grid-cells2.jspx 2007-05-17
18:45:27 UTC (rev 792)
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<f:root
+
xmlns:f="http://ajax4jsf.org/cdk/template"
+ xmlns:c="
http://java.sun.com/jsf/core"
+ xmlns:ui="
http://ajax4jsf.org/cdk/ui"
+ xmlns:u="
http://ajax4jsf.org/cdk/u"
+ xmlns:x="
http://ajax4jsf.org/cdk/x"
+ xmlns:h="
http://ajax4jsf.org/cdk/headers"
+
xmlns:vcp="http://ajax4jsf.org/cdk/vcp"
+ class="org.richfaces.renderkit.html.ScrollableGridCellRenderer"
+ component="javax.faces.component.UIComponent"
+ >
+ <f:clientId var="clientId" />
+
+ <td id="#{client_id}:c_#{cell_id}" class="ClientUI_Grid_BC">
+ <span id="#{client_id}:bc_#{cell_id}" style="width:
#{component.attributes['width']}" class="ClientUI_Grid_BCBody">
+ <vcp:body/>
+ </span>
+ </td>
+
+</f:root>
\ No newline at end of file
Added:
trunk/sandbox/scrollable-grid/src/main/templates/org/richfaces/scrollable-grid-footer-cell.jspx
===================================================================
---
trunk/sandbox/scrollable-grid/src/main/templates/org/richfaces/scrollable-grid-footer-cell.jspx
(rev 0)
+++
trunk/sandbox/scrollable-grid/src/main/templates/org/richfaces/scrollable-grid-footer-cell.jspx 2007-05-17
18:45:27 UTC (rev 792)
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<f:root
+
xmlns:f="http://ajax4jsf.org/cdk/template"
+ xmlns:c="
http://java.sun.com/jsf/core"
+ xmlns:ui="
http://ajax4jsf.org/cdk/ui"
+ xmlns:u="
http://ajax4jsf.org/cdk/u"
+ xmlns:x="
http://ajax4jsf.org/cdk/x"
+ xmlns:h="
http://ajax4jsf.org/cdk/headers"
+
xmlns:vcp="http://ajax4jsf.org/cdk/vcp"
+ class="org.richfaces.renderkit.html.ScrollableGridFooterCellRenderer"
+ component="javax.faces.component.UIComponent"
+ >
+
+ <td class="ClientUI_Grid_FC">
+ <span style="width: #{component.attributes['width']}"
id="#{client_id}:fc_#{cell_id}" class="ClientUI_Grid_FCBody1">
+ <span class="ClientUI_Grid_FCBody">
+ <vcp:body/>
+ </span>
+ </span>
+ </td>
+
+</f:root>
\ No newline at end of file
Added:
trunk/sandbox/scrollable-grid/src/main/templates/org/richfaces/scrollable-grid-header-cell.jspx
===================================================================
---
trunk/sandbox/scrollable-grid/src/main/templates/org/richfaces/scrollable-grid-header-cell.jspx
(rev 0)
+++
trunk/sandbox/scrollable-grid/src/main/templates/org/richfaces/scrollable-grid-header-cell.jspx 2007-05-17
18:45:27 UTC (rev 792)
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<f:root
+
xmlns:f="http://ajax4jsf.org/cdk/template"
+ xmlns:c="
http://java.sun.com/jsf/core"
+ xmlns:ui="
http://ajax4jsf.org/cdk/ui"
+ xmlns:u="
http://ajax4jsf.org/cdk/u"
+ xmlns:x="
http://ajax4jsf.org/cdk/x"
+ xmlns:h="
http://ajax4jsf.org/cdk/headers"
+
xmlns:vcp="http://ajax4jsf.org/cdk/vcp"
+ class="org.richfaces.renderkit.html.ScrollableGridHeaderCellRenderer"
+ component="javax.faces.component.UIComponent"
+ >
+
+ <td class="ClientUI_Grid_HC" id="#{client_id}hc_#{cell_id}">
+ <span style="width: #{component.attributes['width']}"
id="#{client_id}:hcc_#{cell_id}" class="ClientUI_Grid_HCBody1">
+ <span id="#{clientId}:hcb_#{cell_id}"
class="ClientUI_Grid_HCBody">
+ <table width="100%" cellspacing="0" cellpadding="0"
border="0" align="center">
+ <tbody>
+ <tr>
+ <td width="100%">
+ <span style="width: 100%;">
+ <f:verbatim escape="true">
+ <vcp:body/>
+ </f:verbatim>
+ </span>
+ </td>
+ <td>
+ <span class="sort-desc" />
+ <span class="sort-asc" />
+ </td>
+ </tr>
+ </tbody>
+ </table>
+ </span>
+ </span>
+ <span column="#{cell_index}" id="#{client_id}:hsep_#{cell_id}"
style="left: ${sepOffset - 3}px;" class="ClientUI_Grid_HSep" />
+ </td>
+
+</f:root>
\ No newline at end of file
Added:
trunk/sandbox/scrollable-grid/src/main/templates/org/richfaces/scrollable-grid2.jspx
===================================================================
--- trunk/sandbox/scrollable-grid/src/main/templates/org/richfaces/scrollable-grid2.jspx
(rev 0)
+++
trunk/sandbox/scrollable-grid/src/main/templates/org/richfaces/scrollable-grid2.jspx 2007-05-17
18:45:27 UTC (rev 792)
@@ -0,0 +1,231 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<f:root
+
xmlns:f="http://ajax4jsf.org/cdk/template"
+ xmlns:c="
http://java.sun.com/jsf/core"
+ xmlns:ui="
http://ajax4jsf.org/cdk/ui"
+ xmlns:u="
http://ajax4jsf.org/cdk/u"
+ xmlns:x="
http://ajax4jsf.org/cdk/x"
+ xmlns:h="
http://ajax4jsf.org/cdk/headers"
+
xmlns:vcp="http://ajax4jsf.org/cdk/vcp"
+ class="org.richfaces.renderkit.html.ScrollableGridRenderer"
+ baseclass="org.richfaces.renderkit.html.ScrollableGridBaseRenderer2"
+ component="org.richfaces.component.UIScrollableGrid"
+ >
+
+ <h:styles>
+ /org/richfaces/renderkit/html/css/grid.xcss
+ </h:styles>
+
+ <h:scripts>
+ new org.ajax4jsf.framework.resource.PrototypeScript(),
+ new org.ajax4jsf.framework.ajax.AjaxScript(),
+ /org/richfaces/renderkit/html/scripts/scrollable-grid.js
+ </h:scripts>
+
+ <f:clientId var="clientId" />
+
+ <f:call name="setUpColumnsWidth"/>
+
+ <div id="#{clientId}_GridContainer" style="width:
#{component.attributes['width']};height:
#{component.attributes['height']};" class="ClientUI_Grid">
+
+ <div id="#{clientId}_GridHeaderTemplate"
class="ClientUI_InlineBox" style="width:
#{component.attributes['width']};">
+ <div style="display: block; left: 0px; top: 0px; width:
#{sumWidth}px;">
+ <span class="ClientUI_TmplBox" id="FrozenBox">
+ <table cellpadding="0" cellspacing="0">
+ <tbody>
+ <tr class="ClientUI_Grid_HR">
+ <jsp:scriptlet>
+ <![CDATA[
+ renderHeaders(context, component, true);
+ ]]>
+ </jsp:scriptlet>
+ </tr>
+ </tbody>
+ </table>
+ </span>
+
+ <span class="ClientUI_TmplBox" id="NormalBox">
+ <table cellpadding="0" cellspacing="0">
+ <tbody>
+ <tr class="ClientUI_Grid_HR">
+ <jsp:scriptlet>
+ <![CDATA[
+ renderHeaders(context, component, false);
+ ]]>
+ </jsp:scriptlet>
+ </tr>
+ </tbody>
+ </table>
+ </span>
+ </div>
+ </div>
+
+ <div id="#{clientId}_GridBodyTemplate"
class="ClientUI_InlineBox" style="overflow: auto; width:
#{component.attributes['width']}; height:
#{component.attributes['height']};">
+ <div style="display: block; width: #{sumWidth}px;">
+ <span class="ClientUI_TmplBox" id="FrozenBox">
+ <table cellpadding="0" cellspacing="0">
+ <tbody>
+ <jsp:scriptlet>
+ <![CDATA[
+ renderGridBody(context, component, true);
+ ]]>
+ </jsp:scriptlet>
+ </tbody>
+ </table>
+ </span>
+ <span class="ClientUI_TmplBox" id="NormalBox">
+ <table cellpadding="0" cellspacing="0">
+ <tbody>
+ <jsp:scriptlet>
+ <![CDATA[
+ renderGridBody(context, component, false);
+ ]]>
+ </jsp:scriptlet>
+ </tbody>
+ </table>
+ </span>
+ </div>
+ </div>
+
+ <div id="#{clientId}_GridFooterTemplate"
class="ClientUI_InlineBox" style="width:
#{component.attributes['width']};">
+ <div style="display: block; width: width: #{sumWidth}px;">
+ <span class="ClientUI_TmplBox" id="FrozenBox">
+ <table cellpadding="0" cellspacing="0">
+ <tbody>
+ <tr class="ClientUI_Grid_FR">
+ <jsp:scriptlet>
+ <![CDATA[
+ renderFooters(context, component,true);
+ ]]>
+ </jsp:scriptlet>
+ </tr>
+ </tbody>
+ </table>
+ </span>
+
+ <span class="ClientUI_TmplBox" id="NormalBox">
+ <table cellpadding="0" cellspacing="0">
+ <tbody>
+ <tr class="ClientUI_Grid_FR">
+ <jsp:scriptlet>
+ <![CDATA[
+ renderFooters(context, component,false);
+ ]]>
+ </jsp:scriptlet>
+ </tr>
+ </tbody>
+ </table>
+ </span>
+ </div>
+ </div>
+
+ <input type="hidden" name="#{clientId}_state_input"
id="#{clientId}_state_input"/>
+ <input type="hidden" name="#{clienId}_rows_input"
id="#{clientId}_rows_input" value="#{rows_count}"/>
+ <input type="button" name="#{clientId}_submit_input"
id="#{clientId}_submit_input"
onclick="#{this:getRowsAjaxUpdate(context,component)}"
style="display:none"/>
+
+ </div>
+
+ <f:call name="tearDownState"/>
+
+ <script id="#{clientId}_model_create_scripts"
type="text/javascript">
+ //<![CDATA[
+ ClientUI.controls.grid.FakeArrayDataModel = Class.create({
+ CLASSDEF: {
+ name: 'ClientUI.controls.grid.FakeArrayDataModel',
+ parent: ClientUI.controls.grid.DataModel
+ }
+ });
+
+ Object.extend(ClientUI.controls.grid.FakeArrayDataModel.prototype, {
+ initialize: function(rows_count, columns_count, grid_id) {
+ ClientUI.controls.grid.FakeArrayDataModel.parentClass.constructor().call(this);
+ this.data = [];
+ this.count = rows_count;
+ this.columns = columns_count;
+ this.gridId = grid_id;
+ },
+ getRow: function(index) {
+ if(!this.data[index]) {
+ this.data[index] = [];
+ for (var index2 = 0; index2 < 7; index2++) {
+ this.data[index][index2] = index2 + " : " + index;
+ }
+ this.data[index][6] = index%2 ? "value 1" : "value 2";
+ }
+
+ return this.data[index];
+ },
+ getCount: function() {
+ return this.count;
+ },
+ getRequestDelay: function() {
+ return 50;
+ },
+
+ loadRows: function(options) {
+ var state_options = options;
+ var state_input = $(this.gridId + "_state_input");
+ var submit_input = $(this.gridId + "_submit_input");
+ var submit_values = state_options.count + "," + state_options.index +
"," + state_options.startRow;
+ state_input.value = submit_values;
+ submit_input.click();
+ }
+ });
+ // ]]>
+ </script>
+
+ <script id="#{clientId}_grid_create_scripts"
type="text/javascript">
+ //<![CDATA[
+
+
+ var #{this:getJavaScriptVarName(context, component)} = function() {
+ return {
+ init : function() {
+ var currTime = (new Date()).getTime();
+ // ClientUILib.log(ClientUILogger.WARNING, "Document loaded over " +
(currTime - ClientUILib.startTime) + " miliseconds.");
+ var clientId = '#{clientId}';
+ var rows_count = $(clientId + "_rows_input").value;
+ var columns_count = '#{columns_count}';
+
+ dataModel = new ClientUI.controls.grid.FakeArrayDataModel(rows_count,
columns_count, clientId);
+
+ var templates = [
+ {pane: GridLayout_Enum.HEADER, ref: clientId +"_" +
"GridHeaderTemplate"},
+ {pane: GridLayout_Enum.BODY, ref: clientId +"_" +
"GridBodyTemplate"},
+ {pane: GridLayout_Enum.FOOTER, ref: clientId +"_" +
"GridFooterTemplate"}
+ ];
+
+ // ClientUILib.log(ClientUILogger.WARNING, "DataModel created over " +
((new Date()).getTime() - currTime) + " miliseconds.");
+ // currTime = (new Date()).getTime();
+
+ // create the Grid
+ grid = new ClientUI.controls.grid.Grid(clientId +"_" +
'GridContainer', dataModel, templates,
+ {
+ showIndexColumn: false,
+ indexColumnWidth: 40
+ }
+ );
+ // ClientUILib.log(ClientUILogger.WARNING, "Grid control created over " +
((new Date()).getTime() - currTime) + " miliseconds.");
+
+ grid.updateLayout();
+
+ setTimeout(function() {
+ currTime = (new Date()).getTime();
+ //grid.loadData();
+ }.bind(this), 100);
+
+ // ClientUILib.log(ClientUILogger.WARNING, "Done.");
+ }
+
+ }
+ }();
+
+ #{this:getScriptContributions(context, component)};
+ Event.observe(window, 'load', #{this:getJavaScriptVarName(context,
component)}.init);
+
+// ]]>
+ </script>
+</f:root>
+
+
+
\ No newline at end of file