Author: konstantin.mishin
Date: 2008-04-23 11:31:53 -0400 (Wed, 23 Apr 2008)
New Revision: 8097
Modified:
trunk/ui/scrollableDataTable/src/main/java/org/richfaces/renderkit/html/ScrollableDataTableBaseRenderer.java
trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/common/utils/Utils.js
trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/controls/grid/Grid.js
trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/controls/grid/GridBody.js
trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/controls/grid/GridFooter.js
trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/controls/grid/GridHeader.js
trunk/ui/scrollableDataTable/src/main/resources/org/richfaces/renderkit/html/css/scrollable-data-table.xcss
trunk/ui/scrollableDataTable/src/main/templates/org/richfaces/scrollable-data-table-cell.jspx
trunk/ui/scrollableDataTable/src/main/templates/org/richfaces/scrollable-data-table-footer-cell.jspx
trunk/ui/scrollableDataTable/src/main/templates/org/richfaces/scrollable-data-table-header-cell.jspx
trunk/ui/scrollableDataTable/src/main/templates/org/richfaces/scrollable-data-table-header-itself.jspx
trunk/ui/scrollableDataTable/src/main/templates/org/richfaces/scrollable-data-table.jspx
Log:
RF-2761
Modified:
trunk/ui/scrollableDataTable/src/main/java/org/richfaces/renderkit/html/ScrollableDataTableBaseRenderer.java
===================================================================
---
trunk/ui/scrollableDataTable/src/main/java/org/richfaces/renderkit/html/ScrollableDataTableBaseRenderer.java 2008-04-23
14:00:42 UTC (rev 8096)
+++
trunk/ui/scrollableDataTable/src/main/java/org/richfaces/renderkit/html/ScrollableDataTableBaseRenderer.java 2008-04-23
15:31:53 UTC (rev 8097)
@@ -125,20 +125,6 @@
}
};
- private final ColumnVisitor colsRenderer = new ExtendedColumnVisitor(){
-
- public void renderContent(FacesContext context, UIComponent column, ResponseWriter
writer, ScrollableDataTableRendererState state) throws IOException {
- writer.startElement("col", column);
- getUtils().writeAttribute(writer, "width", getColumnWidth(column));
- getUtils().writeAttribute(writer, "style",
column.getAttributes().get("style"));
- //int cell_index = state.getCellIndex();
- //Object columnClass = state.getColumnClass(cell_index);
- //if(columnClass!=null) getUtils().writeAttribute(writer, "class",
columnClass);
-
- writer.endElement("col");
- }
- };
-
private final ColumnVisitor headerCellRenderer = new ExtendedColumnVisitor(){
public void renderContent(FacesContext context, UIComponent column, ResponseWriter
writer, ScrollableDataTableRendererState state) throws IOException {
@@ -171,6 +157,7 @@
variables.setVariable("cell_index", new Integer(cell_index));
variables.setVariable("sepOffset", new Integer(sepOffset));
variables.setVariable("headerColumnClass", state.getColumnClass());
+ variables.setVariable("columnWidth", width);
Boolean sorting = getColumnSorting(state.getGrid(), cell_index);
if (sorting != null) {
if (sorting.booleanValue()) {
@@ -332,9 +319,9 @@
ColumnWalker.iterateOverColumns(context, grid, cellRenderer, writer, state);
if(!state.isFrozenPart()){
writer.startElement("td", grid);
- getUtils().writeAttribute(writer, "class","dr-sdt-bc
rich-sdt-column-cell " + state.getColumnClass(state.getCellIndex()));
+ getUtils().writeAttribute(writer, "class","dr-sdt-bc dr-sdt-c-f
rich-sdt-column-cell " + state.getColumnClass(state.getCellIndex()));
writer.startElement(HTML.DIV_ELEM, grid);
- getUtils().writeAttribute(writer, "class","dr-sdt-bcbody");
+ getUtils().writeAttribute(writer, "class","dr-sdt-cbody");
writer.endElement(HTML.DIV_ELEM);
writer.endElement("td");
}
@@ -416,9 +403,9 @@
writer, baseClientId);
}
writer.startElement("td", grid);
- getUtils().writeAttribute(writer, "class","dr-sdt-bc
rich-sdt-column-cell " + state.getColumnClass(state.getCellIndex()));
+ getUtils().writeAttribute(writer, "class","dr-sdt-bc dr-sdt-c-f
rich-sdt-column-cell " + state.getColumnClass(state.getCellIndex()));
writer.startElement(HTML.DIV_ELEM, grid);
- getUtils().writeAttribute(writer, "class","dr-sdt-bcbody");
+ getUtils().writeAttribute(writer, "class","dr-sdt-cbody");
writer.endElement(HTML.DIV_ELEM);
writer.endElement("td");
writer.endElement("tr");
@@ -554,46 +541,9 @@
state.setFrozenPart(isFrozen);
state.setClientId(grid.getClientId(context));
state.setSepOffset(new Integer(0));
- if (!isFrozen || state.getFrozenColumnCount() > 0) {
- writer.startElement(HTML.TR_ELEMENT, grid);
- getUtils().writeAttribute(
- writer,
- "class",
- "dr-sdt-hr rich-std-header-row"
- + grid.getAttributes().get("headerClass"));
- ColumnWalker.iterateOverColumns(context, grid, headerCellRenderer,
- writer, state);
- if (!isFrozen) {
- writer.startElement(HTML.th_ELEM, grid);
- getUtils().writeAttribute(writer, "class",
- "dr-sdt-hc rich-sdt-header-cell");
- writer.startElement(HTML.DIV_ELEM, grid);
- getUtils().writeAttribute(writer, "class", "dr-sdt-hcbody");
- writer.endElement(HTML.DIV_ELEM);
- writer.endElement(HTML.th_ELEM);
- }
- writer.endElement(HTML.TR_ELEMENT);
- }
+ ColumnWalker.iterateOverColumns(context, grid, headerCellRenderer, writer, state);
}
- public void renderCols(FacesContext context, UIScrollableDataTable grid, boolean
isFrozen) throws IOException{
-
- ResponseWriter writer = context.getResponseWriter();
- final ScrollableDataTableRendererState state =
ScrollableDataTableRendererState.getRendererState(context);
-
- if(isFrozen){
- state.setColumType(COLUMN_FROZEN_TYPE);
- }else{
- state.setColumType(COLUMN_NORMAL_TYPE);
- }
-
- state.setClientId(grid.getClientId(context));
- state.setFrozenColumnCount(ScrollableDataTableUtils.getFrozenColumnsCount(grid));
- state.setFrozenPart(isFrozen);
- ColumnWalker.iterateOverColumns(context, grid, colsRenderer, writer, state);
- }
-
-
public void renderFooters(FacesContext context, UIScrollableDataTable grid, boolean
isFrozen) throws IOException{
ResponseWriter writer = context.getResponseWriter();
Modified: trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/common/utils/Utils.js
===================================================================
---
trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/common/utils/Utils.js 2008-04-23
14:00:42 UTC (rev 8096)
+++
trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/common/utils/Utils.js 2008-04-23
15:31:53 UTC (rev 8097)
@@ -314,6 +314,20 @@
this._d = new Date().getTime();
};
+Utils.getRule = function (className) {
+ var rule = null;
+ var sheets = document.styleSheets;
+ for (var j = 0; !rule && j < sheets.length; j++) {
+ var rules = sheets[j].cssRules ? sheets[j].cssRules: sheets[j].rules;
+ for (var i = 0; !rule && i < rules.length; i++) {
+ if (rules[i].selectorText.toLowerCase() == ("." + className.toLowerCase()))
{
+ rule = rules[i];
+ }
+ }
+ }
+ return rule;
+};
+
Array.prototype.unbreakableEach = function(f) {
for (var i = 0; i < this.length; i++) {
f(this[i], i);
Modified: trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/controls/grid/Grid.js
===================================================================
---
trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/controls/grid/Grid.js 2008-04-23
14:00:42 UTC (rev 8096)
+++
trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/controls/grid/Grid.js 2008-04-23
15:31:53 UTC (rev 8097)
@@ -105,8 +105,6 @@
},
adjustColumnWidth: function(index, width) {
this.getHeader().adjustColumnWidth(index, width);
- this.getBody().adjustColumnWidth(index, width);
- if(this.getFooter()) this.getFooter().adjustColumnWidth(index, width);
this.updateLayout();
this.getHeader().agjustSeparators();
this.element.fire("grid:onresizecolumn",{index:index, width:width});
@@ -127,23 +125,6 @@
this.getHeader().getColumns()[index].minWidth = width;
return true;
},
- getColumnsTotalWidth: function() {
- var totalWidth = 0;
- var columns = this.getHeader().getColumns();
- for(var i=0; i<columns.length; i++) {
- totalWidth += columns[i].width;
- }
- return totalWidth;
- },
- getColumnsFrozenWidth: function() {
- var totalWidth = 0;
- var columns = this.getHeader().getColumns();
- var i = 0;
- while(i<columns.length && columns[i].frozen) {
- totalWidth += columns[i++].width;
- }
- return totalWidth;
- },
invalidate: function(params) {
this.getBody().invalidate(params);
},
@@ -153,24 +134,6 @@
this.adjustColumnWidth(i, columns[i].width);
}
},
- quickFind: function(column, text, startRow) {
- var start = startRow || 0;
- var searchText = ".*" + text + ".*";
- var searchReg = new RegExp(searchText, 'i');
- var rowIndex = -1;
- var body = this.getBody();
- var rowsCount = body.rowsCount;
- for (var i = start; i < rowsCount; i++) {
- var currentTextInGrid = body.getCellText(i, column);
- currentTextInGrid =
currentTextInGrid.replace(/(<[^<]*>)/g,'');
- if (currentTextInGrid.search(searchReg) != -1) {
- rowIndex = i;
- break;
- }
- }
-
- return rowIndex;
- },
ensureVisible: function(index) {
this.getBody().ensureVisible(index);
},
Modified:
trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/controls/grid/GridBody.js
===================================================================
---
trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/controls/grid/GridBody.js 2008-04-23
14:00:42 UTC (rev 8096)
+++
trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/controls/grid/GridBody.js 2008-04-23
15:31:53 UTC (rev 8097)
@@ -137,19 +137,6 @@
parseTemplate: function(templFrozen, templNormal) {
var result = false;
if(templNormal && templNormal.rows && templNormal.rows.length != 0) {
- var columns = this.grid.getHeader().getColumns();
- var i=0, j=0;
- var cols = this.templFrozen.getElement().getElementsByTagName("col");
- for(i=0; i<cols.length; i++) {
- columns[j].bodyCol = $(cols[i]);
- j++;
- }
- cols = this.templNormal.getElement().getElementsByTagName("col");
- for(i=0; i<cols.length; i++) {
- columns[j].bodyCol = $(cols[i]);
- j++;
- }
-
this.rowsCount = Math.min(templNormal.rows.length, this.grid.dataModel.getCount());
//if(ClientUILib.isGecko) {
@@ -196,7 +183,9 @@
return;
}
- var totalWidth = this.grid.getColumnsTotalWidth();
+ var frozenContentWidth = this.fTable.offsetWidth;
+ var totalWidth = frozenContentWidth + this.nTable.offsetWidth;
+
this.scrollBox.moveTo(0, 0);
var height = this.element.offsetHeight;
var width = this.element.offsetWidth;
@@ -208,8 +197,6 @@
var fixH = this.grid.getFooter() ? this.grid.getFooter().element.offsetHeight : 0;
if(fixH > height) fixH = 0;
- var frozenContentWidth = this.grid.getColumnsFrozenWidth();
-
this.frozenContentBox.moveTo(0, 0);
this.contentBox.moveTo(frozenContentWidth, 0);
this.sizeBox.moveTo(0, 0);
@@ -252,7 +239,6 @@
}
var scrollPos = Math.min(totalWidth - viewWidth, scrollLeft);
this.grid.adjustScrollPosition(scrollPos);
- this.setFakeColumnWidth();
},
adjustScrollPosition: function(pos) {
this.templNormal.moveToX(-pos);
@@ -332,24 +318,7 @@
this.startLoadData();
}.bind(this), this.grid.dataModel.getRequestDelay());
},
- adjustColumnWidth: function(column, width) {
- var bodyCol = this.grid.getHeader().getColumns()[column].bodyCol;
- if (bodyCol) {
- bodyCol.width = width>0 ? width : 1;
- }
- },
- setFakeColumnWidth: function() {
- var columns = this.grid.getHeader().getColumns();
- var bodyCell = columns.last().bodyCol;
- if(bodyCell) bodyCell.width = 1;
- var width = this.container.getElement().offsetWidth - this.fTable.offsetWidth -
this.nTable.offsetWidth;
- if (width < 1) {
- width = 1;
- }
- if(bodyCell) bodyCell.width = width;
- },
-
startLoadData: function() {
if(this.updateStarted) {
this._setPendingTask(this._getPendingTask());
@@ -686,18 +655,6 @@
return options;
},
- getCellText: function(row, column) {
- var tbl = this.templFrozen.getElement().rows[row].cells;
- var fcount = tbl.length;
- var index = column;
- if(index >= fcount) {
- index -= fcount;
- tbl = this.templNormal.getElement().rows[row].cells;
- }
-
- var cell = document.getElementsByClassName("dr-sdt-bcbody", tbl[index]);
- return (cell && cell.length && cell.length>0) ? cell[0].innerHTML :
"";
- },
ensureVisible: function (index) {
if(index>=0 && index<this.grid.dataModel.getCount()) {
Modified:
trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/controls/grid/GridFooter.js
===================================================================
---
trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/controls/grid/GridFooter.js 2008-04-23
14:00:42 UTC (rev 8096)
+++
trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/controls/grid/GridFooter.js 2008-04-23
15:31:53 UTC (rev 8097)
@@ -31,9 +31,6 @@
throw(errMsg);
}
- // Set dimensions
- this.setHeight(this.defaultHeight);
- this.setWidth(this.defaultWidth);
this.controlCreated = true;
},
parseTemplate: function(template) {
@@ -87,41 +84,15 @@
ch = ch.nextSibling;
}
- var columns = this.grid.getHeader().getColumns();
- var i=0;
- var cols =
$A(this.headerFrozenRow.getElement().getElementsByTagName("col"));
- cols.each(function(col) {
- columns[i].footerCol = $(col);
- i++;
- });
- cols = $A(this.headerRow.getElement().getElementsByTagName("col"));
- cols.each(function(col) {
- columns[i].footerCol = $(col);
- i++;
- });
-
this.helpObj = new ClientUI.common.box.Box(this.frozenContentBox.getElement(), null,
true);
- this.defaultWidth = this.grid.getHeader().defaultWidth;
- this.defaultHeight = this.headerRow.getElement().rows[0].cells[0].offsetHeight;
- if(ClientUILib.isGecko) {
- this.defaultHeight -= this.getBorderWidth("tb") +
this.getPadding("tb");
- //this.defaultWidth -= this.getBorderWidth("lr") +
this.getPadding("lr");
- }
this.frozenSubstrate = new ClientUI.common.box.Box(this.grid.getElement().id +
":fs", this.getElement());
this.frozenSubstrate.getElement().name = this.getElement().id + "FRFrm";
- this.frozenSubstrate.setHeight(this.defaultHeight);
+ this.frozenSubstrate.setHeight(this.headerRow.element.offsetHeight);
return true;
},
updateSize: function() {
- this.defaultWidth = this.grid.getHeader().defaultWidth;
- this.defaultHeight = this.headerRow.getElement().rows[0].cells[0].offsetHeight;
- 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);
+ this.setHeight(this.headerRow.element.offsetHeight);
},
updateLayout: function($super) {
if(!this.controlCreated || !this.grid.controlCreated) {
@@ -130,41 +101,22 @@
$super();
var height = this.element.offsetHeight;
- var totalWidth = this.grid.getColumnsTotalWidth();
- var frozenContentWidth = this.grid.getColumnsFrozenWidth();
+ var frozenContentWidth = this.frozenContentBox.getElement().offsetWidth;
- this.contentBox.setWidth(Math.max(this.getWidth(), totalWidth));
this.contentBox.setHeight(height);
this.contentBox.moveTo(frozenContentWidth - this.grid.getScrollOffset(), 0);
- this.frozenContentBox.setWidth(frozenContentWidth);
this.frozenContentBox.setHeight(height);
this.frozenContentBox.moveTo(0, 0);
- var frozenContentWidth = this.grid.getBody().frozenContentBox.getWidth();
var viewWidth = this.grid.getBody().scrollBox.getViewportWidth();
this.container.setWidth(viewWidth);
this.setWidth(viewWidth);
this.frozenSubstrate.setWidth(frozenContentWidth);
- this.setFakeColumnWidth();
},
adjustScrollPosition: function(pos) {
- this.contentBox.moveToX(this.grid.getColumnsFrozenWidth()-pos);
+ this.contentBox.moveToX(this.frozenContentBox.getElement().offsetWidth - pos);
},
- adjustColumnWidth: function(column, width) {
- var columns = this.grid.getHeader().getColumns();
- columns[column].footerCol.width = width>0 ? width : 1;
- },
- setFakeColumnWidth: function() {
- var columns = this.grid.getHeader().getColumns();
- columns.last().footerCol.width = 1;
- var width = this.grid.getElement().offsetWidth -
this.headerRow.getElement().offsetWidth;
- if (width < 1) {
- width = 1;
- }
- columns.last().footerCol.width = width;
- },
-
hideColumn: function(index, frozen) {
var rows;
if(frozen) {
Modified:
trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/controls/grid/GridHeader.js
===================================================================
---
trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/controls/grid/GridHeader.js 2008-04-23
14:00:42 UTC (rev 8096)
+++
trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/controls/grid/GridHeader.js 2008-04-23
15:31:53 UTC (rev 8097)
@@ -46,9 +46,6 @@
throw(errMsg);
}
- // Set dimensions
- this.setHeight(this.defaultHeight);
- this.setWidth(this.defaultWidth);
this.controlCreated = true;
this.agjustSeparators();
},
@@ -108,24 +105,18 @@
var fcount = rows.length?rows[0].cells.length:0;
var ncount = this.headerRow.getElement().rows[0].cells.length;
var columns = new Array(fcount + ncount);
- var defaultWidth = 0;
- var defaultHeight = 0;
var eventCellMouseDown = this.eventCellMouseDown.bind(this);
// Get columns information
- var i = 0, h, j=0, cell;
- var cols = this.headerFrozenRow.getElement().getElementsByTagName("col");
+ var i = 0, j=0, cell;
this.frozenCells = fcount?this.headerFrozenRow.getElement().rows[0].cells:[];
var ids = this.grid.options.ids;
var count = this.frozenCells.length;
for(i=0; i<count; i++) {
- Utils.trace(i);
cell = this.frozenCells[i];
columns[j] = {
columnId: ids[i],
- col: cols[i],
- width: parseInt(cols[i].width),
styleClass: cell.className,
id: cell.id,
align: cell.align,
@@ -135,20 +126,12 @@
frozen: true,
fixedWidth: Validators.getBoolean(cell.getAttribute("fixedWidth"), false),
sortable: Validators.getBoolean(cell.getAttribute("sortable"), false),
- sorted: Validators.getBoolean(cell.getAttribute("sorted"),
"desc")
+ sorted: Validators.getBoolean(cell.getAttribute("sorted"),
"desc"),
+ style : Utils.getRule("dr-sdt-c-" + j).style
};
- Utils.trace(i+"a");
-
if(columns[j].sortable)
Event.observe(cell, 'click', eventCellMouseDown);
- Utils.trace(i+"a1");
- h = cell.offsetHeight;
- Utils.trace(i+"a2");
- if(h > defaultHeight) defaultHeight = h;
- defaultWidth += columns[j].width;
columns[j].object = new ClientUI.common.box.InlineBox(cell, null, true);
-
- Utils.trace(i+"b");
var details = this._getCellElements(j);
// separator
columns[j].sep = new ClientUI.common.box.InlineBox(details[0], null, true);
@@ -165,10 +148,8 @@
//columns[j].sortDesc = new ClientUI.common.box.Box(details[1], null, true);
//columns[j].sortAsc = new ClientUI.common.box.Box(details[2], null, true);
j++;
- Utils.trace(i+"c");
}
- cols = this.headerRow.getElement().getElementsByTagName("col");
this.cells = this.headerRow.getElement().rows[0].cells;
count = this.cells.length;
for(i=0; i<count; i++) {
@@ -176,8 +157,6 @@
columns[j] = {
columnId: ids[i],
- col: cols[i],
- width: parseInt(cols[i].width),
styleClass: cell.className,
id: cell.id,
align: cell.align,
@@ -187,14 +166,12 @@
frozen: false,
fixedWidth: Validators.getBoolean(cell.getAttribute("fixedWidth"), false),
sortable: Validators.getBoolean(cell.getAttribute("sortable"), false),
- sorted: null
+ sorted: null,
+ style : Utils.getRule("dr-sdt-c-" + (( i < count - 1 ) ? j :
"f")).style
};
if(columns[j].sortable)
Event.observe(cell, 'click', eventCellMouseDown);
- h = cell.offsetHeight;
- if(h > defaultHeight) defaultHeight = h;
- defaultWidth += columns[j].width;
columns[j].object = new ClientUI.common.box.InlineBox(cell, null, true);
var details = this._getCellElements(j);
@@ -218,13 +195,6 @@
}
this._columns = columns;
- this.defaultHeight = defaultHeight;
- this.defaultWidth = defaultWidth;
- if(ClientUILib.isGecko) {
- this.defaultWidth -= this.getBorderWidth("lr") +
this.getPadding("lr");
- this.defaultHeight -= this.getBorderWidth("tb") +
this.getPadding("tb");
- }
-
this.frozenSubstrate = new ClientUI.common.box.Box(this.gridId + ":hs",
this.getElement());
this.frozenSubstrate.getElement().name = this.getElement().id + "HRFrm";
this.frozenSubstrate.setHeight(this.headerRow.element.offsetHeight);
@@ -256,40 +226,7 @@
}
},
updateSize: function() {
- var defaultWidth = 0, defaultHeight = 0;
- var i = 0, h;
- var columns = this._columns;
- var cols =
$A(this.headerFrozenRow.getElement().getElementsByTagName("col"));
- var count = this.frozenCells.length;
- for(j=0; j<count; j++) {
- cell = this.frozenCells[j];
- if(i<columns.length) {
- columns[i].width = parseInt(cols[j].width);
- h = cell.offsetHeight;
- if(h > defaultHeight) defaultHeight = h;
- defaultWidth += columns[i].width;
- }
- i++;
- }
- cols = $A(this.headerRow.getElement().getElementsByTagName("col"));
- count = this.cells.length;
- for(j=0; j<count; j++) {
- cell = this.cells[j];
- if(i<columns.length) {
- columns[i].width = parseInt(cols[j].width);
-
- h = cell.offsetHeight;
- if(h > defaultHeight) defaultHeight = h;
- defaultWidth += columns[i].width;
- }
- i++;
- }
-
- this.defaultHeight = defaultHeight;
- this.defaultWidth = defaultWidth;
-
- this.setHeight(this.defaultHeight);
- this.setWidth(this.defaultWidth);
+ this.setHeight(this.headerRow.element.offsetHeight);
this.agjustSeparators();
this.updateHeaders();
},
@@ -299,14 +236,11 @@
}
$super();
var height = this.element.offsetHeight;
- var totalWidth = this.grid.getColumnsTotalWidth();
- var frozenContentWidth = this.grid.getColumnsFrozenWidth();
+ var frozenContentWidth = this.frozenContentBox.getElement().offsetWidth;
- this.contentBox.setWidth(Math.max(this.getWidth(), totalWidth));
this.contentBox.setHeight(height);
this.contentBox.moveTo(frozenContentWidth - this.grid.getScrollOffset(), 0);
this.headerRow.setHeight(height);
- this.frozenContentBox.setWidth(frozenContentWidth);
this.frozenContentBox.setHeight(height);
this.frozenContentBox.moveTo(0, 0);
this.headerFrozenRow.setHeight(height);
@@ -374,11 +308,11 @@
var pos = this.dragColumnInfo.sep.getX();
if(!this.getColumns()[index].frozen) {
- pos += this.grid.getColumnsFrozenWidth() - this.grid.getScrollOffset();
+ pos += this.frozenContentBox.getElement().offsetWidth - this.grid.getScrollOffset();
}
this.dragColumnInfo.originalX = pos;
this.columnSplitter.show();
- this.columnSplitter.setHeight(this.defaultHeight +
this.grid.getBody().contentBox.element.offsetHeight);
+ this.columnSplitter.setHeight(this.headerRow.element.offsetHeight +
this.grid.getBody().contentBox.element.offsetHeight);
this.columnSplitter.moveTo(pos, 0);
},
_hideSplitter: function() {
@@ -392,7 +326,7 @@
this.columnSplitter.setWidth(10);
},
adjustScrollPosition: function(pos) {
- this.contentBox.moveToX(this.grid.getColumnsFrozenWidth()-pos);
+ this.contentBox.moveToX(this.frozenContentBox.getElement().offsetWidth - pos);
},
OnCellMouseDown: function(event) {
var el = Event.element(event);
@@ -454,18 +388,18 @@
},
adjustColumnWidth: function(column, width) {
- this._columns[column].col.width = width>0 ? width : 1;
+ this._columns[column].style.width = width +"px";
if(width<=0) this.getColumns()[column].sep.hide();
- this._columns[column].width = width;
},
setFakeColumnWidth: function() {
- this._columns.last().col.width = 1;
+ var style = this._columns.last().style;
+ style.width = "0px";
var width = this.grid.getElement().offsetWidth -
this.headerRow.getElement().offsetWidth;
- if (width < 1) {
- width = 1;
+ if (width < 0) {
+ width = 0;
}
- this._columns.last().col.width = width;
+ style.width = width + "px";
},
hideColumn: function(index, frozen) {
Modified:
trunk/ui/scrollableDataTable/src/main/resources/org/richfaces/renderkit/html/css/scrollable-data-table.xcss
===================================================================
---
trunk/ui/scrollableDataTable/src/main/resources/org/richfaces/renderkit/html/css/scrollable-data-table.xcss 2008-04-23
14:00:42 UTC (rev 8096)
+++
trunk/ui/scrollableDataTable/src/main/resources/org/richfaces/renderkit/html/css/scrollable-data-table.xcss 2008-04-23
15:31:53 UTC (rev 8097)
@@ -35,7 +35,6 @@
* Header row
*/
.dr-sdt-hr {
- z-index:2;
}
/**
@@ -44,16 +43,11 @@
.dr-sdt-hc {
-o-text-overflow: ellipsis;
text-overflow: ellipsis;
- overflow: hidden;
font-weight: normal;
- cursor: default;
box-sizing: border-box;
-moz-box-sizing: border-box;
-moz-outline: none;
-moz-user-focus: normal;
- padding: 0px 0px;
- white-space: nowrap;
- border-bottom-style: solid;
border-right-style: solid;
}
@@ -74,13 +68,11 @@
background-repeat: repeat-y;
cursor: e-resize;
font-size: 1px;
- top: 15%;
+ top: 0px;
width: 6px;
- height: 13px;
- overflow: hidden;
+ height: 100%;
position: absolute;
display: block;
- white-space: nowrap;
z-index: 60;
}
.dr-sdt-hsplit {
@@ -90,16 +82,6 @@
z-index: 100;
}
- /**
- * Header cell body
- */
- .dr-sdt-hcbody {
- white-space: nowrap;
- overflow: hidden;
- width: 100%;
- font-weight: normal;
- }
-
.dr-sdt-fb{
z-index: 50;
}
@@ -117,8 +99,6 @@
* Footer row
*/
.dr-sdt-fr {
- font-weight: normal;
- height: 22px;
border-top: 1px solid #cbc7b8; /* //TODO Which skin parameter must be here? */
}
@@ -128,40 +108,15 @@
.dr-sdt-fc {
-o-text-overflow: ellipsis;
text-overflow: ellipsis;
- overflow: hidden;
font-weight: normal;
- cursor: default;
box-sizing: border-box;
-moz-box-sizing: border-box;
-moz-outline: none;
-moz-user-focus: normal;
border-right: 1px solid;
- height:21px !important;
- padding: 0px 0px;
- white-space: nowrap;
}
-
+
/**
- * Footer cell body
- */
- .dr-sdt-fcbody {
- cursor: default;
- font-weight: normal;
- padding: 3px 5px;
- white-space: nowrap;
- overflow: hidden;
- }
-
- .dr-sdt-fcbody1{
- cursor: default;
- font-weight: normal;
- padding: 0px 0px;
- white-space: nowrap;
- overflow: hidden;
- width: 100%;
- }
-
- /**
* ---------------------------------------------
* Body styles
* ---------------------------------------------
@@ -177,7 +132,6 @@
-moz-box-sizing: border-box;
-moz-outline: none;
-moz-user-focus: normal;
- cursor: default;
border-right: 1px solid;
border-bottom: 1px solid;
}
@@ -202,16 +156,13 @@
font-weight:bold; //TODO Which skin parameter must be here?
}
*/
- .dr-sdt-bcbody {
- cursor: default;
- font-weight: normal;
+ .dr-sdt-cbody {
white-space: nowrap;
overflow: hidden;
-o-text-overflow: ellipsis;
text-overflow: ellipsis;
-moz-box-sizing: border-box;
-moz-outline: none;
- width: 100%;
height: 20px;
}
@@ -262,43 +213,23 @@
<u:selector name=".dr-sdt-hsplit">
<u:style name="border-right-color" skin="tipBorderColor"
/>
</u:selector>
- <u:selector name=".dr-sdt-hcbody">
- <u:style name="font-family" skin="generalFamilyFont" />
- <u:style name="font-size" skin="generalSizeFont" />
- </u:selector>
<u:selector name=".dr-sdt-fr">
<u:style name="background-color"
skin="tableSubfooterBackgroundColor" />
- <u:style name="font-family" skin="generalFamilyFont" />
- <u:style name="font-size" skin="generalSizeFont" />
</u:selector>
<u:selector name=".dr-sdt-fc">
<u:style name="border-right-color" skin="tableBorderColor"
/>
- <u:style name="font-family" skin="generalFamilyFont" />
- <u:style name="font-size" skin="generalSizeFont" />
</u:selector>
- <u:selector name=".dr-sdt-fcbody">
- <u:style name="font-family" skin="generalFamilyFont" />
- <u:style name="font-size" skin="generalSizeFont" />
- </u:selector>
- <u:selector name=".dr-sdt-fcbody1">
- <u:style name="font-family" skin="generalFamilyFont" />
- <u:style name="font-size" skin="generalSizeFont" />
- </u:selector>
<u:selector name=".dr-sdt-bc">
<u:style name="border-right-color" skin="tableBorderColor"
/>
<u:style name="border-bottom-color" skin="tableBorderColor"
/>
</u:selector>
- <u:selector name=".dr-sdt-rb">
- <u:style name="font-family" skin="generalFamilyFont" />
- <u:style name="font-size" skin="generalSizeFont" />
- </u:selector>
<u:selector name=".dr-sdt-row-selected">
<u:style name="background-color"
skin="additionalBackgroundColor" />
</u:selector>
<u:selector name=".dr-sdt-row-active">
<u:style name="color" skin="tabDisabledTextColor" />
</u:selector>
- <u:selector name=".dr-sdt-bcbody">
+ <u:selector name=".dr-sdt-cbody">
<u:style name="font-family" skin="generalFamilyFont" />
<u:style name="font-size" skin="generalSizeFont" />
</u:selector>
Modified:
trunk/ui/scrollableDataTable/src/main/templates/org/richfaces/scrollable-data-table-cell.jspx
===================================================================
---
trunk/ui/scrollableDataTable/src/main/templates/org/richfaces/scrollable-data-table-cell.jspx 2008-04-23
14:00:42 UTC (rev 8096)
+++
trunk/ui/scrollableDataTable/src/main/templates/org/richfaces/scrollable-data-table-cell.jspx 2008-04-23
15:31:53 UTC (rev 8097)
@@ -12,7 +12,7 @@
<td class="dr-sdt-bc rich-sdt-column-cell #{columnClass} #{columnSortClass}
#{component.attributes['styleClass']}"
id="#{client_id}:c_#{cell_id}">
- <div id="#{client_id}:bc_#{cell_id}" class="dr-sdt-bcbody
#{component.attributes['cellClass']}"
style="#{component.attributes['cellStyle']}">
+ <div id="#{client_id}:bc_#{cell_id}" class="dr-sdt-cbody
dr-sdt-c-#{cell_index} #{component.attributes['cellClass']}"
style="#{component.attributes['cellStyle']}">
<vcp:body/>
</div>
</td>
Modified:
trunk/ui/scrollableDataTable/src/main/templates/org/richfaces/scrollable-data-table-footer-cell.jspx
===================================================================
---
trunk/ui/scrollableDataTable/src/main/templates/org/richfaces/scrollable-data-table-footer-cell.jspx 2008-04-23
14:00:42 UTC (rev 8096)
+++
trunk/ui/scrollableDataTable/src/main/templates/org/richfaces/scrollable-data-table-footer-cell.jspx 2008-04-23
15:31:53 UTC (rev 8097)
@@ -12,7 +12,7 @@
<th class="dr-sdt-fc rich-sdt-footer-cell #{footerColumnClass}
#{footerColumnSortClass} #{component.attributes['footerClass']}">
- <div id="#{client_id}:fc_#{cell_index}"
class="dr-sdt-fcbody1">
+ <div id="#{client_id}:fc_#{cell_index}" class="dr-sdt-cbody
dr-sdt-c-#{cell_index}">
<vcp:body/>
</div>
</th>
Modified:
trunk/ui/scrollableDataTable/src/main/templates/org/richfaces/scrollable-data-table-header-cell.jspx
===================================================================
---
trunk/ui/scrollableDataTable/src/main/templates/org/richfaces/scrollable-data-table-header-cell.jspx 2008-04-23
14:00:42 UTC (rev 8096)
+++
trunk/ui/scrollableDataTable/src/main/templates/org/richfaces/scrollable-data-table-header-cell.jspx 2008-04-23
15:31:53 UTC (rev 8097)
@@ -13,7 +13,6 @@
<th class="dr-sdt-hc rich-sdt-header-cell #{headerColumnClass}
#{headerColumnSortClass}" id="#{client_id}:hc_#{cell_index}"
columnindex="#{cell_index}"
sortable="#{component.attributes['sortable']}">
-
<jsp:scriptlet>
if(org.richfaces.component.util.ColumnUtil.isSortable(component)) {
@@ -22,6 +21,13 @@
}
</jsp:scriptlet>
+ <style>
+ <!--
+ .dr-sdt-c-#{cell_index} {
+ width: #{columnWidth}px;
+ }
+ -->
+ </style>
<vcp:body/>
Modified:
trunk/ui/scrollableDataTable/src/main/templates/org/richfaces/scrollable-data-table-header-itself.jspx
===================================================================
---
trunk/ui/scrollableDataTable/src/main/templates/org/richfaces/scrollable-data-table-header-itself.jspx 2008-04-23
14:00:42 UTC (rev 8096)
+++
trunk/ui/scrollableDataTable/src/main/templates/org/richfaces/scrollable-data-table-header-itself.jspx 2008-04-23
15:31:53 UTC (rev 8097)
@@ -12,7 +12,7 @@
component="javax.faces.component.UIComponent"
-<div id="#{client_id}:hcb_#{cell_index}" class="dr-sdt-hcbody
#{component.attributes['headerClass']}">
+<div id="#{client_id}:hcb_#{cell_index}" class="dr-sdt-cbody
dr-sdt-c-#{cell_index} #{component.attributes['headerClass']}">
<vcp:body/>
<div align="right" id="#{client_id}:hs_#{cell_index}"
class="dr-sdt-sort-icon">
Modified:
trunk/ui/scrollableDataTable/src/main/templates/org/richfaces/scrollable-data-table.jspx
===================================================================
---
trunk/ui/scrollableDataTable/src/main/templates/org/richfaces/scrollable-data-table.jspx 2008-04-23
14:00:42 UTC (rev 8096)
+++
trunk/ui/scrollableDataTable/src/main/templates/org/richfaces/scrollable-data-table.jspx 2008-04-23
15:31:53 UTC (rev 8097)
@@ -91,39 +91,39 @@
<iframe id="#{clientId}:hs" class="dr-sdt-substrate"
src="javascript:\'\'" scrolling="no" frameborder="0"
> <br/> </iframe>
<div style="display: block; left: 0px; top: 0px; width:
#{sumWidth}px;">
<span class="dr-sdt-tmplbox dr-sdt-fb"
id="#{clientId}:header:FrozenBox">
- <table cellpadding="0" cellspacing="0"
style="border-collapse:collapse; table-layout:fixed">
-
- <jsp:scriptlet>
- <![CDATA[
- renderCols(context, component, true);
- ]]>
- </jsp:scriptlet>
-
+ <table cellpadding="0" cellspacing="0"
style="border-collapse:collapse;">
<thead>
- <jsp:scriptlet>
- <![CDATA[
- renderHeaders(context, component, true);
- ]]>
- </jsp:scriptlet>
+ <tr class="dr-sdt-hr rich-std-header-row
#{component.attributes['headerClass']}">
+ <jsp:scriptlet>
+ <![CDATA[
+ renderHeaders(context, component, true);
+ ]]>
+ </jsp:scriptlet>
+ </tr>
</thead>
</table>
</span>
<span class="dr-sdt-tmplbox dr-sdt-nb"
id="#{clientId}:header:NormalBox">
- <table cellpadding="0" cellspacing="0"
style="border-collapse:collapse; table-layout:fixed">
-
- <jsp:scriptlet>
- <![CDATA[
- renderCols(context, component, false);
- ]]>
- </jsp:scriptlet>
- <col width="1"/>
+ <table cellpadding="0" cellspacing="0"
style="border-collapse:collapse;">
<thead>
- <jsp:scriptlet>
- <![CDATA[
- renderHeaders(context, component, false);
- ]]>
- </jsp:scriptlet>
+ <tr class="dr-sdt-hr rich-std-header-row
#{component.attributes['headerClass']}">
+ <jsp:scriptlet>
+ <![CDATA[
+ renderHeaders(context, component, false);
+ ]]>
+ </jsp:scriptlet>
+ <th class="dr-sdt-hc dr-sdt-c-f rich-sdt-header-cell">
+ <style>
+ <!--
+ .dr-sdt-c-f {
+ width: 0px;
+ }
+ -->
+ </style>
+ <div class="dr-sdt-cbody" />
+ </th>
+ </tr>
</thead>
</table>
</span>
@@ -138,13 +138,7 @@
</div>
<div id="#{clientId}:bc" style="display: block; width:
#{sumWidth}px;">
<span class="dr-sdt-tmplbox dr-sdt-fb"
id="#{clientId}:body:FrozenBox">
- <table id="#{clientId}:f" cellpadding="0"
cellspacing="0" style="border-collapse:collapse;
table-layout:fixed">
-
- <jsp:scriptlet>
- <![CDATA[
- renderCols(context, component, true);
- ]]>
- </jsp:scriptlet>
+ <table id="#{clientId}:f" cellpadding="0"
cellspacing="0" style="border-collapse:collapse;">
<tbody>
<jsp:scriptlet>
<![CDATA[
@@ -156,14 +150,7 @@
<span class="dr-sdt-ho" id="#{clientId}:fho"
><br/></span>
</span>
<span class="dr-sdt-tmplbox dr-sdt-nb"
id="#{clientId}:body:NormalBox">
- <table id="#{clientId}:n" cellpadding="0"
cellspacing="0" style="border-collapse:collapse;
table-layout:fixed">
-
- <jsp:scriptlet>
- <![CDATA[
- renderCols(context, component, false);
- ]]>
- </jsp:scriptlet>
- <col width="1"/>
+ <table id="#{clientId}:n" cellpadding="0"
cellspacing="0" style="border-collapse:collapse;">
<tbody>
<jsp:scriptlet>
<![CDATA[
@@ -181,13 +168,7 @@
<iframe id="#{clientId}:fs" class="dr-sdt-substrate"
src="javascript:\'\'" scrolling="no" frameborder="0"
> <br/></iframe>
<div style="display: block; width: width: #{sumWidth}px;">
<span class="dr-sdt-tmplbox dr-sdt-fb"
id="#{clientId}:footer:FrozenBox">
- <table cellpadding="0" cellspacing="0"
style="border-collapse:collapse; table-layout:fixed">
-
- <jsp:scriptlet>
- <![CDATA[
- renderCols(context, component, true);
- ]]>
- </jsp:scriptlet>
+ <table cellpadding="0" cellspacing="0"
style="border-collapse:collapse;">
<tfoot>
<tr class="dr-sdt-fr rich-std-footer-row
#{component.attributes['footerClass']}">
<jsp:scriptlet>
@@ -201,14 +182,7 @@
</span>
<span class="dr-sdt-tmplbox dr-sdt-nb"
id="#{clientId}:footer:NormalBox">
- <table cellpadding="0" cellspacing="0"
style="border-collapse:collapse; table-layout:fixed">
-
- <jsp:scriptlet>
- <![CDATA[
- renderCols(context, component, false);
- ]]>
- </jsp:scriptlet>
- <col width="1"/>
+ <table cellpadding="0" cellspacing="0"
style="border-collapse:collapse;">
<tfoot>
<tr class="dr-sdt-fr rich-std-footer-row
#{component.attributes['footerClass']}">
<jsp:scriptlet>
@@ -216,8 +190,8 @@
renderFooters(context, component,false);
]]>
</jsp:scriptlet>
- <th class="dr-sdt-fc rich-sdt-footer-cell">
- <div class="dr-sdt-fcbody1" />
+ <th class="dr-sdt-fc dr-sdt-c-f rich-sdt-footer-cell">
+ <div class="dr-sdt-cbody" />
</th>
</tr>
</tfoot>