Author: nbelaevski
Date: 2008-09-15 18:55:22 -0400 (Mon, 15 Sep 2008)
New Revision: 10444
Modified:
branches/3.2.x/ui/extendedDataTable/src/main/java/org/richfaces/renderkit/AbstractExtendedTableRenderer.java
branches/3.2.x/ui/extendedDataTable/src/main/java/org/richfaces/renderkit/html/ExtDraggableRendererContributor.java
branches/3.2.x/ui/extendedDataTable/src/main/java/org/richfaces/renderkit/html/ExtDropzoneRendererContributor.java
branches/3.2.x/ui/extendedDataTable/src/main/javascript/ClientUI/controls/datatable/ExtendedDataTable.js
branches/3.2.x/ui/extendedDataTable/src/main/javascript/ClientUI/controls/datatable/ExtendedDataTableHeader.js
branches/3.2.x/ui/extendedDataTable/src/main/javascript/ClientUI/controls/datatable/ExtendedDataTableSelection.js
branches/3.2.x/ui/extendedDataTable/src/main/resources/org/richfaces/renderkit/html/css/extendedDataTable.xcss
branches/3.2.x/ui/extendedDataTable/src/main/templates/org/richfaces/htmlExtendedDataTable.jspx
Log:
Latest changes for extendedDataTable merged from trunk
Modified:
branches/3.2.x/ui/extendedDataTable/src/main/java/org/richfaces/renderkit/AbstractExtendedTableRenderer.java
===================================================================
---
branches/3.2.x/ui/extendedDataTable/src/main/java/org/richfaces/renderkit/AbstractExtendedTableRenderer.java 2008-09-15
16:27:56 UTC (rev 10443)
+++
branches/3.2.x/ui/extendedDataTable/src/main/java/org/richfaces/renderkit/AbstractExtendedTableRenderer.java 2008-09-15
22:55:22 UTC (rev 10444)
@@ -151,20 +151,22 @@
String headerClass = (String) table.getAttributes().get(
"headerClass");
// String menuId = (String) table.getAttributes().get(MENU_ID);
+
+ writer.startElement("tr", header);
+ encodeStyleClass(writer, null,
+ "extdt-header rich-extdt-header", headerClass, null);
+ writer.writeAttribute(HTML.id_ATTRIBUTE, table
+ .getBaseClientId(context)
+ + ":fakeIeRow", null);
+ for (int i = 0; i < numberOfColumns; i++) {
+ writer.startElement("th", header);
+ encodeStyleClass(writer, null,
+ "extdt-headercell extdt-fakeierow
rich-extdt-headercell",
+ headerClass, null);
+ writer.endElement("th");
+ }
+
if (header != null) {
- writer.startElement("tr", header);
- encodeStyleClass(writer, null,
- "extdt-header rich-extdt-header", headerClass, null);
- writer.writeAttribute(HTML.id_ATTRIBUTE, table
- .getBaseClientId(context)
- + ":fakeIeRow", null);
- for (int i = 0; i < numberOfColumns; i++) {
- writer.startElement("th", header);
- encodeStyleClass(writer, null,
- "extdt-headercell extdt-fakeierow
rich-extdt-headercell",
- headerClass, null);
- writer.endElement("th");
- }
writer.endElement("tr");
encodeTableHeaderFacet(context, numberOfColumns, writer,
@@ -589,10 +591,10 @@
boolean first = true;
int currentColumn = 0;
UIColumn column = null;
+ if (holder.isFirstRow()) {
+ encodeFakeIeRow(context, table, holder);
+ }
if (holder.isGroupingOn() && (rowGroupChanged(context, holder))) {
- if (holder.isFirstRow()) {
- encodeFakeIeRow(context, table, holder);
- }
encodeGroupRow(context, table, holder);
}
holder.setFirstRow(false);
Modified:
branches/3.2.x/ui/extendedDataTable/src/main/java/org/richfaces/renderkit/html/ExtDraggableRendererContributor.java
===================================================================
---
branches/3.2.x/ui/extendedDataTable/src/main/java/org/richfaces/renderkit/html/ExtDraggableRendererContributor.java 2008-09-15
16:27:56 UTC (rev 10443)
+++
branches/3.2.x/ui/extendedDataTable/src/main/java/org/richfaces/renderkit/html/ExtDraggableRendererContributor.java 2008-09-15
22:55:22 UTC (rev 10444)
@@ -10,6 +10,7 @@
import javax.faces.context.FacesContext;
import org.richfaces.renderkit.CompositeRenderer;
+import org.richfaces.renderkit.DraggableRendererContributor;
import org.richfaces.renderkit.RendererContributor;
import org.richfaces.renderkit.ScriptOptions;
@@ -39,7 +40,7 @@
public static synchronized ExtDraggableRendererContributor getInstance() {
if (instance == null) {
instance = new ExtDraggableRendererContributor();
- wrappedContributor =
org.richfaces.renderkit.DraggableRendererContributor.getInstance();
+ wrappedContributor = DraggableRendererContributor.getInstance();
}
return instance;
}
@@ -96,7 +97,7 @@
Map<String, Object> parameters = new HashMap<String, Object>();
parameters
.put(
-
org.richfaces.renderkit.DraggableRendererContributor.DRAG_SOURCE_ID,
+ DraggableRendererContributor.DRAG_SOURCE_ID,
dragSourceScriptId);
parameters.put(dragSourceScriptId, dragSourceScriptId);
options.addOption("parameters", parameters);
Modified:
branches/3.2.x/ui/extendedDataTable/src/main/java/org/richfaces/renderkit/html/ExtDropzoneRendererContributor.java
===================================================================
---
branches/3.2.x/ui/extendedDataTable/src/main/java/org/richfaces/renderkit/html/ExtDropzoneRendererContributor.java 2008-09-15
16:27:56 UTC (rev 10443)
+++
branches/3.2.x/ui/extendedDataTable/src/main/java/org/richfaces/renderkit/html/ExtDropzoneRendererContributor.java 2008-09-15
22:55:22 UTC (rev 10444)
@@ -14,6 +14,8 @@
import org.ajax4jsf.javascript.ScriptUtils;
import org.ajax4jsf.renderkit.AjaxRendererUtils;
import org.richfaces.renderkit.CompositeRenderer;
+import org.richfaces.renderkit.DraggableRendererContributor;
+import org.richfaces.renderkit.DropzoneRendererContributor;
import org.richfaces.renderkit.RendererContributor;
import org.richfaces.renderkit.ScriptOptions;
@@ -41,7 +43,7 @@
public static synchronized ExtDropzoneRendererContributor getInstance() {
if (instance == null) {
instance = new ExtDropzoneRendererContributor();
- wrappedContributor =
org.richfaces.renderkit.DropzoneRendererContributor.getInstance();
+ wrappedContributor = DropzoneRendererContributor.getInstance();
}
return instance;
@@ -88,22 +90,31 @@
}
}
- if (preSendAjaxRequestFunction != null){
- definition.addToBody(preSendAjaxRequestFunction.toScript()).addToBody(";");
- }
+ definition.addToBody("var dragParams = drag.getParameters();");
+
+ String dragSourceScriptId = column.getClientId(context) + ":"+
TableDragDropRenderer.DRAG_SOURCE_SCRIPT_ID;
+ definition.addToBody(
+ "var source = dragParams['"+ DraggableRendererContributor.DRAG_SOURCE_ID
+"'];" +
+ "if (source != \"" + dragSourceScriptId + "\"){"//send
request only if drag column in not equals to drop column
+ );
definition.addToBody("var options =
").addToBody(ScriptUtils.toScript(requestOpts)).addToBody(";");
- definition.addToBody("options.parameters['" +
org.richfaces.renderkit.DropzoneRendererContributor.DROP_TARGET_ID + "'] =
'" + dropTargetScriptId + "';");
-
+ definition.addToBody("options.parameters['" +
DropzoneRendererContributor.DROP_TARGET_ID + "'] = '" +
dropTargetScriptId + "';");
if (onAjaxCompleteFunction != null)
definition.addToBody("options['" +
AjaxRendererUtils.ONCOMPLETE_ATTR_NAME + "'] = " +
onAjaxCompleteFunction.toScript() + ";");
//TODO remove as legacy
- definition.addToBody("Object.extend(options.parameters,drag.getParameters());");
+ definition.addToBody("Object.extend(options.parameters, dragParams);");
+ if (preSendAjaxRequestFunction != null){
+ definition.addToBody(preSendAjaxRequestFunction.toScript()).addToBody(";");
+ }
definition.addToBody("var dzOptions = this.getDropzoneOptions(); if
(dzOptions.ondrop) { if (!dzOptions.ondrop.call(this, event)) return; };");
JSFunction dropFunction = AjaxRendererUtils.buildAjaxFunction(column, context);
dropFunction.addParameter(new JSReference("options"));
definition.addToBody(dropFunction.toScript()).addToBody(";");
+
+ definition.addToBody("};");
+
definition.appendScript(result);
result.append(";");
Modified:
branches/3.2.x/ui/extendedDataTable/src/main/javascript/ClientUI/controls/datatable/ExtendedDataTable.js
===================================================================
---
branches/3.2.x/ui/extendedDataTable/src/main/javascript/ClientUI/controls/datatable/ExtendedDataTable.js 2008-09-15
16:27:56 UTC (rev 10443)
+++
branches/3.2.x/ui/extendedDataTable/src/main/javascript/ClientUI/controls/datatable/ExtendedDataTable.js 2008-09-15
22:55:22 UTC (rev 10444)
@@ -31,7 +31,7 @@
function(){
grid.update(true);
},
- Utils.Condition.ElementPresent(id+':od'), 5);
+ Utils.Condition.ElementPresent(id+':od'), 100);
},
destroy: function() {
@@ -43,19 +43,20 @@
//remove listeners
this.selectionManager.removeListeners();
- this.header.removeListeners();
-
- var l = this.groupRows.length;
- for(var i = 0; i < l; i++) {
- Utils.DOM.Event.removeListeners(this.groupRows[i]);
- }
-
- var headerChildren = this.header.getColumnCells();
- l = headerChildren.length;
- for (var i=0; i<l-1; i++) {
- Utils.DOM.Event.removeListeners(headerChildren[i]);
- };
-
+ if (this.header) {
+ this.header.removeListeners();
+ var headerChildren = this.header.getColumnCells();
+ l = headerChildren.length;
+ for (var i=0; i<l-1; i++) {
+ Utils.DOM.Event.removeListeners(headerChildren[i]);
+ };
+ }
+ if (this.groupRows) {
+ var l = this.groupRows.length;
+ for(var i = 0; i < l; i++) {
+ Utils.DOM.Event.removeListeners(this.groupRows[i]);
+ }
+ }
//null all references to DOM elements
delete this.selectionManager;
delete this.header;
@@ -149,18 +150,26 @@
},
showSplashScreen: function(){
+ /**
+ Opera 95 is not drawing additional
+ element, and so I am commenting this out.
if (ClientUILib.isOpera) {
this.mainDiv.setStyle({display:'none'});
}
+ */
this.table.setStyle({visibility:'hidden'});
var splshscr = this.splashScreen;
splshscr.className = 'extdt-ss-vsbl';
},
hideSplashScreen: function(){
+ /**
+ Opera 95 is not drawing additional
+ element, and so I am commenting this out.
if (ClientUILib.isOpera) {
this.mainDiv.setStyle({display:''});
}
+ */
this.table.setStyle({visibility:'visible'});
this.splashScreen.className = 'extdt-ss-hdn';
},
@@ -287,14 +296,14 @@
var sd = this.scrollingDiv.getElement();
return sd.offsetWidth - sd.clientWidth;
},
- validateColumnsWidth: function(columns,excessWidth) {
+ validateColumnsWidth: function(columns,excessWidth) {
var i=1;
var endIndex = columns.length-1;
while ((i < endIndex) && (excessWidth > 0)) {
if (ClientUILib.isIE) {
var colWidth = parseInt(this.getColumns()[i].width) - 1;
}else{
- var colWidth = this.getColumnWidth(i);
+ var colWidth = this.header.getColumnWidth(i);
}
var spareWidth = colWidth - this.minColumnWidth;
var dW;
@@ -354,15 +363,6 @@
if (excessWidth > 0) {
this.validateColumnsWidth(cols,excessWidth);
};
- if (ClientUILib.isOpera) {
- var _stl = 2;
- var cols = this.header.getColumns();
- var columnsNumber = this.header.getColumnsNumber();
- for (var i=0; i<columnsNumber-1; i++) {
- ClientUILib.log(ClientUILogger.INFO, "this.getColumnWidth(i)
"+this.getColumnWidth(i));
- cols[i].width = this.getColumnWidth(i) - _stl;
- }
- };
cols[columnsNumber-1].width = null;
cols[cols.length-1].width = null;
var newHeight = mainDivHeight - header.getHeight() - footerHeight - 2;
@@ -386,14 +386,14 @@
this.createControls();
if ( !ClientUILib.isIE ) {
if (this.fakeIeRow) {
- this.table.getElement().deleteRow(this.fakeIeRow);
+ this.table.getElement().deleteRow(this.fakeIeRow.rowIndex);
this.fakeIeRow = null;
}
if (this.fakeIeBodyRow) {
- this.tableB.deleteRow(this.fakeIeBodyRow);
+ this.tableB.deleteRow(this.fakeIeBodyRow.rowIndex);
this.fakeIeBodyRow = null;
}
- }
+ };
this.selectionManager.refreshEvents();
this.updateLayout();
this.selectionManager.restoreState();
Modified:
branches/3.2.x/ui/extendedDataTable/src/main/javascript/ClientUI/controls/datatable/ExtendedDataTableHeader.js
===================================================================
---
branches/3.2.x/ui/extendedDataTable/src/main/javascript/ClientUI/controls/datatable/ExtendedDataTableHeader.js 2008-09-15
16:27:56 UTC (rev 10443)
+++
branches/3.2.x/ui/extendedDataTable/src/main/javascript/ClientUI/controls/datatable/ExtendedDataTableHeader.js 2008-09-15
22:55:22 UTC (rev 10444)
@@ -161,16 +161,15 @@
adjustSeparators: function() {
var columnCells = this.getColumnCells();
- this._redrawTable(this.extDt.table.getElement());
- this._redrawTable(this.extDt.tableB);
var l = columnCells.length;
+ this._redrawTable(this.extDt.table.getElement());
for (var i=0; i<l-1; i++) {
var headerChild = columnCells[i];
var headerNextChild = columnCells[i+1];
var headerChildChildren = headerChild.childElements();
var sepSpan = headerChildChildren[2];
var headerRowHeight = this.headerRow.getHeight();
- var headerRowY = this.getCaptionHeight();
+ var headerRowY = this.headerRow.getY();
sepSpan.columnIndex = i;
var sd = sepSpan.getWidth()/2 + 1;
var dropSpanLeft = headerChildChildren[3];
@@ -207,7 +206,8 @@
this.lastColWidth = this.extDt.getColumnWidth(this.getColumnsNumber()-1);
if (ClientUILib.isIE){
this.lastColWidth -= 15;
- }
+ }
+ this._redrawTable(this.extDt.tableB);
},
OnSepClick: function(event) {
@@ -221,7 +221,7 @@
srcElement: Event.element(event),
dragStarted: false,
mouseDown: true,
- startX: Event.pointerX(event) - this.extDt.outerDiv.getX(),
+ startX: Event.pointerX(event),
originalX: 0
};
var srcElement = this.dragColumnInfo.srcElement;
@@ -240,7 +240,7 @@
this._createSplitter();
}
- var pos = this.dragColumnInfo.startX;
+ var pos = this.dragColumnInfo.srcElement.offsetLeft;
pos += 6; //6 stands for width of the separatorSpan
this.dragColumnInfo.originalX = pos;
this.columnSplitter.show();
@@ -270,17 +270,12 @@
this.dragColumnInfo.mouseDown = false;
var delta = Event.pointerX(event) -
- this.dragColumnInfo.startX -
- this.extDt.outerDiv.getX();
+ this.dragColumnInfo.startX;
if (delta < this.minDelta) {
delta = this.minDelta;
}
if (delta > this.maxDelta) {
delta = this.maxDelta;
- }
- if (ClientUILib.isIE) {
- // sep span width
- delta -= 6;
}
var columnIndex = this.dragColumnInfo.srcElement.columnIndex;
var newWidth = this.getColumnWidth(columnIndex) + delta;
@@ -307,8 +302,7 @@
this._showSplitter(this.dragColumnInfo.srcElement.columnIndex);
}
var delta = Event.pointerX(event) -
- this.dragColumnInfo.startX -
- this.extDt.outerDiv.getX();
+ this.dragColumnInfo.startX
if (delta < this.minDelta) {
delta = this.minDelta;
}
@@ -322,12 +316,12 @@
}
},
_redrawTable: function(table) {
- table.hide();
+ table.hide(); //this is for opera < 9.5
var tr = table.insertRow(0);
var td = tr.insertCell(0);
td.setAttribute("colspan", 5);
td.innerHTML = "safari-must-have-something-inserted-to-redraw-table";
- table.deleteRow(tr);
+ table.deleteRow(tr.rowIndex);
table.show();
}
});
\ No newline at end of file
Modified:
branches/3.2.x/ui/extendedDataTable/src/main/javascript/ClientUI/controls/datatable/ExtendedDataTableSelection.js
===================================================================
---
branches/3.2.x/ui/extendedDataTable/src/main/javascript/ClientUI/controls/datatable/ExtendedDataTableSelection.js 2008-09-15
16:27:56 UTC (rev 10443)
+++
branches/3.2.x/ui/extendedDataTable/src/main/javascript/ClientUI/controls/datatable/ExtendedDataTableSelection.js 2008-09-15
22:55:22 UTC (rev 10444)
@@ -284,7 +284,8 @@
if(!groupingExists) { //simple listener binding
if(this.options.selectionMode != "none") {
for(var i = 0; i < this.rowCount; i++) {
- rowIndex = Number(nrows[i].id.split(this.prefix)[1].split(":")[2]);
+ var arr = nrows[i].id.split(this.prefix)[1].split(":");
+ rowIndex = Number(arr[arr.length-1]);
this.addListener(nrows[i], rowIndex);
}
}
@@ -322,8 +323,9 @@
lastGroupId = groupId;
} else {
if(this.options.selectionMode != "none") {
- rowIndex = Number(nrows[i].id.split(this.prefix)[1].split(":")[2]);
- this.addListener(nrows[i], rowIndex);
+ var arr =
nrows[i].id.split(this.prefix)[1].split(":");
+ rowIndex = Number(arr[arr.length-1]);
+ this.addListener(nrows[i], rowIndex);
}
groupItems[groupItem++] = nrows[i];
if ( (i==0) && (bHideFirstRow) ) {
@@ -581,8 +583,12 @@
this.removeRowFromSelection(j);
}
}
+ if(range[0] == range[1]) {
+ this.addRowToSelection(range[0]);
+ return;
+ }
var i = range[0];
- range[1] = (range[1] + 1) % this.rowCount;
+ range[1] = (range[1] + 1) % this.rowCount;
while (i != range[1]) {
this.addRowToSelection(i);
i = (i + 1) % this.rowCount;
Modified:
branches/3.2.x/ui/extendedDataTable/src/main/resources/org/richfaces/renderkit/html/css/extendedDataTable.xcss
===================================================================
---
branches/3.2.x/ui/extendedDataTable/src/main/resources/org/richfaces/renderkit/html/css/extendedDataTable.xcss 2008-09-15
16:27:56 UTC (rev 10443)
+++
branches/3.2.x/ui/extendedDataTable/src/main/resources/org/richfaces/renderkit/html/css/extendedDataTable.xcss 2008-09-15
22:55:22 UTC (rev 10444)
@@ -10,6 +10,7 @@
.extdt-table-layout {
table-layout: fixed;
+ border-spacing: 0;
}
.extdt-table-filterrow {
@@ -32,6 +33,7 @@
}
.extdt-fakeierow {
+ display: none;
}
.extdt-thead {
Modified:
branches/3.2.x/ui/extendedDataTable/src/main/templates/org/richfaces/htmlExtendedDataTable.jspx
===================================================================
---
branches/3.2.x/ui/extendedDataTable/src/main/templates/org/richfaces/htmlExtendedDataTable.jspx 2008-09-15
16:27:56 UTC (rev 10443)
+++
branches/3.2.x/ui/extendedDataTable/src/main/templates/org/richfaces/htmlExtendedDataTable.jspx 2008-09-15
22:55:22 UTC (rev 10444)
@@ -83,7 +83,9 @@
<div id="#{clientId}:cs" class="extdt-hsplit"
style="display: none;"/>
<table id="#{clientId}:tu"
class="extdt-table-layout rich-table
#{component.attributes['styleClass']}"
- style="visibility:hidden;"
+ style="visibility:hidden;"
+ cellpadding="0"
+ cellspacing="0"
width="100%"
<colgroup
id="#{clientId}:colgroup:header">
@@ -96,8 +98,10 @@
<td colspan="#{columnsCount}" style="padding: 0px;">
<div id="#{clientId}:sd" class="extdt-content"
style="height:50px;width:100%;">
<table id="#{clientId}:n" width="100%"
- class="extdt-table-layout rich-table
#{component.attributes['styleClass']}"
- style="#{component.attributes['style']}"
+ class="extdt-table-layout rich-table
#{component.attributes['styleClass']}"
+ style="#{component.attributes['style']}"
+ cellpadding="0"
+ cellspacing="0"
<f:call
name="utils.encodePassThruWithExclusions">
<f:parameter
value="height,value,name,type,id,class,rows,style,width" />