You are viewing a plain text version of this content. The canonical link for it is here.
Posted to xap-commits@incubator.apache.org by jm...@apache.org on 2006/12/13 02:37:05 UTC
svn commit: r486468 - in /incubator/xap/trunk/src/xap:
bridges/dojo/HorizontalPanelBridge.js bridges/dojo/VerticalPanelBridge.js
taghandling/AbstractTagImpl.js widgets/dojo/HorizontalPanel.js
widgets/dojo/VerticalPanel.js
Author: jmargaris
Date: Tue Dec 12 18:37:04 2006
New Revision: 486468
URL: http://svn.apache.org/viewvc?view=rev&rev=486468
Log:
insert before was not working in all cases including the first position and the last position
Modified:
incubator/xap/trunk/src/xap/bridges/dojo/HorizontalPanelBridge.js
incubator/xap/trunk/src/xap/bridges/dojo/VerticalPanelBridge.js
incubator/xap/trunk/src/xap/taghandling/AbstractTagImpl.js
incubator/xap/trunk/src/xap/widgets/dojo/HorizontalPanel.js
incubator/xap/trunk/src/xap/widgets/dojo/VerticalPanel.js
Modified: incubator/xap/trunk/src/xap/bridges/dojo/HorizontalPanelBridge.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/src/xap/bridges/dojo/HorizontalPanelBridge.js?view=diff&rev=486468&r1=486467&r2=486468
==============================================================================
--- incubator/xap/trunk/src/xap/bridges/dojo/HorizontalPanelBridge.js (original)
+++ incubator/xap/trunk/src/xap/bridges/dojo/HorizontalPanelBridge.js Tue Dec 12 18:37:04 2006
@@ -83,7 +83,7 @@
flexInt= parseInt(flex);
}
- var insertIndex = index < 0 ? this.getPeer().children.length : index;
+ var insertIndex = index >= 0 ? index: this.getPeer().children.length;
var childPeer = this.getDojoWidgetPeer(childHandler);
if (childPeer) {
this.getPeer().addChild(childPeer, null, 'insertAtIndex', null, insertIndex, flexInt);
Modified: incubator/xap/trunk/src/xap/bridges/dojo/VerticalPanelBridge.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/src/xap/bridges/dojo/VerticalPanelBridge.js?view=diff&rev=486468&r1=486467&r2=486468
==============================================================================
--- incubator/xap/trunk/src/xap/bridges/dojo/VerticalPanelBridge.js (original)
+++ incubator/xap/trunk/src/xap/bridges/dojo/VerticalPanelBridge.js Tue Dec 12 18:37:04 2006
@@ -82,7 +82,7 @@
flexInt= parseInt(flex);
}
- var insertIndex = index < 0 ? this.getPeer().children.length : index;
+ var insertIndex = index >= 0 ? index: this.getPeer().children.length;
var childPeer = this.getDojoWidgetPeer(childHandler);
if (childPeer) {
this.getPeer().addChild(childPeer, null, 'insertAtIndex', null, insertIndex, flexInt);
Modified: incubator/xap/trunk/src/xap/taghandling/AbstractTagImpl.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/src/xap/taghandling/AbstractTagImpl.js?view=diff&rev=486468&r1=486467&r2=486468
==============================================================================
--- incubator/xap/trunk/src/xap/taghandling/AbstractTagImpl.js (original)
+++ incubator/xap/trunk/src/xap/taghandling/AbstractTagImpl.js Tue Dec 12 18:37:04 2006
@@ -123,7 +123,7 @@
xap.taghandling.AbstractTagImpl.prototype.setElement = function( el, addEvent ) {
this._element = el;
- if (addEvent){
+ if (addEvent && addEvent.getIndex()>=0){
this._index = addEvent.getIndex();
}
}
@@ -252,7 +252,7 @@
//use the saved index if we had one, otherwise add to the end
//when we are attaching an entire subtree only the root of
//that subtree should have an index
- var index = this._index? this._index:-1;
+ var index = this._index>=0?this._index:-1;
var event = new xap.xml.dom.events.StructureChangeEvent( e, this.getElement(), index );
parentHandler.beforeChildAdded( event );
@@ -260,7 +260,10 @@
//childAdded directly instead
parentHandler.childAdded( event );
- if (this._index){
+
+
+ //if we were saving an index delete it now
+ if (this._index>=0){
delete this._index;
}
}
Modified: incubator/xap/trunk/src/xap/widgets/dojo/HorizontalPanel.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/src/xap/widgets/dojo/HorizontalPanel.js?view=diff&rev=486468&r1=486467&r2=486468
==============================================================================
--- incubator/xap/trunk/src/xap/widgets/dojo/HorizontalPanel.js (original)
+++ incubator/xap/trunk/src/xap/widgets/dojo/HorizontalPanel.js Tue Dec 12 18:37:04 2006
@@ -57,8 +57,8 @@
child.domNode.flex = flex;
- if (insertIndex && insertIndex >= 0 && insertIndex < row.childNodes.length - 2) {
- row.insertBefore(cell, row.childNodes[insertIndex + 1]);
+ if (insertIndex >= 0 && insertIndex < row.childNodes.length ) {
+ row.insertBefore(cell, row.childNodes[insertIndex]);
}
else{
row.appendChild(cell);
Modified: incubator/xap/trunk/src/xap/widgets/dojo/VerticalPanel.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/src/xap/widgets/dojo/VerticalPanel.js?view=diff&rev=486468&r1=486467&r2=486468
==============================================================================
--- incubator/xap/trunk/src/xap/widgets/dojo/VerticalPanel.js (original)
+++ incubator/xap/trunk/src/xap/widgets/dojo/VerticalPanel.js Tue Dec 12 18:37:04 2006
@@ -59,8 +59,8 @@
var tBody = this.centerTbody;
- if (insertIndex && insertIndex >= 0 && insertIndex < tBody.childNodes.length - 2) {
- tBody.insertBefore(row, tBody.childNodes[insertIndex + 1]);
+ if (insertIndex >= 0 && insertIndex < tBody.childNodes.length) {
+ tBody.insertBefore(row, tBody.childNodes[insertIndex]);
}
else{
tBody.appendChild(row);