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/11/10 19:39:31 UTC
svn commit: r473445 - in /incubator/xap/trunk/src/xap/taghandling:
AbstractTagImpl.js PluginDocumentHandler.js
Author: jmargaris
Date: Fri Nov 10 11:39:31 2006
New Revision: 473445
URL: http://svn.apache.org/viewvc?view=rev&rev=473445
Log:
insert at an index working again (finally)
Modified:
incubator/xap/trunk/src/xap/taghandling/AbstractTagImpl.js
incubator/xap/trunk/src/xap/taghandling/PluginDocumentHandler.js
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=473445&r1=473444&r2=473445
==============================================================================
--- incubator/xap/trunk/src/xap/taghandling/AbstractTagImpl.js (original)
+++ incubator/xap/trunk/src/xap/taghandling/AbstractTagImpl.js Fri Nov 10 11:39:31 2006
@@ -119,8 +119,12 @@
*
* @param e The element this tag maps to.
*/
-xap.taghandling.AbstractTagImpl.prototype.setElement = function( el ) {
+xap.taghandling.AbstractTagImpl.prototype.setElement = function( el, addEvent ) {
this._element = el;
+
+ if (addEvent){
+ this._index = addEvent.getIndex();
+ }
}
/**
@@ -240,18 +244,21 @@
if (!xap.taghandling.AbstractTagImpl.TAIL_RECURSION){
var parentElement = this.getElement().parentNode;
var parentHandler = this.getUiContentHandler().getHandlerForElement( parentElement );
-
- //IMPORTANT -1 doesn't work here for insert at, it does for all the nested children
- //but not for adding to the original parent. We need to handle the non-tail
- //recursion case better in general. The nested children when first parsed can always
- //be handled like they are each appended to the end one at a time, but the root
- //of the subtree needs to be added with the right index
- var event = new xap.xml.dom.events.StructureChangeEvent( e, this.getElement(), -1 );
+
+ //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 event = new xap.xml.dom.events.StructureChangeEvent( e, this.getElement(), index );
parentHandler.beforeChildAdded( event );
//don't call the onChildAdded because it is being ignored, use
//childAdded directly instead
parentHandler.childAdded( event );
+
+ if (this._index){
+ delete this._index;
+ }
}
Modified: incubator/xap/trunk/src/xap/taghandling/PluginDocumentHandler.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/src/xap/taghandling/PluginDocumentHandler.js?view=diff&rev=473445&r1=473444&r2=473445
==============================================================================
--- incubator/xap/trunk/src/xap/taghandling/PluginDocumentHandler.js (original)
+++ incubator/xap/trunk/src/xap/taghandling/PluginDocumentHandler.js Fri Nov 10 11:39:31 2006
@@ -81,7 +81,7 @@
if( e.getType() == xap.xml.dom.events.StructureChangeEvent.TEXT_NODE ) {
return;
}
- this.parseChild( e.getChange() );
+ this.parseChild( e.getChange(), e );
}
/**
@@ -175,7 +175,7 @@
* mapping for.
* @return A new instance of the tag-handling class or null if no mapping exists.
*/
-xap.taghandling.PluginDocumentHandler.prototype.parseChild = function( childElement ) {
+xap.taghandling.PluginDocumentHandler.prototype.parseChild = function( childElement, event ) {
var handler = null;
var pluginRegistry = this._clientSession.getPluginRegistry();
@@ -262,7 +262,7 @@
//step 5: call setElement(), this is the signal that the bridge
- handler.setElement( childElement );
+ handler.setElement( childElement, event );
handler.init();
//finally fire the "onCreate" event