incubator-xap-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mtu...@apache.org
Subject svn commit: r524937 - /incubator/xap/trunk/codebase/src/xap/bridges/dojo/VerticalSplitPaneBridge.js
Date Mon, 02 Apr 2007 21:54:04 GMT
Author: mturyn
Date: Mon Apr  2 14:54:03 2007
New Revision: 524937

URL: http://svn.apache.org/viewvc?view=rev&rev=524937
Log:
Cleaned up by J.M.; old stuff that hadn't worked to tell which child was which hadn't been
removed.

Modified:
    incubator/xap/trunk/codebase/src/xap/bridges/dojo/VerticalSplitPaneBridge.js

Modified: incubator/xap/trunk/codebase/src/xap/bridges/dojo/VerticalSplitPaneBridge.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/codebase/src/xap/bridges/dojo/VerticalSplitPaneBridge.js?view=diff&rev=524937&r1=524936&r2=524937
==============================================================================
--- incubator/xap/trunk/codebase/src/xap/bridges/dojo/VerticalSplitPaneBridge.js (original)
+++ incubator/xap/trunk/codebase/src/xap/bridges/dojo/VerticalSplitPaneBridge.js Mon Apr 
2 14:54:03 2007
@@ -39,6 +39,7 @@
  
 xap.bridges.dojo.VerticalSplitPaneBridge= function() {
 	xap.bridges.dojo.DojoWidgetBridge.call(this);
+	this._splitPosition = 50;
 }
 
 
@@ -69,25 +70,6 @@
  */ 
  
 /**
- *  Is this a left or top pane's handler?
-**/  
-xap.bridges.dojo.VerticalSplitPaneBridge.panelIndex = function(handler){
-
-	var result = null ;
-	if( handler ){
-		if(handler._inSplitPanePiece == "left" 
-						|| handler._inSplitPanePiece == "top" ){
-			result = 0 ;
-		} else if(handler._inSplitPanePiece == "right" 
-						|| handler._inSplitPanePiece == "bottom" ){
-			result = 1 ;
-		}
-	}
-	return result ;
-}
-
- 
-/**
  * No new dynamic attributes
  */
 xap.bridges.dojo.VerticalSplitPaneBridge.prototype.getNewAllowedAttributes = function(){
@@ -95,30 +77,11 @@
 }	
 
 xap.bridges.dojo.VerticalSplitPaneBridge.prototype.addChild = function(childHandler, index){
-//xap.util.Utils.interrogate(childHandler.getElement(),true,20) ;	
 	var insertIndex = -1;
 
-	var childPeer = childHandler.getPeer()
-
-	var idx = xap.bridges.dojo.VerticalSplitPaneBridge.panelIndex(childHandler)	
-	if( (idx!=null )&& childPeer ){
-		childPeer._splitPaneIndex = idx ;
-	} else if (childHandler._proxyHandler){
-		// The real handler for the child component might
-		// be the proxy handler---e.g., for the <label/> in
-		// (e.g.) <left><label/></left>
-		idx 
-		= xap.bridges.dojo.VerticalSplitPaneBridge.panelIndex(childHandler._proxyHandler)
-		
-		var childProxyPeer = childHandler._proxyHandler.getPeer() ;
-		
-		if( (idx!=null )&& childProxyPeer ){
-			childProxyPeer._splitPaneIndex = idx ;
-		} 	
-
-	}	
-
-// alert("Found index "+idx+".") ;
+	//the peer here is the peer of the CHILD of the SplitChildBridge,
+	//kind of a quirk in how split child bridge works.
+	var childPeer = childHandler.getPeer();
 	
 	if (childHandler instanceof xap.bridges.dojo.SecondSplitChildBridge){
 		insertIndex = this.getPeer().children.length;
@@ -141,20 +104,12 @@
 
 
 xap.bridges.dojo.VerticalSplitPaneBridge.prototype.setSplitPositionAttribute = function(str){
+	//TODO what if str is "" or null?
 	this._splitPosition = dj_global.parseInt(str) ;
+	this._splitPosition = this._splitPosition || 50;
 	this.adjustSplitter() ;
 }
 
-xap.bridges.dojo.VerticalSplitPaneBridge.prototype.getSplitPositionFromElement = function(){
-	// Default for a two-panel split:
-		var result = 50 ;
-		var strPos = this.getElement().getAttribute("splitPosition") ;
-		if( strPos ){
-			result  = dj_global.parseInt(strPos) ;
-		}
-		return result ;
-}
-
 xap.bridges.dojo.VerticalSplitPaneBridge.prototype.init = function(e){
 	this._initted = false ;
 	xap.bridges.dojo.VerticalSplitPaneBridge.superclass.init.call(this,e) ;
@@ -168,7 +123,7 @@
 
 xap.bridges.dojo.VerticalSplitPaneBridge.prototype.adjustSplitter = function(){
 
-	splitPosition = this.getSplitPositionFromElement() ;
+	splitPosition =  this._splitPosition;
 	var children = this.getPeer().children ;
 	
 	// Are we looking for (e.g.) leftmost or topmost?
@@ -188,9 +143,13 @@
 	}	
 
 	if(children[0] && children[1]){
+		
+		//child0 is left/above child1
 		if(offset_0<offset_1){
 			children[0].sizeShare = splitPosition ;
 			children[1].sizeShare = 100 - splitPosition ;
+		
+		//child1 is left/above child2
 		} else if(offset_1<offset_0){
 			children[0].sizeShare = 100 - splitPosition ;
 			children[1].sizeShare = splitPosition ;			



Mime
View raw message