incubator-xap-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mtu...@apache.org
Subject svn commit: r465717 - in /incubator/xap/trunk/src/xap: bridges/dojo/PasswordFieldBridge.js bridges/dojo/TextAreaBridge.js bridges/dojo/TextFieldBridge.js widgets/dojo/PasswordField.js widgets/dojo/TextArea.js
Date Thu, 19 Oct 2006 18:34:59 GMT
Author: mturyn
Date: Thu Oct 19 11:34:58 2006
New Revision: 465717

URL: http://svn.apache.org/viewvc?view=rev&rev=465717
Log:
All done; selectability seems fairly impossible to change in TextArea, and textchange events
still aren't being broadcast after mouse-based editing, but these are stable enough for now.

Modified:
    incubator/xap/trunk/src/xap/bridges/dojo/PasswordFieldBridge.js
    incubator/xap/trunk/src/xap/bridges/dojo/TextAreaBridge.js
    incubator/xap/trunk/src/xap/bridges/dojo/TextFieldBridge.js
    incubator/xap/trunk/src/xap/widgets/dojo/PasswordField.js
    incubator/xap/trunk/src/xap/widgets/dojo/TextArea.js

Modified: incubator/xap/trunk/src/xap/bridges/dojo/PasswordFieldBridge.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/src/xap/bridges/dojo/PasswordFieldBridge.js?view=diff&rev=465717&r1=465716&r2=465717
==============================================================================
--- incubator/xap/trunk/src/xap/bridges/dojo/PasswordFieldBridge.js (original)
+++ incubator/xap/trunk/src/xap/bridges/dojo/PasswordFieldBridge.js Thu Oct 19 11:34:58 2006
@@ -30,7 +30,7 @@
  /**
  * @fileoverview
  * 
- * A bridge class with dojo toolkit box panel peer.
+ * A bridge class with dojo wrapping of a standard html password field for a peer.
  */
  
 xap.bridges.dojo.PasswordFieldBridge= function() {

Modified: incubator/xap/trunk/src/xap/bridges/dojo/TextAreaBridge.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/src/xap/bridges/dojo/TextAreaBridge.js?view=diff&rev=465717&r1=465716&r2=465717
==============================================================================
--- incubator/xap/trunk/src/xap/bridges/dojo/TextAreaBridge.js (original)
+++ incubator/xap/trunk/src/xap/bridges/dojo/TextAreaBridge.js Thu Oct 19 11:34:58 2006
@@ -23,66 +23,67 @@
 
 Xap.provide("xap.bridges.dojo.TextAreaBridge"); 
 
-Xap.require("xap.bridges.dojo.DojoWidgetBridge");
+Xap.require("xap.bridges.dojo.TextFieldBridge");
 Xap.require("xap.widgets.dojo.TextArea"); 
 Xap.require("xap.session.ClientEvent"); 
 
  /**
  * @fileoverview
  * 
- * A bridge class with dojo toolkit box panel peer.
+ * A bridge class with dojo wrapping of a standard text area for a peer.
  */
  
 xap.bridges.dojo.TextAreaBridge= function() {
-	xap.bridges.dojo.DojoWidgetBridge.call(this);
+	xap.bridges.dojo.TextFieldBridge.call(this);
+	this.lastMouseDown = 0 ;
 }
 
 
+
+
 Xap.setupClassAsSubclassOf(
 				"xap.bridges.dojo.TextAreaBridge",
-				"xap.bridges.dojo.DojoWidgetBridge"						
+				"xap.bridges.dojo.TextFieldBridge"						
 );
 
-
-
 xap.bridges.dojo.TextAreaBridge.prototype.init = function() {
-	this.superclass.init.call(this);
-	
-	//add listener last so we don't fire for the initial set
-	dojo.event.connect(this.getPeer(), "onblur",this,"onblur");	
+	xap.bridges.dojo.TextFieldBridge.prototype.init.call(this);	
+	dojo.event.connect(this.getPeer(), "onselect",this,"onSelect");	
+	dojo.event.connect(this.getPeer(), "onmousedown",this,"onMousedown");			
 }
 
 xap.bridges.dojo.TextAreaBridge.prototype.getPeerString = function(){
     return "TextArea" ;
 }
 
+
+xap.bridges.dojo.TextAreaBridge.prototype.setSelectableAttribute = function( bSelectable
){
+	if( this.getPeer().isReadOnly() ){
+		//ineditability trumps selectability setting:
+		return ;
+	}
+	this.writeBackAttribute("selectable",bSelectable);	
+	this._selectable = bSelectable ;
+	this.lastMouseDown = 0 ;
+}	 
  
-/**
- * 
- * 
- * Attribute definitions
- * 
- */ 
- 
- 
-/**
- * No new dynamic attributes
- */
-xap.bridges.dojo.TextAreaBridge.prototype.getNewAllowedAttributes = function(){
-	return ["text"];
-}	
-
-xap.bridges.dojo.TextAreaBridge.prototype.setTextAttribute = function( value ){
-	this.getPeer().setText(value);
-}	
-
-xap.bridges.dojo.TextAreaBridge.prototype.onblur = function( ){
-	var text = this.getPeer().getText();
-	this.writeBackAttribute("text",text);
-	var clientEvent = new xap.session.ClientEvent(this.getElement(),this.getSession());
-	clientEvent.text = text;
-	this.fireEvent("onEdit",null,null,clientEvent);
-}	
+xap.bridges.dojo.TextAreaBridge.prototype.onSelect = function(event){
+// Defaults to "true":
+	if( this._selectable == "false" ){
+		event.explicitOriginalTarget.selectionStart		
+			= event.explicitOriginalTarget.selectionEnd
+				= this.lastMouseDown ;
+
+		return false ;
+		
+	} else {
+		return true ;
+	}
+}
 
+xap.bridges.dojo.TextAreaBridge.prototype.onMousedown = function(event){
+	this.lastMouseDown = event.explicitOriginalTarget.selectionStart ;
+	this.onTextChange( event ) ;
+}
 
 

Modified: incubator/xap/trunk/src/xap/bridges/dojo/TextFieldBridge.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/src/xap/bridges/dojo/TextFieldBridge.js?view=diff&rev=465717&r1=465716&r2=465717
==============================================================================
--- incubator/xap/trunk/src/xap/bridges/dojo/TextFieldBridge.js (original)
+++ incubator/xap/trunk/src/xap/bridges/dojo/TextFieldBridge.js Thu Oct 19 11:34:58 2006
@@ -27,7 +27,7 @@
 Xap.require("xap.widgets.dojo.TextField"); 
 Xap.require("xap.session.ClientEvent"); 
 Xap.require("dojo.html") ;
-
+Xap.require("xap.xml.XmlTokens") ;
  /**
  * @fileoverview
  * 
@@ -51,7 +51,8 @@
 	xap.bridges.dojo.DojoWidgetBridge.prototype.init.call(this);
 	
 	//add listener last so we don't fire for the initial set
-	dojo.event.connect(this.getPeer(), "onkeyup",this,"onTextChange");	
+	dojo.event.connect(this.getPeer(), "onkeyup",this,"onTextChange");
+	//dojo.event.connect(this.getPeer(), "onmouseup",this,"onTextChange");		
 	dojo.event.connect(this.getPeer(), "onchange",this,"onEdit");			
 }
 

Modified: incubator/xap/trunk/src/xap/widgets/dojo/PasswordField.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/src/xap/widgets/dojo/PasswordField.js?view=diff&rev=465717&r1=465716&r2=465717
==============================================================================
--- incubator/xap/trunk/src/xap/widgets/dojo/PasswordField.js (original)
+++ incubator/xap/trunk/src/xap/widgets/dojo/PasswordField.js Thu Oct 19 11:34:58 2006
@@ -34,10 +34,10 @@
 	xap.widgets.dojo.TextField.call(this);
 	// These will override the equivalent fields 
 	// that would otherwise be picked up in extend:
-	this.templateString ="<input type=\"password\" dojoAttachEvent=\"onchange;onkeyup;\"></input>"
;
+	this.templateString ="<input type=\"password\" dojoAttachEvent=\"onkeyup;onchange;onmouseup;\"></input>"
;
 	this.widgetType = "PasswordField" ;
 }
-dojo.inherits(xap.widgets.dojo.PasswordField, dojo.widget.HtmlWidget);
+dojo.inherits(xap.widgets.dojo.PasswordField, xap.widgets.dojo.TextField);
 
 // As noted above, the templateString and widgetType have
 // already been set for this constructore, so they won't

Modified: incubator/xap/trunk/src/xap/widgets/dojo/TextArea.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/src/xap/widgets/dojo/TextArea.js?view=diff&rev=465717&r1=465716&r2=465717
==============================================================================
--- incubator/xap/trunk/src/xap/widgets/dojo/TextArea.js (original)
+++ incubator/xap/trunk/src/xap/widgets/dojo/TextArea.js Thu Oct 19 11:34:58 2006
@@ -15,7 +15,7 @@
  *
  */
  
-//IMPORTANT move this to some shared area
+ //IMPORTANT move this to some shared area
 dojo.widget.manager.registerWidgetPackage("xap.widgets.dojo");
 
 Xap.provide("xap.widgets.dojo.TextArea");
@@ -27,20 +27,21 @@
 dojo.require("dojo.style");
 dojo.require("dojo.event");
 
+
 dojo.widget.tags.addParseTreeHandler("dojo:TextArea");
 
 xap.widgets.dojo.TextArea = function(){
 	xap.widgets.dojo.TextField.call(this);
 	// These will override the equivalent fields 
 	// that would otherwise be picked up in extend:
-	this.templateString ="<input type=\"textarea\" dojoAttachEvent=\"onchange;onkeyup;\"></input>"
;
-	this.widgetType = "TextArea" ;	
+	this.templateString ="<textarea  wrap=\"hard\" dojoAttachEvent=\"onselect;onkeyup;onchange;onmousedown;\"></textarea>"
;
+	this.widgetType = "TextArea" ;
 }
-dojo.inherits(xap.widgets.dojo.TextArea, xap.widgets.dojo.TextField);
+dojo.inherits(xap.widgets.dojo.TextArea, xap.widgets.dojo.TextField );
 
 // As noted above, the templateString and widgetType have
 // already been set for this constructore, so they won't
-// be reset by the ones for TextField when we mix it in:
+// be reset by the ones for TextField when we mix it in:				
 dojo.lang.extend(xap.widgets.dojo.TextArea, 
 					new xap.widgets.dojo.TextField()
 				) ;



Mime
View raw message