JBoss Rich Faces SVN: r1495 - branches/3.0.2/sandbox/scrollable-grid/src/main/java/org/richfaces/renderkit/html.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2007-07-05 14:14:26 -0400 (Thu, 05 Jul 2007)
New Revision: 1495
Modified:
branches/3.0.2/sandbox/scrollable-grid/src/main/java/org/richfaces/renderkit/html/ScrollableGridBaseRenderer.java
Log:
Modified: branches/3.0.2/sandbox/scrollable-grid/src/main/java/org/richfaces/renderkit/html/ScrollableGridBaseRenderer.java
===================================================================
--- branches/3.0.2/sandbox/scrollable-grid/src/main/java/org/richfaces/renderkit/html/ScrollableGridBaseRenderer.java 2007-07-05 18:13:52 UTC (rev 1494)
+++ branches/3.0.2/sandbox/scrollable-grid/src/main/java/org/richfaces/renderkit/html/ScrollableGridBaseRenderer.java 2007-07-05 18:14:26 UTC (rev 1495)
@@ -634,6 +634,7 @@
public void renderAjaxChildren(FacesContext context, UIComponent component)throws IOException{
UIScrollableGrid grid = (UIScrollableGrid)component;
+
GridRendererState state = GridRendererState.createState(context, grid);
AjaxContext ajaxContext = AjaxContext.getCurrentInstance(context);
17 years, 6 months
JBoss Rich Faces SVN: r1494 - branches/3.0.2/sandbox/scrollable-grid/src/main/templates/org/richfaces.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2007-07-05 14:13:52 -0400 (Thu, 05 Jul 2007)
New Revision: 1494
Modified:
branches/3.0.2/sandbox/scrollable-grid/src/main/templates/org/richfaces/scrollable-grid-cell.jspx
Log:
add cellStyle and cellClass attributes
Modified: branches/3.0.2/sandbox/scrollable-grid/src/main/templates/org/richfaces/scrollable-grid-cell.jspx
===================================================================
--- branches/3.0.2/sandbox/scrollable-grid/src/main/templates/org/richfaces/scrollable-grid-cell.jspx 2007-07-05 18:13:07 UTC (rev 1493)
+++ branches/3.0.2/sandbox/scrollable-grid/src/main/templates/org/richfaces/scrollable-grid-cell.jspx 2007-07-05 18:13:52 UTC (rev 1494)
@@ -12,7 +12,7 @@
>
<td class="ClientUI_Grid_BC Idg-column-cell #{columnClass} #{component.attributes['styleClass']}" id="#{client_id}:c_#{cell_id}">
- <div id="#{client_id}:bc_#{cell_id}" class="ClientUI_Grid_BCBody">
+ <div id="#{client_id}:bc_#{cell_id}" class="ClientUI_Grid_BCBody #{component.attributes['cellClass']}" style="#{component.attributes['cellStyle']}">
<vcp:body/>
</div>
</td>
17 years, 6 months
JBoss Rich Faces SVN: r1493 - branches/3.0.2/sandbox/scrollable-grid/src/main/java/org/richfaces/renderkit/html.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2007-07-05 14:13:07 -0400 (Thu, 05 Jul 2007)
New Revision: 1493
Modified:
branches/3.0.2/sandbox/scrollable-grid/src/main/java/org/richfaces/renderkit/html/GridRendererState.java
Log:
fix NPE during creating gridRenderState
Modified: branches/3.0.2/sandbox/scrollable-grid/src/main/java/org/richfaces/renderkit/html/GridRendererState.java
===================================================================
--- branches/3.0.2/sandbox/scrollable-grid/src/main/java/org/richfaces/renderkit/html/GridRendererState.java 2007-07-05 17:43:52 UTC (rev 1492)
+++ branches/3.0.2/sandbox/scrollable-grid/src/main/java/org/richfaces/renderkit/html/GridRendererState.java 2007-07-05 18:13:07 UTC (rev 1493)
@@ -112,8 +112,14 @@
}
GridRendererState oldState = getRendererState(context);
GridRendererState state = new GridRendererState(context,oldState,grid);
- state.setColumnClasses(((String)grid.getAttributes().get("columnClasses")).split(","));
- state.setRowClasses(((String)grid.getAttributes().get("rowClasses")).split(","));
+ if(grid.getAttributes().get("columnClasses") != null){
+ String columnClasses = (String)grid.getAttributes().get("columnClasses");
+ state.setColumnClasses(columnClasses.split(","));
+ }
+ if(grid.getAttributes().get("rowClasses") != null){
+ String rowClasses = (String)grid.getAttributes().get("rowClasses");
+ state.setRowClasses(rowClasses.split(","));
+ }
context.getExternalContext().getRequestMap().put(DATA_GRID_RENDERER_STATE,state);
return state;
}
17 years, 6 months
JBoss Rich Faces SVN: r1492 - branches/3.0.2/sandbox/scrollable-grid/src/main/java/org/richfaces/renderkit/html.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2007-07-05 13:43:52 -0400 (Thu, 05 Jul 2007)
New Revision: 1492
Modified:
branches/3.0.2/sandbox/scrollable-grid/src/main/java/org/richfaces/renderkit/html/ScrollableGridBaseRenderer.java
Log:
add hidden input rendering method for storing scroll position values
Modified: branches/3.0.2/sandbox/scrollable-grid/src/main/java/org/richfaces/renderkit/html/ScrollableGridBaseRenderer.java
===================================================================
--- branches/3.0.2/sandbox/scrollable-grid/src/main/java/org/richfaces/renderkit/html/ScrollableGridBaseRenderer.java 2007-07-05 17:42:29 UTC (rev 1491)
+++ branches/3.0.2/sandbox/scrollable-grid/src/main/java/org/richfaces/renderkit/html/ScrollableGridBaseRenderer.java 2007-07-05 17:43:52 UTC (rev 1492)
@@ -1,10 +1,8 @@
package org.richfaces.renderkit.html;
import java.io.IOException;
-import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
-import java.util.List;
import java.util.Map;
import javax.faces.component.UIComponent;
@@ -22,6 +20,7 @@
import org.ajax4jsf.framework.util.javascript.JSFunction;
import org.ajax4jsf.framework.util.javascript.JSFunctionDefinition;
import org.ajax4jsf.framework.util.javascript.JSReference;
+import org.ajax4jsf.framework.util.javascript.ScriptUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.richfaces.component.UIScrollableGrid;
@@ -551,6 +550,13 @@
boolean sorted = false;
Map parameters = externalContext.getRequestParameterMap();
+ String s_id = clientId + ":si";
+ if(parameters.containsKey(s_id)){
+ String options = (String)parameters.get(s_id);
+ grid.setScrollPos(options);
+ }
+
+
if(parameters.containsKey(clientId + ":sortColumn") &&
parameters.containsKey(clientId + ":sortStartRow") &&
parameters.containsKey(clientId + ":sortIndex") &&
@@ -618,6 +624,8 @@
}
}
}
+
+
}
@@ -654,6 +662,7 @@
grid.setRowKey(null);
ajaxContext.setResponseData(grid.getResponseData());
+
ajaxContext.getAjaxRenderedAreas().remove(grid.getClientId(context));
GridScrollSettings options = createOptions(grid);
ajaxContext.getResponseDataMap().put("options", options);
@@ -746,6 +755,21 @@
return footerCellTemplate;
}
+ public void renderHiddenScrollInput(FacesContext context, UIScrollableGrid grid) throws IOException{
+
+ ResponseWriter writer = context.getResponseWriter();
+ String id = grid.getClientId(context) + ":si";
+ writer.startElement("input", grid);
+
+ getUtils().writeAttribute(writer, "type", "hidden");
+ getUtils().writeAttribute(writer, "name", id);
+ getUtils().writeAttribute(writer, "id", id);
+ getUtils().writeAttribute(writer, "value", grid.getScrollPos());
+
+ writer.endElement("input");
+
+ }
+
public void contributorsEncodeHere(FacesContext context, UIScrollableGrid grid) throws IOException {
RendererContributor [] contribs = getContributors();
17 years, 6 months
JBoss Rich Faces SVN: r1491 - branches/3.0.2/sandbox/scrollable-grid/src/main/java/org/richfaces/component.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2007-07-05 13:42:29 -0400 (Thu, 05 Jul 2007)
New Revision: 1491
Modified:
branches/3.0.2/sandbox/scrollable-grid/src/main/java/org/richfaces/component/UIScrollableGrid.java
Log:
add support for storing scroll position
Modified: branches/3.0.2/sandbox/scrollable-grid/src/main/java/org/richfaces/component/UIScrollableGrid.java
===================================================================
--- branches/3.0.2/sandbox/scrollable-grid/src/main/java/org/richfaces/component/UIScrollableGrid.java 2007-07-05 17:35:23 UTC (rev 1490)
+++ branches/3.0.2/sandbox/scrollable-grid/src/main/java/org/richfaces/component/UIScrollableGrid.java 2007-07-05 17:42:29 UTC (rev 1491)
@@ -59,6 +59,8 @@
private int reqRowsCount = -1;
+ private String scrollPos;
+
public int getReqRowsCount() {
return reqRowsCount;
}
@@ -200,9 +202,10 @@
public Object saveState(FacesContext context) {
- Object values[] = new Object[2];
+ Object values[] = new Object[3];
values[0] = super.saveState(context);
values[1] = getRanges();
+ values[2] = scrollPos;
return (Object)values;
@@ -212,7 +215,7 @@
Object values[] = (Object[])state;
super.restoreState(context, values[0]);
setRanges((List)values[1]);
-
+ scrollPos = (String)values[2];
}
protected Iterator dataChildren() {
@@ -355,4 +358,12 @@
public void setRanges(List ranges) {
this.ranges = ranges;
}
+
+ public String getScrollPos() {
+ return scrollPos;
+ }
+
+ public void setScrollPos(String scrollPos) {
+ this.scrollPos = scrollPos;
+ }
}
17 years, 6 months
JBoss Rich Faces SVN: r1490 - branches/3.0.2/sandbox/scrollable-grid/src/main/java/org/richfaces/renderkit/html.
by richfaces-svn-commits@lists.jboss.org
Author: konstantin.mishin
Date: 2007-07-05 13:35:23 -0400 (Thu, 05 Jul 2007)
New Revision: 1490
Modified:
branches/3.0.2/sandbox/scrollable-grid/src/main/java/org/richfaces/renderkit/html/GridRendererState.java
Log:
small fix
Modified: branches/3.0.2/sandbox/scrollable-grid/src/main/java/org/richfaces/renderkit/html/GridRendererState.java
===================================================================
--- branches/3.0.2/sandbox/scrollable-grid/src/main/java/org/richfaces/renderkit/html/GridRendererState.java 2007-07-05 17:35:07 UTC (rev 1489)
+++ branches/3.0.2/sandbox/scrollable-grid/src/main/java/org/richfaces/renderkit/html/GridRendererState.java 2007-07-05 17:35:23 UTC (rev 1490)
@@ -35,11 +35,11 @@
private HashSet ids = new HashSet();
- private Object rowClasses[];
+ private String rowClasses[];
private int rowClassesSize;
- private Object columnClasses[];
+ private String columnClasses[];
private int columnClassesSize;
@@ -112,8 +112,8 @@
}
GridRendererState oldState = getRendererState(context);
GridRendererState state = new GridRendererState(context,oldState,grid);
- state.setColumnClasses(AjaxRendererUtils.asSet(grid.getAttributes().get("columnClasses")));
- state.setRowClasses(AjaxRendererUtils.asSet(grid.getAttributes().get("rowClasses")));
+ state.setColumnClasses(((String)grid.getAttributes().get("columnClasses")).split(","));
+ state.setRowClasses(((String)grid.getAttributes().get("rowClasses")).split(","));
context.getExternalContext().getRequestMap().put(DATA_GRID_RENDERER_STATE,state);
return state;
}
@@ -394,30 +394,30 @@
public String getColumnClass(int index) {
if(columnClasses != null) {
- return (String)columnClasses[index % columnClassesSize];
+ return columnClasses[index % columnClassesSize];
} else {
return "";
}
}
- public void setColumnClasses(Set columnClasses) {
+ public void setColumnClasses(String columnClasses[]) {
if(columnClasses != null) {
- this.columnClasses = columnClasses.toArray();
+ this.columnClasses = columnClasses;
columnClassesSize = this.columnClasses.length;
}
}
public String getRowClass(int index) {
if(rowClasses != null) {
- return (String)rowClasses[index % rowClassesSize];
+ return rowClasses[index % rowClassesSize];
} else {
return "";
}
}
- public void setRowClasses(Set rowClasses) {
+ public void setRowClasses(String rowClasses[]) {
if(rowClasses != null) {
- this.rowClasses = rowClasses.toArray();
+ this.rowClasses = rowClasses;
rowClassesSize = this.rowClasses.length;
}
}
17 years, 6 months
JBoss Rich Faces SVN: r1489 - branches/3.0.2/sandbox/scrollable-grid.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2007-07-05 13:35:07 -0400 (Thu, 05 Jul 2007)
New Revision: 1489
Modified:
branches/3.0.2/sandbox/scrollable-grid/generatescript.xml
Log:
add task to support eclipse 3.3
Modified: branches/3.0.2/sandbox/scrollable-grid/generatescript.xml
===================================================================
--- branches/3.0.2/sandbox/scrollable-grid/generatescript.xml 2007-07-05 17:31:04 UTC (rev 1488)
+++ branches/3.0.2/sandbox/scrollable-grid/generatescript.xml 2007-07-05 17:35:07 UTC (rev 1489)
@@ -14,7 +14,42 @@
<description>
Assemble all javaScript library files to one scrollable-grid.js
</description>
-
+
+ <target name="merge-scripts-eclipse-3.3">
+ <property name="script-path" value="org/richfaces/renderkit/html/scripts"></property>
+ <property name="gen-script-name" value="scrollable-grid.js"></property>
+ <property name="gen-script-full-name" value="${target-dir}/${script-path}/${gen-script-name}"></property>
+ <concat append="false" binary="false" destfile="${gen-script-full-name}">
+ <filelist dir="${resources-dir}">
+ <file name="${resources-dir}/common/prototype/ext/extend.js"/>
+ <file name="${resources-dir}/ClientUILib.js"/>
+ <file name="${resources-dir}/ClientUI/common/utils/Utils.js"/>
+ <file name="${resources-dir}/ClientUI/common/utils/StringBuilder.js"/>
+ <file name="${resources-dir}/ClientUI/common/utils/Validators.js"/>
+ <file name="${resources-dir}/ClientUI/common/box/Box.js"/>
+ <file name="${resources-dir}/ClientUI/common/box/InlineBox.js"/>
+ <file name="${resources-dir}/ClientUI/common/utils/CustomEvent.js"/>
+ <file name="${resources-dir}/ClientUI/common/box/ScrollableBox.js"/>
+ <file name="${resources-dir}/ClientUI/controls/grid/DataModel.js"/>
+ <file name="${resources-dir}/ClientUI/controls/grid/ArrayDataModel.js"/>
+ <file name="${resources-dir}/ClientUI/controls/grid/FakeArrayDataModel.js"/>
+ <file name="${resources-dir}/ClientUI/layouts/LayoutManager.js"/>
+ <file name="${resources-dir}/ClientUI/common/box/Substrate.js"/>
+ <file name="${resources-dir}/ClientUI/layouts/VLayoutManager.js"/>
+ <file name="${resources-dir}/ClientUI/layouts/GridLayoutManager.js"/>
+ <file name="${resources-dir}/ClientUI/controls/grid/GridHeader.js"/>
+ <file name="${resources-dir}/ClientUI/common/box/SplashBox.js"/>
+ <file name="${resources-dir}/ClientUI/controls/grid/DataCash.js"/>
+ <file name="${resources-dir}/ClientUI/controls/grid/GridBody.js"/>
+ <file name="${resources-dir}/ClientUI/controls/grid/GridFooter.js"/>
+ <file name="${resources-dir}/ClientUI/controls/grid/Grid.js"/>
+ <file name="${resources-dir}/ClientUI/controls/grid/Selection.js"/>
+ <file name="${resources-dir}/ClientUI/controls/grid/ScrollableGrid.js"/>
+ </filelist>
+ </concat>
+ </target>
+
+
<target name="merge-scripts">
<property name="script-path" value="org/richfaces/renderkit/html/scripts"></property>
<property name="gen-script-name" value="scrollable-grid.js"></property>
17 years, 6 months
JBoss Rich Faces SVN: r1488 - branches/3.0.2/sandbox/scrollable-grid/src/main/javascript/ClientUI/controls/grid.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2007-07-05 13:31:04 -0400 (Thu, 05 Jul 2007)
New Revision: 1488
Added:
branches/3.0.2/sandbox/scrollable-grid/src/main/javascript/ClientUI/controls/grid/ScrollableGrid.js
Removed:
branches/3.0.2/sandbox/scrollable-grid/src/main/javascript/ClientUI/controls/grid/ScrollableGrid.js
Modified:
branches/3.0.2/sandbox/scrollable-grid/src/main/javascript/ClientUI/controls/grid/FakeArrayDataModel.js
Log:
add support for restore scroll state after submit
Modified: branches/3.0.2/sandbox/scrollable-grid/src/main/javascript/ClientUI/controls/grid/FakeArrayDataModel.js
===================================================================
--- branches/3.0.2/sandbox/scrollable-grid/src/main/javascript/ClientUI/controls/grid/FakeArrayDataModel.js 2007-07-05 17:26:39 UTC (rev 1487)
+++ branches/3.0.2/sandbox/scrollable-grid/src/main/javascript/ClientUI/controls/grid/FakeArrayDataModel.js 2007-07-05 17:31:04 UTC (rev 1488)
@@ -51,9 +51,9 @@
var state_input = $(this.gridId + "_state_input");
var submit_input = $(this.gridId + "_submit_input");
// var options_input = $(this.gridId + "_options_input");
- var submit_values = state_options.count + "," + state_options.index + "," + state_options.startRow;
+ var submit_values = state_options.count + "," + state_options.index + "," + state_options.startRow;
state_input.value = submit_values;
-// options_input.value = options;
+// options_input.value = options;
this.curr_options = options;
submit_input.click();
Deleted: branches/3.0.2/sandbox/scrollable-grid/src/main/javascript/ClientUI/controls/grid/ScrollableGrid.js
===================================================================
--- branches/3.0.2/sandbox/scrollable-grid/src/main/javascript/ClientUI/controls/grid/ScrollableGrid.js 2007-07-05 17:26:39 UTC (rev 1487)
+++ branches/3.0.2/sandbox/scrollable-grid/src/main/javascript/ClientUI/controls/grid/ScrollableGrid.js 2007-07-05 17:31:04 UTC (rev 1488)
@@ -1,171 +0,0 @@
-ClientUILib.declarePackage("ClientUI.controls.grid.ScrollableGrid");
-
-ClientUI.controls.grid.ScrollableGrid = Class.create({
- CLASSDEF: {
- name: 'ClientUI.controls.grid.ScrollableGrid',
- parent: ClientUI.controls.grid.Grid
- }
-});
-
-Object.extend(ClientUI.controls.grid.ScrollableGrid.prototype, {
- /**
- * Occured when scroll position adjusted
- */
- eventOnPostScroll: {},
-
- /**
- * Occured when sorting adjusted
- */
- eventOnPostSort: {},
-
- initialize: function(options) {
- this.startInitTime = (new Date()).getTime();
-
- this.options = options;
- this.client_id = this.options.client_id;
- this.rows_count = $(this.client_id + "_rows_input").value;
- this.columns_count = this.options.columnsCount;
- this.splash_id = this.options.splash_id;
- this.dataModel = new ClientUI.controls.grid.FakeArrayDataModel(this.rows_count, this.columns_count, this.client_id);
-
- this.templates = [
- {pane: GridLayout_Enum.HEADER, ref: this.client_id +"_" + "GridHeaderTemplate"},
- {pane: GridLayout_Enum.BODY, ref: this.client_id +"_" + "GridBodyTemplate"},
- {pane: GridLayout_Enum.FOOTER, ref: this.client_id +"_" + "GridFooterTemplate"}
- ];
- var grid = this;
-
- Event.onReady(function(){
- grid.init();
- });
- /*Utils.execOnLoad(
- function(){
- grid.init();
- },
- Utils.Condition.ElementPresent(grid.client_id), 100);*/
-
- this.endInitTime = (new Date()).getTime();
- this.rowCallbacks = [];
- },
-
-// initialize parent Grid
-
- init: function(){
- // mark that grid control initialized
- if(!this.isInitialized) {
- this.isInitialized = true;
-
- this.startCreateTime = (new Date()).getTime();
-
- ClientUI.controls.grid.ScrollableGrid.parentClass.constructor().call(this, this.client_id, this.dataModel, this.templates);
-
- this.endCreateTime = (new Date()).getTime();
-
- // suspend some processing
- setTimeout(function() {
- this.startPostProcessTime = (new Date()).getTime();
-
- this.eventOnPostSort = new ClientUI.common.utils.CustomEvent('OnSort');
- this.eventOnPostScroll = new ClientUI.common.utils.CustomEvent('OnScroll');
-
- //var progress = new ClientUI.common.box.SplashBox(this.splash_id, null, 300, true);
- //this.setProgressCtrl(progress);
- Event.observe(this.eventOnSort, "on sort", this.onSorted.bindAsEventListener(this));
- if (this.options.selectionInput) {
- this.selectionManager = new ClientUI.controls.grid.SelectionManager(this);
- }
-
- this.endPostProcessTime = (new Date()).getTime();
- }.bind(this), 500);
- }
- },
-
- onSortComplete : function(request, event, data){
- var options = request.getJSON("options");
- Utils.AJAX.updateRows(options,request,
- this,this.client_id,
- [this.updateSelectionCallBack],
- [function(){
- this.selectionManager.restoreState();
- this.eventOnPostSort.fire(options.column, options.order);
- }]);
- },
- onScrollComplete : function(request, event, data){
- var options = this.dataModel.getCurrentOptions();
- window.loadingServerTime = (new Date()).getTime();
- Utils.AJAX.updateRows(options,request,
- this,this.client_id,
- [this.updateSelectionCallBack],
- [function(){
- this.selectionManager.restoreState();
- this.eventOnPostScroll.fire(this.getBody().currRange.start);
- }]);
-
- window.loadingEndTime = (new Date()).getTime();
-
- // TODO: remove this time statistic logging
- ClientUILib.log(ClientUILogger.ERROR, "Total time of data loading of "+options.count+" rows is: " + (window.loadingEndTime - window.loadingStartTime) + " miliseconds.");
- ClientUILib.log(ClientUILogger.WARNING, "...Server load time: " + (window.loadingServerTime - window.loadingStartTime));
- ClientUILib.log(ClientUILogger.WARNING, "...DOM updated time: " + (window.loadingUpdateTime - window.loadingServerTime));
- ClientUILib.log(ClientUILogger.WARNING, "...Grid invalidation time: " + (window.loadingInvalidateTime - window.loadingUpdateTime));
- ClientUILib.log(ClientUILogger.WARNING, "...Selection mng time: " + (window.loadingEndTime - window.loadingInvalidateTime));
- },
-
- onSorted: function(sortEvent) {
- this.options.onSortAjaxUpdate(sortEvent);
- },
-
- updateSelectionCallBack: function(argMap) {
- if (this.selectionManager) {
- this.selectionManager.addListener(argMap.row, argMap.index);
- }
- },
-
- setSizes: function(width, height) {
- var style = this.element.style;
- style.width = width +"px";
- style.height = height +"px";
- this.updateLayout();
- },
-
- doCollapse: function(index) {
- var header = this.getHeader();
- var flength = header.headerFrozenRow.getElement().rows[0].cells.length;
- var nlength = header.headerRow.getElement().rows[0].cells.length;
- if(index < flength + nlength - 1) {
- var frozen = true;
- if(index >= flength) {
- index -= fcount;
- frozen = false;
- }
- this.hideColumn(index, frozen);
- }
- },
-
- hideColumn: function(index, frozen) {
- this.getHeader().hideColumn(index, frozen);
- this.getBody().hideColumn(index, frozen);
- if(this.getFooter()) {this.getFooter().hideColumn(index, frozen);}
- this.updateLayout();
- },
-
- restoreScrollState: function(state, start, end) {
- this.getBody().scrollBox.getElement().scrollTop = state.pos;
- this.getBody().currentPos = state.pos;
- this.getBody().setScrollPos(state.pos);
- this.getBody().currRange.start == start;
- this.getBody().currRange.end = end;
- },
-
- getScrollPos: function() {
- return this.getBody().currentPos;
- }
-});
-
-
-
-
-
-
-
-
Added: branches/3.0.2/sandbox/scrollable-grid/src/main/javascript/ClientUI/controls/grid/ScrollableGrid.js
===================================================================
--- branches/3.0.2/sandbox/scrollable-grid/src/main/javascript/ClientUI/controls/grid/ScrollableGrid.js (rev 0)
+++ branches/3.0.2/sandbox/scrollable-grid/src/main/javascript/ClientUI/controls/grid/ScrollableGrid.js 2007-07-05 17:31:04 UTC (rev 1488)
@@ -0,0 +1,193 @@
+ClientUILib.declarePackage("ClientUI.controls.grid.ScrollableGrid");
+
+ClientUI.controls.grid.ScrollableGrid = Class.create({
+ CLASSDEF: {
+ name: 'ClientUI.controls.grid.ScrollableGrid',
+ parent: ClientUI.controls.grid.Grid
+ }
+});
+
+Object.extend(ClientUI.controls.grid.ScrollableGrid.prototype, {
+ /**
+ * Occured when scroll position adjusted
+ */
+ eventOnPostScroll: {},
+
+ /**
+ * Occured when sorting adjusted
+ */
+ eventOnPostSort: {},
+
+ initialize: function(options) {
+ this.startInitTime = (new Date()).getTime();
+
+ this.options = options;
+ this.client_id = this.options.client_id;
+ this.rows_count = $(this.client_id + "_rows_input").value;
+ this.scroll_si = $(this.client_id + ":si");
+ this.columns_count = this.options.columnsCount;
+ this.splash_id = this.options.splash_id;
+ this.dataModel = new ClientUI.controls.grid.FakeArrayDataModel(this.rows_count, this.columns_count, this.client_id);
+
+ this.templates = [
+ {pane: GridLayout_Enum.HEADER, ref: this.client_id +"_" + "GridHeaderTemplate"},
+ {pane: GridLayout_Enum.BODY, ref: this.client_id +"_" + "GridBodyTemplate"},
+ {pane: GridLayout_Enum.FOOTER, ref: this.client_id +"_" + "GridFooterTemplate"}
+ ];
+ var grid = this;
+
+ Event.onReady(function(){
+ grid.init();
+ });
+ /*Utils.execOnLoad(
+ function(){
+ grid.init();
+ },
+ Utils.Condition.ElementPresent(grid.client_id), 100);*/
+
+ this.endInitTime = (new Date()).getTime();
+ this.rowCallbacks = [];
+ },
+
+// initialize parent Grid
+
+ init: function(){
+ // mark that grid control initialized
+ if(!this.isInitialized) {
+ this.isInitialized = true;
+ this.startCreateTime = (new Date()).getTime();
+
+ ClientUI.controls.grid.ScrollableGrid.parentClass.constructor().call(this, this.client_id, this.dataModel, this.templates);
+
+ this.endCreateTime = (new Date()).getTime();
+
+ // suspend some processing
+ setTimeout(function() {
+ this.startPostProcessTime = (new Date()).getTime();
+
+ this.eventOnPostSort = new ClientUI.common.utils.CustomEvent('OnSort');
+ this.eventOnPostScroll = new ClientUI.common.utils.CustomEvent('OnScroll');
+
+ //var progress = new ClientUI.common.box.SplashBox(this.splash_id, null, 300, true);
+ //this.setProgressCtrl(progress);
+ Event.observe(this.eventOnSort, "on sort", this.onSorted.bindAsEventListener(this));
+ if (this.options.selectionInput) {
+ this.selectionManager = new ClientUI.controls.grid.SelectionManager(this);
+ }
+
+ this.endPostProcessTime = (new Date()).getTime();
+ }.bind(this), 500);
+
+ if(this.scroll_si.value !=''){
+ var options = this.scroll_si.value.split(',');
+ this.restoreScrollState(options[0],options[1],options[2]);
+ }
+ Event.observe(document.body, "submit",this.restoreScrollPos.bindAsEventListener(this));
+ }
+ },
+
+ onSortComplete : function(request, event, data){
+ var options = request.getJSON("options");
+ Utils.AJAX.updateRows(options,request,
+ this,this.client_id,
+ [this.updateSelectionCallBack],
+ [function(){
+ this.selectionManager.restoreState();
+ this.eventOnPostSort.fire(options.column, options.order);
+ }]);
+ },
+ onScrollComplete : function(request, event, data){
+ var options = this.dataModel.getCurrentOptions();
+ window.loadingServerTime = (new Date()).getTime();
+ Utils.AJAX.updateRows(options,request,
+ this,this.client_id,
+ [this.updateSelectionCallBack],
+ [function(){
+ this.selectionManager.restoreState();
+ this.eventOnPostScroll.fire(this.getBody().currRange.start);
+ }]);
+
+ window.loadingEndTime = (new Date()).getTime();
+
+ // TODO: remove this time statistic logging
+ ClientUILib.log(ClientUILogger.ERROR, "Total time of data loading of "+options.count+" rows is: " + (window.loadingEndTime - window.loadingStartTime) + " miliseconds.");
+ ClientUILib.log(ClientUILogger.WARNING, "...Server load time: " + (window.loadingServerTime - window.loadingStartTime));
+ ClientUILib.log(ClientUILogger.WARNING, "...DOM updated time: " + (window.loadingUpdateTime - window.loadingServerTime));
+ ClientUILib.log(ClientUILogger.WARNING, "...Grid invalidation time: " + (window.loadingInvalidateTime - window.loadingUpdateTime));
+ ClientUILib.log(ClientUILogger.WARNING, "...Selection mng time: " + (window.loadingEndTime - window.loadingInvalidateTime));
+ },
+
+ onSorted: function(sortEvent) {
+ this.options.onSortAjaxUpdate(sortEvent);
+ },
+
+ updateSelectionCallBack: function(argMap) {
+ if (this.selectionManager) {
+ this.selectionManager.addListener(argMap.row, argMap.index);
+ }
+ },
+
+ setSizes: function(width, height) {
+ var style = this.element.style;
+ style.width = width +"px";
+ style.height = height +"px";
+ this.updateLayout();
+ },
+
+ doCollapse: function(index) {
+ var header = this.getHeader();
+ var flength = header.headerFrozenRow.getElement().rows[0].cells.length;
+ var nlength = header.headerRow.getElement().rows[0].cells.length;
+ if(index < flength + nlength - 1) {
+ var frozen = true;
+ if(index >= flength) {
+ index -= fcount;
+ frozen = false;
+ }
+ this.hideColumn(index, frozen);
+ }
+ },
+
+ hideColumn: function(index, frozen) {
+ this.getHeader().hideColumn(index, frozen);
+ this.getBody().hideColumn(index, frozen);
+ if(this.getFooter()) {this.getFooter().hideColumn(index, frozen);}
+ this.updateLayout();
+ },
+
+ restoreScrollState: function(scrollPos, start, end) {
+ debugger;
+ var body = this.getBody();
+ body.scrollBox.getElement().scrollTop = scrollPos;
+ body.currentPos = scrollPos;
+ body.currRange.start = start;
+ body.currRange.end = end;
+ body._onContentVScroll(scrollPos);
+ var visibleRowPos = body.currRange.start * body.defaultRowHeight;
+ //setTimeout(function(){
+ body.templFrozen.moveToY(visibleRowPos);
+ body.templNormal.moveToY(visibleRowPos);
+ //}, 500);
+ },
+
+ getScrollPos: function() {
+ return this.getBody().currentPos;
+ },
+
+ restoreScrollPos: function(){
+ //debugger;
+ var body = this.getBody();
+ var start = body.currRange.start;
+ var end = body.currRange.end;
+ var index = this.getScrollPos();
+ this.scroll_si.value = index + "," + start + "," + end;
+ }
+});
+
+
+
+
+
+
+
+
17 years, 6 months
JBoss Rich Faces SVN: r1487 - branches/3.0.2/sandbox/scrollable-grid/src/main/templates/org/richfaces.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2007-07-05 13:26:39 -0400 (Thu, 05 Jul 2007)
New Revision: 1487
Modified:
branches/3.0.2/sandbox/scrollable-grid/src/main/templates/org/richfaces/scrollable-grid.jspx
Log:
add call method for rendering hidden input with current scroll position values
Modified: branches/3.0.2/sandbox/scrollable-grid/src/main/templates/org/richfaces/scrollable-grid.jspx
===================================================================
--- branches/3.0.2/sandbox/scrollable-grid/src/main/templates/org/richfaces/scrollable-grid.jspx 2007-07-05 17:26:36 UTC (rev 1486)
+++ branches/3.0.2/sandbox/scrollable-grid/src/main/templates/org/richfaces/scrollable-grid.jspx 2007-07-05 17:26:39 UTC (rev 1487)
@@ -174,6 +174,11 @@
<input type="hidden" name="#{clientId}_options_input" id="#{clientId}_options_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"/>
+ <jsp:scriptlet>
+ <![CDATA[
+ renderHiddenScrollInput(context, component);
+ ]]>
+ </jsp:scriptlet>
<f:call name="contributorsEncodeHere"/>
17 years, 6 months
JBoss Rich Faces SVN: r1486 - branches/3.0.2/sandbox/scrollable-grid/src/main/javascript/ClientUI/common/utils.
by richfaces-svn-commits@lists.jboss.org
Author: konstantin.mishin
Date: 2007-07-05 13:26:36 -0400 (Thu, 05 Jul 2007)
New Revision: 1486
Modified:
branches/3.0.2/sandbox/scrollable-grid/src/main/javascript/ClientUI/common/utils/Utils.js
Log:
fix problem with neko filter
Modified: branches/3.0.2/sandbox/scrollable-grid/src/main/javascript/ClientUI/common/utils/Utils.js
===================================================================
--- branches/3.0.2/sandbox/scrollable-grid/src/main/javascript/ClientUI/common/utils/Utils.js 2007-07-05 17:24:11 UTC (rev 1485)
+++ branches/3.0.2/sandbox/scrollable-grid/src/main/javascript/ClientUI/common/utils/Utils.js 2007-07-05 17:26:36 UTC (rev 1486)
@@ -88,8 +88,11 @@
var tcount = target.childNodes.length;
var innerHTML = [];
var k;
- for(k=0; k<tcount; k++) {
- tdSrc = k<ccount ? childs[k] : null;
+ for(k=0, l=0; k<tcount; k++, l++) {
+ if(!childs[l].tagName) {
+ l++;
+ }
+ tdSrc = k<ccount ? childs[l] : null;
innerHTML.push("<td class='");
innerHTML.push(target.childNodes[k].className);
innerHTML.push("'>");
17 years, 6 months