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 2007/09/13 22:29:22 UTC
svn commit: r575487 - in /incubator/xap/trunk/codebase/src/xap:
bridges/dojo/TextFieldBridge.js widgets/dojo/PasswordField.js
widgets/dojo/TextArea.js widgets/dojo/TextField.js
Author: jmargaris
Date: Thu Sep 13 15:29:21 2007
New Revision: 575487
URL: http://svn.apache.org/viewvc?rev=575487&view=rev
Log:
Added onCommand event processing for text entry fields when the enter key is pressed.
Modified:
incubator/xap/trunk/codebase/src/xap/bridges/dojo/TextFieldBridge.js
incubator/xap/trunk/codebase/src/xap/widgets/dojo/PasswordField.js
incubator/xap/trunk/codebase/src/xap/widgets/dojo/TextArea.js
incubator/xap/trunk/codebase/src/xap/widgets/dojo/TextField.js
Modified: incubator/xap/trunk/codebase/src/xap/bridges/dojo/TextFieldBridge.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/codebase/src/xap/bridges/dojo/TextFieldBridge.js?rev=575487&r1=575486&r2=575487&view=diff
==============================================================================
--- incubator/xap/trunk/codebase/src/xap/bridges/dojo/TextFieldBridge.js (original)
+++ incubator/xap/trunk/codebase/src/xap/bridges/dojo/TextFieldBridge.js Thu Sep 13 15:29:21 2007
@@ -54,7 +54,11 @@
//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(), "onmouseup",this,"onTextChange");
+
+ // add listener for keydown for onCommand on enter.
+ dojo.event.connect(this.getPeer(), "onkeydown",this,"onKeyDown");
+
+ //dojo.event.connect(this.getPeer(), "onmouseup",this,"onTextChange");
dojo.event.connect(this.getPeer(), "onchange",this,"onEdit");
// Handle going directly from the field to (e.g.) a button:
dojo.event.connect(this.getPeer(), "onmouseout",this,"onMouseOut");
@@ -86,6 +90,16 @@
this.lastText = value ;
this.getPeer().setText(value);
}
+
+xap.bridges.dojo.TextFieldBridge.prototype.onKeyDown = function( event ){
+ if (event.keyCode == 13) {
+ var clientEvent = new xap.session.ClientEvent(this.getElement(),this.getSession());
+ clientEvent.text = this.getPeer().getText();
+ clientEvent.originalEvent = event ;
+ this.lastKeyCode = event.keyCode ;
+ this.fireEvent("onCommand",null,null,clientEvent);
+ }
+}
xap.bridges.dojo.TextFieldBridge.prototype.onTextChange = function( event ){
var text = this.getPeer().getText() ;
Modified: incubator/xap/trunk/codebase/src/xap/widgets/dojo/PasswordField.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/codebase/src/xap/widgets/dojo/PasswordField.js?rev=575487&r1=575486&r2=575487&view=diff
==============================================================================
--- incubator/xap/trunk/codebase/src/xap/widgets/dojo/PasswordField.js (original)
+++ incubator/xap/trunk/codebase/src/xap/widgets/dojo/PasswordField.js Thu Sep 13 15:29:21 2007
@@ -36,7 +36,7 @@
xap.widgets.dojo.TextField.call(this);
// These will override the equivalent fields
// that would otherwise be picked up in extend:
- this.templateString ="<input style='border-style:solid' type='password' dojoAttachEvent='onkeyup;onchange;onmouseup;'></input>" ;
+ this.templateString ="<input style='border-style:solid' type='password' dojoAttachEvent='onkeyup;onchange;onkeydown;onmouseup;'></input>" ;
this.widgetType = "PasswordField" ;
}
dojo.inherits(xap.widgets.dojo.PasswordField, xap.widgets.dojo.TextField);
Modified: incubator/xap/trunk/codebase/src/xap/widgets/dojo/TextArea.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/codebase/src/xap/widgets/dojo/TextArea.js?rev=575487&r1=575486&r2=575487&view=diff
==============================================================================
--- incubator/xap/trunk/codebase/src/xap/widgets/dojo/TextArea.js (original)
+++ incubator/xap/trunk/codebase/src/xap/widgets/dojo/TextArea.js Thu Sep 13 15:29:21 2007
@@ -37,7 +37,7 @@
xap.widgets.dojo.TextField.call(this);
// These will override the equivalent fields
// that would otherwise be picked up in extend:
- this.templateString ="<textarea wrap=\"hard\" dojoAttachEvent=\"onselect;onkeyup;onchange;onmousedown;\"></textarea>" ;
+ this.templateString ="<textarea wrap=\"hard\" dojoAttachEvent=\"onselect;onkeyup;onchange;onkeydown;onmousedown;\"></textarea>" ;
this.widgetType = "TextArea" ;
}
dojo.inherits(xap.widgets.dojo.TextArea, xap.widgets.dojo.TextField );
Modified: incubator/xap/trunk/codebase/src/xap/widgets/dojo/TextField.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/codebase/src/xap/widgets/dojo/TextField.js?rev=575487&r1=575486&r2=575487&view=diff
==============================================================================
--- incubator/xap/trunk/codebase/src/xap/widgets/dojo/TextField.js (original)
+++ incubator/xap/trunk/codebase/src/xap/widgets/dojo/TextField.js Thu Sep 13 15:29:21 2007
@@ -42,7 +42,7 @@
var toMixIn =
{
- templateString: '<input type="text" dojoAttachEvent="onkeyup;onchange;onmouseout"></input>',
+ templateString: '<input type="text" dojoAttachEvent="onkeyup;onchange;onkeydown;onmouseout"></input>',
templateCssPath: null ,
widgetType: "TextField",
isContainer: false,