Author: vmolotkov
Date: 2008-08-14 11:26:02 -0400 (Thu, 14 Aug 2008)
New Revision: 10100
Modified:
trunk/ui/inplaceInput/src/main/resources/org/richfaces/renderkit/html/scripts/inplaceinput.js
trunk/ui/inplaceInput/src/main/templates/inplaceinput.jspx
Log:
https://jira.jboss.org/jira/browse/RF-2826
https://jira.jboss.org/jira/browse/RF-4147
Modified:
trunk/ui/inplaceInput/src/main/resources/org/richfaces/renderkit/html/scripts/inplaceinput.js
===================================================================
---
trunk/ui/inplaceInput/src/main/resources/org/richfaces/renderkit/html/scripts/inplaceinput.js 2008-08-14
15:02:08 UTC (rev 10099)
+++
trunk/ui/inplaceInput/src/main/resources/org/richfaces/renderkit/html/scripts/inplaceinput.js 2008-08-14
15:26:02 UTC (rev 10100)
@@ -11,7 +11,7 @@
this.tempValueKeeper = $(temValueKeepId);
this.valueKeeper = $(valueKeepId);
this.attributes = attributes;
- this.tabber = $(tabberId);
+ //this.tabber = $(tabberId);
this.events = events;
this.classes = classes;
@@ -50,6 +50,7 @@
this.inplaceInput.observe("mouseover",
this.inplaceMouseOverHandler.bindAsEventListener(this));
//TODO: do like above - no need to create extra functions
+ this.tempValueKeeper.observe("focus",
function(e){this.switchingStatesHandler(e);}.bindAsEventListener(this));
this.tempValueKeeper.observe("blur",
function(e){this.tmpValueBlurHandler(e);}.bindAsEventListener(this));
this.tempValueKeeper.observe("keydown",
function(e){this.tmpValueKeyDownHandler(e);}.bindAsEventListener(this));
@@ -63,10 +64,9 @@
//this.bar.bar.observe("mousedown",
function(e){this.barMouseDownHandler(e);}.bindAsEventListener(this));
}
+ //this.tabber.observe("focus",
function(e){this.switchingStatesHandler(e);}.bindAsEventListener(this));
+ //this.tabber.observe("blur",
function(e){this.tmpValueBlurHandler(e);}.bindAsEventListener(this));
- this.tabber.observe("focus",
function(e){this.switchingStatesHandler(e);}.bindAsEventListener(this));
- this.tabber.observe("blur",
function(e){this.tmpValueBlurHandler(e);}.bindAsEventListener(this));
-
},
initEvents : function() {
@@ -106,26 +106,16 @@
//TODO: Event.element here?
switchingStatesHandler : function(e) {
+ if (this.skipSwitching) {
+ this.skipSwitching = false;
+ return;
+ }
var el = (e.srcElement) ? e.srcElement : e.target;
- if ((el.id == this.inplaceInput.id) || (e.type == "focus")) {
-
- var target;
- if (e.target) {
- target = e.target;
- } else if (target = e.srcElement) {
- target = e.srcElement;
- } else {
- //TO DO: to catch this exception
- }
- if (target.tagName.toLowerCase() == "input") {
- if (target.id == this.tabber.id) {
- this.byTab = true;
- } else {
- return;
- }
- }
- this.edit();
- }
+ if (el.id == this.inplaceInput.id) {
+ this.skipSwitching = true;
+ this.tempValueKeeper.focus();
+ }
+ this.edit();
},
edit: function (){
@@ -140,7 +130,7 @@
tmpValueBlurHandler : function() {
if (this.clickOnBar || this.byTab) {
this.clickOnBar = false;
- this.byTab = false;
+ //this.byTab = false;
return;
}
@@ -164,7 +154,7 @@
break;
case Event.KEY_TAB :
this.save();
- this.byTab = true;
+ //this.byTab = true;
break;
}
},
@@ -195,8 +185,12 @@
if (this.bar) {
this.bar.hide();
}
- this.tabber.show();
- this.tempValueKeeper.hide();
+
+ //Event.stopObserving(this.tabber, "focus",
this.switchingStatesHandler.bindAsEventListener(this));
+ //this.tabber.observe("focus",
this.switchingStatesHandler.bindAsEventListener(this));
+
+ this.tempValueKeeper.style.clip = 'rect(0px,0px,10px,10px)';
+ //this.tempValueKeeper.hide();
},
/*endChangedState : function() {
@@ -204,14 +198,18 @@
},*/
startEditableState : function() {
+ if (this.currentState == Richfaces.InplaceInput.STATES[1]) {
+ return;
+ }
this.inplaceInput.style.position = "relative";
this.changeState(Richfaces.InplaceInput.STATES[1]);
var textWidth= this.inplaceInput.offsetWidth;
var inputSize = this.setInputWidth(textWidth);
- this.tabber.hide();
+ //this.tabber.hide();
- this.tempValueKeeper.show();
+ //this.tempValueKeeper.show();
+ this.tempValueKeeper.style.clip = 'rect(auto,auto,auto,auto)';
this.inplaceInput.className = this.classes.COMPONENT.EDITABLE;
if (this.bar) {
@@ -222,7 +220,6 @@
//TODO: implement Select all method?
Richfaces.InplaceInput.textboxSelect(this.tempValueKeeper, 0,
this.tempValueKeeper.value.length);
}
- this.tempValueKeeper.focus();
},
startViewState : function() {
@@ -370,14 +367,14 @@
},
deleteViewArtifacts : function () {
- var text = this.inplaceInput.childNodes[4];
+ var text = this.inplaceInput.childNodes[3];
if (text) {
this.inplaceInput.removeChild(text);
}
},
//TODO: search within childNodes for textNode.value().trim().length == 0?
getCurrentText : function() {
- return this.inplaceInput.childNodes[4];
+ return this.inplaceInput.childNodes[3];
},
createNewText : function(text) {
Modified: trunk/ui/inplaceInput/src/main/templates/inplaceinput.jspx
===================================================================
--- trunk/ui/inplaceInput/src/main/templates/inplaceinput.jspx 2008-08-14 15:02:08 UTC
(rev 10099)
+++ trunk/ui/inplaceInput/src/main/templates/inplaceinput.jspx 2008-08-14 15:26:02 UTC
(rev 10100)
@@ -86,10 +86,9 @@
}
</jsp:scriptlet>
- <input id="#{clientId}tabber" type="button" value=""
style="width: 1px; position: absolute; left: -32767px;"
tabindex='#{component.attributes["tabindex"]}'/>
<input id='#{clientId}tempValue'
class='rich-inplace-field'
- style='display:none;'
+ style='clip:rect(0px,0px,10px,10px)'
type='text'
autocomplete="off"
value='#{fieldValue}'