JBoss Rich Faces SVN: r1188 - trunk/sandbox-samples/scrollable-grid-demo/src/main/webapp/pages.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2007-06-14 13:04:49 -0400 (Thu, 14 Jun 2007)
New Revision: 1188
Modified:
trunk/sandbox-samples/scrollable-grid-demo/src/main/webapp/pages/scrollable-grid.xhtml
Log:
remode defaultRows, use rows instead
Modified: trunk/sandbox-samples/scrollable-grid-demo/src/main/webapp/pages/scrollable-grid.xhtml
===================================================================
--- trunk/sandbox-samples/scrollable-grid-demo/src/main/webapp/pages/scrollable-grid.xhtml 2007-06-14 16:58:37 UTC (rev 1187)
+++ trunk/sandbox-samples/scrollable-grid-demo/src/main/webapp/pages/scrollable-grid.xhtml 2007-06-14 17:04:49 UTC (rev 1188)
@@ -32,7 +32,6 @@
frozenColCount="3"
first="0"
rows="40"
- defaultRows="40"
width="800px"
height="500px">
17 years, 7 months
JBoss Rich Faces SVN: r1187 - in trunk/sandbox/scrollable-grid/src/main: java/org/richfaces/component and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2007-06-14 12:58:37 -0400 (Thu, 14 Jun 2007)
New Revision: 1187
Modified:
trunk/sandbox/scrollable-grid/src/main/config/component/scrollable-grid.xml
trunk/sandbox/scrollable-grid/src/main/java/org/richfaces/component/UIScrollableGrid.java
trunk/sandbox/scrollable-grid/src/main/java/org/richfaces/renderkit/html/GridRendererState.java
trunk/sandbox/scrollable-grid/src/main/java/org/richfaces/renderkit/html/GridUtils.java
trunk/sandbox/scrollable-grid/src/main/java/org/richfaces/renderkit/html/ScrollableGridBaseRenderer.java
Log:
Modified: trunk/sandbox/scrollable-grid/src/main/config/component/scrollable-grid.xml
===================================================================
--- trunk/sandbox/scrollable-grid/src/main/config/component/scrollable-grid.xml 2007-06-14 15:11:41 UTC (rev 1186)
+++ trunk/sandbox/scrollable-grid/src/main/config/component/scrollable-grid.xml 2007-06-14 16:58:37 UTC (rev 1187)
@@ -44,14 +44,6 @@
<defaultvalue>"700px"</defaultvalue>
</property>
- <property>
- <name>defaultRows</name>
- <classname>int</classname>
- <description>Rows to render</description>
- <defaultvalue>40</defaultvalue>
- </property>
-
-
<property attachedstate="true" hidden="true">
<name>sortOrder</name>
<classname>org.richfaces.model.SortOrder</classname>
Modified: trunk/sandbox/scrollable-grid/src/main/java/org/richfaces/component/UIScrollableGrid.java
===================================================================
--- trunk/sandbox/scrollable-grid/src/main/java/org/richfaces/component/UIScrollableGrid.java 2007-06-14 15:11:41 UTC (rev 1186)
+++ trunk/sandbox/scrollable-grid/src/main/java/org/richfaces/component/UIScrollableGrid.java 2007-06-14 16:58:37 UTC (rev 1187)
@@ -45,20 +45,26 @@
public abstract class UIScrollableGrid extends UIRepeat implements AjaxComponent, Sortable, Selectable{
- public static final String COMPONENT_TYPE = "org.richfaces.component.ScrollableGrid";
+ public static final String COMPONENT_TYPE = "org.richfaces.component.ScrollableGrid";
private transient Collection partialUpdateChildren;
private Collection responseData = new ArrayList();
+ private int reqRowsCount = -1;
+
+ public int getReqRowsCount() {
+ return reqRowsCount;
+ }
+
+ public void setReqRowsCount(int reqRowsCount) {
+ this.reqRowsCount = reqRowsCount;
+ }
+
public abstract SortOrder getSortOrder();
-
+
public abstract void setSortOrder(SortOrder sortOrder) ;
- public abstract int getDefaultRows();
-
- public abstract void setDefaultRows(int defaultRows);
-
public Collection getResponseData() {
return responseData;
}
@@ -74,7 +80,13 @@
public Range getRange() {
int curentRow = getFirst();
- int rows = getRows();
+
+ if(reqRowsCount == -1 ){
+ reqRowsCount = getRows();
+ }
+
+ int rows = getReqRowsCount();
+
int rowsCount = getExtendedDataModel().getRowCount();
if(rows > 0){
@@ -191,8 +203,7 @@
event.setPhaseId(PhaseId.APPLY_REQUEST_VALUES);
}else if(event instanceof SortEvent){
new AjaxEvent(this).queue();
-
- event.setPhaseId(PhaseId.APPLY_REQUEST_VALUES);
+ event.setPhaseId(PhaseId.INVOKE_APPLICATION);
}else if(event instanceof ScrollEvent){
event.setPhaseId(PhaseId.INVOKE_APPLICATION);
new AjaxEvent(this).queue();
@@ -202,7 +213,7 @@
public void processScrolling(FacesEvent event){
ScrollEvent e = (ScrollEvent)event;
- setRows(e.getRows());
+ setReqRowsCount(e.getRows());
setFirst(e.getFirst());
getFacesContext().renderResponse();
}
@@ -249,9 +260,4 @@
super.encodeEnd(context);
partialUpdateChildren = null;
}
-
- public int getRows() {
- int rows = super.getRows();
- return rows != 0 ? rows : getDefaultRows();
- }
}
Modified: trunk/sandbox/scrollable-grid/src/main/java/org/richfaces/renderkit/html/GridRendererState.java
===================================================================
--- trunk/sandbox/scrollable-grid/src/main/java/org/richfaces/renderkit/html/GridRendererState.java 2007-06-14 15:11:41 UTC (rev 1186)
+++ trunk/sandbox/scrollable-grid/src/main/java/org/richfaces/renderkit/html/GridRendererState.java 2007-06-14 16:58:37 UTC (rev 1187)
@@ -215,7 +215,7 @@
* @return Returns the rowIndex.
*/
public int getRowIndex() {
- if(_rowIndex >= _grid.getDefaultRows()){
+ if(_rowIndex >= _grid.getRows()){
_rowIndex = 0;
}
return _rowIndex;
Modified: trunk/sandbox/scrollable-grid/src/main/java/org/richfaces/renderkit/html/GridUtils.java
===================================================================
--- trunk/sandbox/scrollable-grid/src/main/java/org/richfaces/renderkit/html/GridUtils.java 2007-06-14 15:11:41 UTC (rev 1186)
+++ trunk/sandbox/scrollable-grid/src/main/java/org/richfaces/renderkit/html/GridUtils.java 2007-06-14 16:58:37 UTC (rev 1187)
@@ -15,7 +15,7 @@
public static final String FROZEN_COL_COUNT_ATTR = "frozenColCount";
public static final String CLIENT_ROW_KEY = "clientIndex";
-
+
public static int getFrozenColumnsCount(UIScrollableGrid grid) {
return getIntOr0(grid, FROZEN_COL_COUNT_ATTR);
}
Modified: trunk/sandbox/scrollable-grid/src/main/java/org/richfaces/renderkit/html/ScrollableGridBaseRenderer.java
===================================================================
--- trunk/sandbox/scrollable-grid/src/main/java/org/richfaces/renderkit/html/ScrollableGridBaseRenderer.java 2007-06-14 15:11:41 UTC (rev 1186)
+++ trunk/sandbox/scrollable-grid/src/main/java/org/richfaces/renderkit/html/ScrollableGridBaseRenderer.java 2007-06-14 16:58:37 UTC (rev 1187)
@@ -325,7 +325,7 @@
int columnCount = grid.getChildCount();
options.addOption("columnsCount", new Integer(columnCount));
- options.addOption("rowsCount", new Integer(grid.getDefaultRows()));
+ options.addOption("rowsCount", new Integer(grid.getRows()));
JSFunction function = new JSFunction("new ClientUI.controls.grid.ScrollableGrid");
function.addParameter(options);
@@ -369,7 +369,7 @@
state.setFrozenPart(isFrozen);
state.setClientId(grid.getClientId(context));
grid.walk(context, rowsRenderer, state);
- int fakeRowsCount = grid.getDefaultRows() - grid.getRowCount();
+ int fakeRowsCount = grid.getRows() - grid.getRowCount();
state.setFake(true);
for (int i = 0; i < fakeRowsCount; i++) {
rowsRenderer.process(context, null, state);
@@ -520,7 +520,7 @@
grid.getAttributes().put(GridUtils.CLIENT_ROW_KEY,sortStartRow);
grid.setFirst(sortDataIndex);
- grid.setRows(grid.getDefaultRows());
+ grid.setReqRowsCount(grid.getRows());
if (log.isDebugEnabled()) {
@@ -561,6 +561,7 @@
}else{
grid.getAttributes().put(GridUtils.CLIENT_ROW_KEY, new Integer(0));
+ rows = grid.getRows();
}
ScrollEvent scrollEvent = new ScrollEvent(grid,rows,first);
@@ -609,9 +610,7 @@
ajaxContext.getAjaxRenderedAreas().remove(grid.getClientId(context));
GridScrollSettings options = createOptions(grid);
ajaxContext.getResponseDataMap().put("options", options);
- grid.setRows(grid.getDefaultRows());
-
//Then call contributors to write additional HTML content
contributorsEncodeHere(context, grid);
17 years, 7 months
JBoss Rich Faces SVN: r1186 - trunk/sandbox/scrollable-grid/src/main/javascript/ClientUI/controls/grid.
by richfaces-svn-commits@lists.jboss.org
Author: dmorozov
Date: 2007-06-14 11:11:41 -0400 (Thu, 14 Jun 2007)
New Revision: 1186
Modified:
trunk/sandbox/scrollable-grid/src/main/javascript/ClientUI/controls/grid/ScrollableGrid.js
Log:
Modified: trunk/sandbox/scrollable-grid/src/main/javascript/ClientUI/controls/grid/ScrollableGrid.js
===================================================================
--- trunk/sandbox/scrollable-grid/src/main/javascript/ClientUI/controls/grid/ScrollableGrid.js 2007-06-14 14:57:46 UTC (rev 1185)
+++ trunk/sandbox/scrollable-grid/src/main/javascript/ClientUI/controls/grid/ScrollableGrid.js 2007-06-14 15:11:41 UTC (rev 1186)
@@ -35,6 +35,9 @@
// initialize parent Grid
init: function(){
+ // mark that grid control initialized
+ this.initialized = true;
+
ClientUI.controls.grid.ScrollableGrid.parentClass.constructor().call(this, this.client_id, this.dataModel, this.templates);
var progress = new ClientUI.common.box.SplashBox(this.splash_id, null, 300, true);
this.setProgressCtrl(progress);
@@ -42,7 +45,6 @@
if (this.options.selectionInput) {
this.selectionManager = new ClientUI.controls.grid.SelectionManager(this);
}
-
if (this.startUpTime) {
ClientUILib.log(ClientUILogger.ERROR, "Load Time'" + (new Date().getTime() - this.startUpTime) + "' ms");
}
17 years, 7 months
JBoss Rich Faces SVN: r1185 - trunk/sandbox/scrollable-grid/src/main/java/org/richfaces/renderkit/html.
by richfaces-svn-commits@lists.jboss.org
Author: dmorozov
Date: 2007-06-14 10:57:46 -0400 (Thu, 14 Jun 2007)
New Revision: 1185
Modified:
trunk/sandbox/scrollable-grid/src/main/java/org/richfaces/renderkit/html/ScrollableGridBaseRenderer.java
Log:
Reload whole grid control by ajax request
Modified: trunk/sandbox/scrollable-grid/src/main/java/org/richfaces/renderkit/html/ScrollableGridBaseRenderer.java
===================================================================
--- trunk/sandbox/scrollable-grid/src/main/java/org/richfaces/renderkit/html/ScrollableGridBaseRenderer.java 2007-06-14 14:33:59 UTC (rev 1184)
+++ trunk/sandbox/scrollable-grid/src/main/java/org/richfaces/renderkit/html/ScrollableGridBaseRenderer.java 2007-06-14 14:57:46 UTC (rev 1185)
@@ -638,9 +638,7 @@
public void encodeChildren(FacesContext context, UIComponent component
) throws IOException {
- AjaxContext ajaxContext = AjaxContext.getCurrentInstance();
-
- if(ajaxContext.isAjaxRequest() && onlyPartialUpdateNeeded(component)){
+ if(onlyPartialUpdateNeeded(component)){
renderAjaxChildren(context, component);
}else{
super.encodeChildren(context, component);
@@ -655,9 +653,7 @@
setUpState(context, grid);
}
- AjaxContext ajaxContext = AjaxContext.getCurrentInstance();
-
- if(!ajaxContext.isAjaxRequest() && !onlyPartialUpdateNeeded(component)){
+ if(!onlyPartialUpdateNeeded(component)){
super.encodeBegin(context, component);
}
}
@@ -666,9 +662,7 @@
if(component instanceof UIScrollableGrid){
- AjaxContext ajaxContext = AjaxContext.getCurrentInstance();
-
- if(!ajaxContext.isAjaxRequest() && !onlyPartialUpdateNeeded(component)){
+ if(!onlyPartialUpdateNeeded(component)){
super.encodeEnd(context, component);
}
}
17 years, 7 months
JBoss Rich Faces SVN: r1184 - trunk/sandbox/scrollable-grid/src/main/java/org/richfaces/renderkit/html.
by richfaces-svn-commits@lists.jboss.org
Author: maksimkaszynski
Date: 2007-06-14 10:33:59 -0400 (Thu, 14 Jun 2007)
New Revision: 1184
Modified:
trunk/sandbox/scrollable-grid/src/main/java/org/richfaces/renderkit/html/ScrollableGridBaseRenderer.java
trunk/sandbox/scrollable-grid/src/main/java/org/richfaces/renderkit/html/SelectionRendererContributor.java
Log:
correct ajax updates
Modified: trunk/sandbox/scrollable-grid/src/main/java/org/richfaces/renderkit/html/ScrollableGridBaseRenderer.java
===================================================================
--- trunk/sandbox/scrollable-grid/src/main/java/org/richfaces/renderkit/html/ScrollableGridBaseRenderer.java 2007-06-14 14:22:57 UTC (rev 1183)
+++ trunk/sandbox/scrollable-grid/src/main/java/org/richfaces/renderkit/html/ScrollableGridBaseRenderer.java 2007-06-14 14:33:59 UTC (rev 1184)
@@ -12,7 +12,6 @@
import org.ajax4jsf.ajax.repeat.DataVisitor;
import org.ajax4jsf.framework.ajax.AjaxContext;
-import org.ajax4jsf.framework.ajax.AjaxEvent;
import org.ajax4jsf.framework.renderer.AjaxRendererUtils;
import org.ajax4jsf.framework.renderer.ComponentVariables;
import org.ajax4jsf.framework.renderer.ComponentsVariableResolver;
@@ -42,6 +41,8 @@
public abstract class ScrollableGridBaseRenderer extends CompositeRenderer {
+ public final String PARTIAL_UPDATE= "partialUpdate";
+
private final String FOOTER_PART = "footer";
private final String HEADER_PART = "header";
@@ -486,6 +487,10 @@
protected void doDecode(FacesContext context, UIComponent component) {
super.doDecode(context, component);
+
+ component.getAttributes().remove(PARTIAL_UPDATE);
+
+ AjaxContext ajaxContext = AjaxContext.getCurrentInstance(context);
if(component instanceof UIScrollableGrid){
@@ -529,6 +534,9 @@
SortEvent sortEvent = new SortEvent(grid,sortColumn, sortStartRow.intValue(), sortDataIndex, asc );
grid.queueEvent(sortEvent);
+ if (ajaxContext.isAjaxRequest()) {
+ component.getAttributes().put(PARTIAL_UPDATE, Boolean.TRUE);
+ }
}
}
@@ -557,6 +565,10 @@
ScrollEvent scrollEvent = new ScrollEvent(grid,rows,first);
grid.queueEvent(scrollEvent);
+
+ if (ajaxContext.isAjaxRequest()) {
+ component.getAttributes().put(PARTIAL_UPDATE, Boolean.TRUE);
+ }
}
}
@@ -618,11 +630,17 @@
return options;
}
+ private boolean onlyPartialUpdateNeeded(UIComponent grid) {
+ Boolean b = (Boolean) grid.getAttributes().get(PARTIAL_UPDATE);
+ return b != null && b.booleanValue();
+ }
+
public void encodeChildren(FacesContext context, UIComponent component
) throws IOException {
AjaxContext ajaxContext = AjaxContext.getCurrentInstance();
- if(ajaxContext.isAjaxRequest()){
+
+ if(ajaxContext.isAjaxRequest() && onlyPartialUpdateNeeded(component)){
renderAjaxChildren(context, component);
}else{
super.encodeChildren(context, component);
@@ -639,7 +657,7 @@
AjaxContext ajaxContext = AjaxContext.getCurrentInstance();
- if(!ajaxContext.isAjaxRequest()){
+ if(!ajaxContext.isAjaxRequest() && !onlyPartialUpdateNeeded(component)){
super.encodeBegin(context, component);
}
}
@@ -650,7 +668,7 @@
AjaxContext ajaxContext = AjaxContext.getCurrentInstance();
- if(!ajaxContext.isAjaxRequest()){
+ if(!ajaxContext.isAjaxRequest() && !onlyPartialUpdateNeeded(component)){
super.encodeEnd(context, component);
}
}
Modified: trunk/sandbox/scrollable-grid/src/main/java/org/richfaces/renderkit/html/SelectionRendererContributor.java
===================================================================
--- trunk/sandbox/scrollable-grid/src/main/java/org/richfaces/renderkit/html/SelectionRendererContributor.java 2007-06-14 14:22:57 UTC (rev 1183)
+++ trunk/sandbox/scrollable-grid/src/main/java/org/richfaces/renderkit/html/SelectionRendererContributor.java 2007-06-14 14:33:59 UTC (rev 1184)
@@ -159,8 +159,8 @@
ScriptOptions scriptOptions = new ScriptOptions(component);
scriptOptions.addOption("selectionInput", getSelectionInputName(
context, (UIScrollableGrid) component));
- scriptOptions.addOption("selectedClass", component.getAttributes().get("selectedClass"));
- scriptOptions.addOption("activeClass", component.getAttributes().get("activeClass"));
+ scriptOptions.addOption("selectedClass");
+ scriptOptions.addOption("activeClass");
return scriptOptions;
}
17 years, 7 months
JBoss Rich Faces SVN: r1183 - trunk/sandbox/calendar/design/calendar-js.
by richfaces-svn-commits@lists.jboss.org
Author: pyaschenko
Date: 2007-06-14 10:22:57 -0400 (Thu, 14 Jun 2007)
New Revision: 1183
Modified:
trunk/sandbox/calendar/design/calendar-js/calendar-prototype.js
Log:
dates rendering bug fixed
Modified: trunk/sandbox/calendar/design/calendar-js/calendar-prototype.js
===================================================================
--- trunk/sandbox/calendar/design/calendar-js/calendar-prototype.js 2007-06-14 13:36:44 UTC (rev 1182)
+++ trunk/sandbox/calendar/design/calendar-js/calendar-prototype.js 2007-06-14 14:22:57 UTC (rev 1183)
@@ -36,7 +36,7 @@
var tfdow = fdow;
var firstDay = new Date(year,0,1);
var fDay = firstDay.getDay();
- var daynum = ((Date.UTC(y2k(year),month,1,0,0,0) - Date.UTC(y2k(year),0,1,0,0,0)) /1000/60/60/24)+1 ;
+ var daynum = ((Date.UTC(y2k(year),month,1,0,0,0) - Date.UTC(y2k(year),0,1,0,0,0)) /86400000)+1 ;
var weeknum = Math.round((daynum+7)/7);
if(fDay == 0) fDay = 7;
if(tfdow == 0) tfdow = 7;
@@ -190,7 +190,7 @@
// next month days
var ld = 7-p%7;
- while (dayCounter<=ld) { days.push({day:dayCounter++}); }
+ if (ld!=7) while (dayCounter<=ld) { days.push({day:dayCounter++}); }
// render
p=0;
17 years, 7 months
JBoss Rich Faces SVN: r1182 - trunk/sandbox/scrollable-grid/src/main/javascript/ClientUI/controls/grid.
by richfaces-svn-commits@lists.jboss.org
Author: dmorozov
Date: 2007-06-14 09:36:44 -0400 (Thu, 14 Jun 2007)
New Revision: 1182
Modified:
trunk/sandbox/scrollable-grid/src/main/javascript/ClientUI/controls/grid/GridBody.js
Log:
Fix problem with 0 rows in grid
Modified: trunk/sandbox/scrollable-grid/src/main/javascript/ClientUI/controls/grid/GridBody.js
===================================================================
--- trunk/sandbox/scrollable-grid/src/main/javascript/ClientUI/controls/grid/GridBody.js 2007-06-14 12:45:11 UTC (rev 1181)
+++ trunk/sandbox/scrollable-grid/src/main/javascript/ClientUI/controls/grid/GridBody.js 2007-06-14 13:36:44 UTC (rev 1182)
@@ -195,7 +195,8 @@
});
this.rowsCount = Math.min(templNormal.rows.length, this.grid.dataModel.getCount());
- this.defaultRowHeight = Element.getHeight(templNormal.rows[0].cells[0]);
+ var cell = templNormal.rows[0].cells[0];
+ this.defaultRowHeight = cell!=null ? Element.getHeight(cell) : 0;
if(ClientUILib.isGecko) {
this.defaultRowHeight -= this.getBorderWidth("tb") + this.getPadding("tb");
}
17 years, 7 months
JBoss Rich Faces SVN: r1181 - trunk/richfaces/dropdown-menu/src/main/resources/org/richfaces/renderkit/html/scripts.
by richfaces-svn-commits@lists.jboss.org
Author: a.izobov
Date: 2007-06-14 08:45:11 -0400 (Thu, 14 Jun 2007)
New Revision: 1181
Modified:
trunk/richfaces/dropdown-menu/src/main/resources/org/richfaces/renderkit/html/scripts/menu.js
Log:
http://jira.jboss.com/jira/browse/RF-217 fixed
Modified: trunk/richfaces/dropdown-menu/src/main/resources/org/richfaces/renderkit/html/scripts/menu.js
===================================================================
--- trunk/richfaces/dropdown-menu/src/main/resources/org/richfaces/renderkit/html/scripts/menu.js 2007-06-14 12:28:39 UTC (rev 1180)
+++ trunk/richfaces/dropdown-menu/src/main/resources/org/richfaces/renderkit/html/scripts/menu.js 2007-06-14 12:45:11 UTC (rev 1181)
@@ -582,7 +582,7 @@
}
var layerLeft = right;
- var layerTop = top;
+ var layerTop = top - this.layer.firstChild.firstChild.offsetTop;
if (dir == 0) {
if (layerLeft + layerdim.width + labelOffset[0] - windowShift.left >= windowWidth) {
17 years, 7 months
JBoss Rich Faces SVN: r1180 - trunk/sandbox/scrollable-grid/src/main/javascript/ClientUI/controls/grid.
by richfaces-svn-commits@lists.jboss.org
Author: dmorozov
Date: 2007-06-14 08:28:39 -0400 (Thu, 14 Jun 2007)
New Revision: 1180
Modified:
trunk/sandbox/scrollable-grid/src/main/javascript/ClientUI/controls/grid/Grid.js
trunk/sandbox/scrollable-grid/src/main/javascript/ClientUI/controls/grid/GridBody.js
trunk/sandbox/scrollable-grid/src/main/javascript/ClientUI/controls/grid/GridFooter.js
trunk/sandbox/scrollable-grid/src/main/javascript/ClientUI/controls/grid/GridHeader.js
Log:
Add capability for grid to load and initialize within hidden parent.
Modified: trunk/sandbox/scrollable-grid/src/main/javascript/ClientUI/controls/grid/Grid.js
===================================================================
--- trunk/sandbox/scrollable-grid/src/main/javascript/ClientUI/controls/grid/Grid.js 2007-06-14 11:39:44 UTC (rev 1179)
+++ trunk/sandbox/scrollable-grid/src/main/javascript/ClientUI/controls/grid/Grid.js 2007-06-14 12:28:39 UTC (rev 1180)
@@ -122,10 +122,17 @@
document.gridEndTime = (new Date()).getTime();
},
updateLayout: function() {
- if(!this.controlCreated) {
+ if(!this.controlCreated || this.getHeight()==0) {
return;
}
ClientUI.controls.grid.Grid.parentClass.method("updateLayout").call(this);
+
+ var header = this.getHeader();
+ if(header.getHeight() == 0) {
+ header.updateSize();
+ this.getBody().updateSize();
+ if(this.getFooter()) {this.getFooter().updateSize();}
+ }
if(this.layout) {
this.layout.updateLayout();
}
Modified: trunk/sandbox/scrollable-grid/src/main/javascript/ClientUI/controls/grid/GridBody.js
===================================================================
--- trunk/sandbox/scrollable-grid/src/main/javascript/ClientUI/controls/grid/GridBody.js 2007-06-14 11:39:44 UTC (rev 1179)
+++ trunk/sandbox/scrollable-grid/src/main/javascript/ClientUI/controls/grid/GridBody.js 2007-06-14 12:28:39 UTC (rev 1180)
@@ -216,6 +216,12 @@
this.frozenContentBox.getElement().scrollTop = pos;
}
},
+ updateSize: function() {
+ this.defaultRowHeight = Element.getHeight(this.templNormal.getElement().rows[0].cells[0]);
+ if(ClientUILib.isGecko) {
+ this.defaultRowHeight -= this.getBorderWidth("tb") + this.getPadding("tb");
+ }
+ },
updateLayout: function() {
if(!this.controlCreated || !this.grid.controlCreated) {
return;
Modified: trunk/sandbox/scrollable-grid/src/main/javascript/ClientUI/controls/grid/GridFooter.js
===================================================================
--- trunk/sandbox/scrollable-grid/src/main/javascript/ClientUI/controls/grid/GridFooter.js 2007-06-14 11:39:44 UTC (rev 1179)
+++ trunk/sandbox/scrollable-grid/src/main/javascript/ClientUI/controls/grid/GridFooter.js 2007-06-14 12:28:39 UTC (rev 1180)
@@ -127,6 +127,16 @@
}
return true;
},
+ updateSize: function() {
+ this.defaultWidth = this.grid.getHeader().defaultWidth;
+ this.defaultHeight = Element.getHeight(this.headerRow.getElement().rows[0].cells[0]);
+ if(ClientUILib.isGecko) {
+ this.defaultHeight -= this.getBorderWidth("tb") + this.getPadding("tb");
+ //this.defaultWidth -= this.getBorderWidth("lr") + this.getPadding("lr");
+ }
+ this.setHeight(this.defaultHeight);
+ this.setWidth(this.defaultWidth);
+ },
updateLayout: function() {
if(!this.controlCreated || !this.grid.controlCreated) {
return;
Modified: trunk/sandbox/scrollable-grid/src/main/javascript/ClientUI/controls/grid/GridHeader.js
===================================================================
--- trunk/sandbox/scrollable-grid/src/main/javascript/ClientUI/controls/grid/GridHeader.js 2007-06-14 11:39:44 UTC (rev 1179)
+++ trunk/sandbox/scrollable-grid/src/main/javascript/ClientUI/controls/grid/GridHeader.js 2007-06-14 12:28:39 UTC (rev 1180)
@@ -63,8 +63,6 @@
this.setWidth(this.defaultWidth);
this.controlCreated = true;
this.updateLayout();
- this.hide();
- this.show();
},
parseTemplate: function(template) {
if(!template) {
@@ -242,6 +240,43 @@
this._columns[i].sep.moveToX(offset - 4);
}
},
+ updateSize: function() {
+ var defaultWidth = 0, defaultHeight = 0;
+ var i = 0, h, j=0;
+ var columns = this._columns;
+ var cols = $A(this.headerFrozenRow.getElement().getElementsByTagName("col"));
+ var cells = $A(this.headerFrozenRow.getElement().rows[0].cells);
+ cells.each(function(cell) {
+ if(i<columns.length) {
+ columns[i].width = parseInt(cols[j].width);
+ h = Element.getHeight(cell);
+ if(h > defaultHeight) defaultHeight = h;
+ defaultWidth += columns[i].width;
+ }
+ i++;j++;
+ });
+
+ j=0;
+ cols = $A(this.headerRow.getElement().getElementsByTagName("col"));
+ cells = $A(this.headerRow.getElement().rows[0].cells);
+ cells.each(function(cell) {
+ if(i<columns.length) {
+ columns[i].width = parseInt(cols[j].width);
+
+ h = Element.getHeight(cell);
+ if(h > defaultHeight) defaultHeight = h;
+ defaultWidth += columns[i].width;
+ }
+ i++;j++;
+ });
+
+ this.defaultHeight = defaultHeight;
+ this.defaultWidth = defaultWidth;
+
+ this.setHeight(this.defaultHeight);
+ this.setWidth(this.defaultWidth);
+ this.agjustSeparators();
+ },
updateLayout: function() {
if(!this.controlCreated || !this.grid.controlCreated) {
return;
17 years, 7 months
JBoss Rich Faces SVN: r1179 - in trunk/sandbox/scrollable-grid/src/main: javascript/ClientUI/common/utils and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: konstantin.mishin
Date: 2007-06-14 07:39:44 -0400 (Thu, 14 Jun 2007)
New Revision: 1179
Modified:
trunk/sandbox/scrollable-grid/src/main/java/org/richfaces/renderkit/html/GridRendererState.java
trunk/sandbox/scrollable-grid/src/main/java/org/richfaces/renderkit/html/ScrollableGridBaseRenderer.java
trunk/sandbox/scrollable-grid/src/main/javascript/ClientUI/common/utils/CustomEvent.js
trunk/sandbox/scrollable-grid/src/main/javascript/ClientUI/controls/grid/GridBody.js
Log:
Added fake rows.
Modified: trunk/sandbox/scrollable-grid/src/main/java/org/richfaces/renderkit/html/GridRendererState.java
===================================================================
--- trunk/sandbox/scrollable-grid/src/main/java/org/richfaces/renderkit/html/GridRendererState.java 2007-06-14 11:27:14 UTC (rev 1178)
+++ trunk/sandbox/scrollable-grid/src/main/java/org/richfaces/renderkit/html/GridRendererState.java 2007-06-14 11:39:44 UTC (rev 1179)
@@ -29,6 +29,8 @@
public static final String DATA_GRID_RENDERER_STATE = GridRendererState.class.getName();
+ private boolean fake;
+
private int _rowIndex = 0;
private int _cellIndex = 0;
@@ -366,5 +368,13 @@
public void setCollection(Collection collection) {
this.collection = collection;
+ }
+
+ public boolean isFake() {
+ return fake;
+ }
+
+ public void setFake(boolean fake) {
+ this.fake = fake;
}
}
Modified: trunk/sandbox/scrollable-grid/src/main/java/org/richfaces/renderkit/html/ScrollableGridBaseRenderer.java
===================================================================
--- trunk/sandbox/scrollable-grid/src/main/java/org/richfaces/renderkit/html/ScrollableGridBaseRenderer.java 2007-06-14 11:27:14 UTC (rev 1178)
+++ trunk/sandbox/scrollable-grid/src/main/java/org/richfaces/renderkit/html/ScrollableGridBaseRenderer.java 2007-06-14 11:39:44 UTC (rev 1179)
@@ -169,7 +169,9 @@
variables.setVariable("cell_index", new Integer(cell_index));
cellTemplate.encodeBegin(context, column);
- renderChildren(context, column);
+ if(!state.isFake()) {
+ renderChildren(context, column);
+ }
cellTemplate.encodeEnd(context, column);
}
@@ -184,7 +186,7 @@
grid.setRowKey(rowKey);
- if(grid.isRowAvailable()){
+ if(grid.isRowAvailable() || state.isFake()){
String row_id;
int index = state.getRowIndex();
@@ -366,6 +368,12 @@
state.setFrozenPart(isFrozen);
state.setClientId(grid.getClientId(context));
grid.walk(context, rowsRenderer, state);
+ int fakeRowsCount = grid.getDefaultRows() - grid.getRowCount();
+ state.setFake(true);
+ for (int i = 0; i < fakeRowsCount; i++) {
+ rowsRenderer.process(context, null, state);
+ }
+ state.setFake(false);
grid.setRowKey(null);
}
Modified: trunk/sandbox/scrollable-grid/src/main/javascript/ClientUI/common/utils/CustomEvent.js
===================================================================
--- trunk/sandbox/scrollable-grid/src/main/javascript/ClientUI/common/utils/CustomEvent.js 2007-06-14 11:27:14 UTC (rev 1178)
+++ trunk/sandbox/scrollable-grid/src/main/javascript/ClientUI/common/utils/CustomEvent.js 2007-06-14 11:39:44 UTC (rev 1179)
@@ -35,8 +35,7 @@
// Fire this event and notifies the subscribers.
fire: function() {
- var len = Event.subscribers.length;
- if (!len) {
+ if (!Event.subscribers || !Event.subscribers.length) {
return true;
}
Modified: trunk/sandbox/scrollable-grid/src/main/javascript/ClientUI/controls/grid/GridBody.js
===================================================================
--- trunk/sandbox/scrollable-grid/src/main/javascript/ClientUI/controls/grid/GridBody.js 2007-06-14 11:27:14 UTC (rev 1178)
+++ trunk/sandbox/scrollable-grid/src/main/javascript/ClientUI/controls/grid/GridBody.js 2007-06-14 11:39:44 UTC (rev 1179)
@@ -134,11 +134,11 @@
this.frozenContentBox = new ClientUI.common.box.Box(frozen);
this.frozenContentBox.makeAbsolute();
- this.helpObject1 = new ClientUI.common.box.Box($(document.createElement("img")), this.contentBox.getElement());
+ this.helpObject1 = new ClientUI.common.box.Box($(document.createElement("span")), this.contentBox.getElement());
this.helpObject1.setWidth(10);
this.helpObject1.setHeight(10);
this.helpObject1.makeAbsolute();
- this.helpObject2 = new ClientUI.common.box.Box($(document.createElement("img")), this.frozenContentBox.getElement());
+ this.helpObject2 = new ClientUI.common.box.Box($(document.createElement("span")), this.frozenContentBox.getElement());
this.helpObject2.setWidth(10);
this.helpObject2.setHeight(10);
this.helpObject2.makeAbsolute();
@@ -194,7 +194,7 @@
i++;
});
- this.rowsCount = templNormal.rows.length;
+ this.rowsCount = Math.min(templNormal.rows.length, this.grid.dataModel.getCount());
this.defaultRowHeight = Element.getHeight(templNormal.rows[0].cells[0]);
if(ClientUILib.isGecko) {
this.defaultRowHeight -= this.getBorderWidth("tb") + this.getPadding("tb");
17 years, 7 months