Author: vmolotkov
Date: 2008-03-06 15:48:48 -0500 (Thu, 06 Mar 2008)
New Revision: 6611
Modified:
trunk/ui/inplaceInput/src/main/resources/org/richfaces/renderkit/html/scripts/inplaceinput.js
trunk/ui/inplaceInput/src/main/templates/inplaceinput.jspx
Log:
template was changed.
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-03-06
20:30:53 UTC (rev 6610)
+++
trunk/ui/inplaceInput/src/main/resources/org/richfaces/renderkit/html/scripts/inplaceinput.js 2008-03-06
20:48:48 UTC (rev 6611)
@@ -4,7 +4,7 @@
Richfaces.InplaceInput.prototype = {
- initialize: function(clientId, temValueKeepId, valueKeepId, tabberId, strutId,
attributes, events, classes, barParams) {
+ initialize: function(clientId, temValueKeepId, valueKeepId, tabberId, strutId,
attributes, events, classes, barParams, textId) {
this.inplaceInput = $(clientId);
this.inplaceInput.component = this;
@@ -17,6 +17,8 @@
this.classes = classes;
+ this.textNode = $(textId);
+
this.currentText = this.getCurrentText();
this.value = this.valueKeeper.value;
@@ -170,6 +172,7 @@
if (this.bar) {
this.bar.hide();
}
+ this.textPositioning(this.coords);
this.tabber.show();
this.tempValueKeeper.hide();
},
@@ -182,15 +185,16 @@
this.changeState(Richfaces.InplaceInput.STATES[1]);
var inputSize = this.setInputWidth(textSize);
- var coordsVal = Richfaces.InplaceInput.getElemXY(this.inplaceInput);
- var coordsStrut = Richfaces.InplaceInput.getElemXY(this.strut);
-
this.tabber.hide();
+ this.coords = this.getCoords();
this.inplaceInput.className = this.classes.COMPONENT.EDITABLE;
this.setStrutWidth(textSize);
+
+ var strCoord = Richfaces.InplaceInput.getElemXY(this.strut);
+
this.tempValueKeeper.style.left = 0 + "px";
- this.tempValueKeeper.style.top = (coordsVal.top - coordsStrut.top) + "px";
+ this.tempValueKeeper.style.top = (this.coords.top - strCoord.top)+ "px";
this.tempValueKeeper.show();
@@ -206,7 +210,7 @@
setStrutWidth : function(textSize) {
this.tempValueKeeper.show();
- this.strut.style.width = "100px";
+ this.strut.style.width = textSize + "px";
this.strut.show();
},
@@ -214,10 +218,11 @@
this.changeState(Richfaces.InplaceInput.STATES[0]);
this.createNewText(this.currentText);
+
this.inplaceInput.className = this.classes.COMPONENT.VIEW.NORMAL;
this.inplaceInput.observe("mouseover",
function(e){this.inplaceMouseOverHandler(e);}.bindAsEventListener(this));
- this.strut.hide();
+ //this.strut.hide();
},
startChangedState : function () {
@@ -225,8 +230,9 @@
//this.createNewText(this.valueKeeper.value);
this.createNewText(this.currentText);
+
this.inplaceInput.className = this.classes.COMPONENT.CHANGED.NORMAL;
- this.strut.hide();
+ //this.strut.hide();
},
/**
@@ -322,20 +328,33 @@
},
deleteViewArtifacts : function () {
- var text = this.inplaceInput.childNodes[5];
+ var text = this.textNode.firstChild;
if (text) {
- this.inplaceInput.removeChild(text);
+ this.textNode.removeChild(text);
}
},
getCurrentText : function() {
- return this.inplaceInput.childNodes[5];
+ return this.textNode.firstChild;
},
createNewText : function(text) {
if (!this.getCurrentText()) {
- this.inplaceInput.appendChild(document.createTextNode(text.nodeValue||text));
+ this.textNode.appendChild(document.createTextNode(text.nodeValue||text));
}
+ },
+
+ textPositioning : function(coord) {
+ this.textNode.style.left = coord.left + "px";
+ this.textNode.style.top = coord.top + "px";
+ },
+
+ getCoords: function() {
+ var coordsVal = Richfaces.InplaceInput.getElemXY(this.inplaceInput);
+ var coordsStrut = Richfaces.InplaceInput.getElemXY(this.strut);
+
+ //return {top : (coordsVal.top - coordsStrut.top), left : 0};
+ return {top : coordsVal.top, left : coordsVal.left};
}
};
Modified: trunk/ui/inplaceInput/src/main/templates/inplaceinput.jspx
===================================================================
--- trunk/ui/inplaceInput/src/main/templates/inplaceinput.jspx 2008-03-06 20:30:53 UTC
(rev 6610)
+++ trunk/ui/inplaceInput/src/main/templates/inplaceinput.jspx 2008-03-06 20:48:48 UTC
(rev 6611)
@@ -60,7 +60,7 @@
<span id="#{clientId}" class='rich-inplace rich-inplace-view
#{component.attributes["styleClass"]}'
x:passThruWithExclusions="id,styleClass,class,style">
<input id="#{clientId}tabber" type="button" value=""
style="width: 1px; position: absolute; left: -32767px;" />
- <img id="#{clientId}strut" src="#{spacer}"
class="rich-inplace-input-strut"/>
+ <img id="#{clientId}strut" src="#{spacer}"
class="rich-inplace-input-strut" style="width:100px"/>
<input id='#{clientId}tempValue'
class='rich-inplace-field'
style='display:none;position:absolute;'
@@ -139,7 +139,7 @@
]]>
</jsp:scriptlet>
</div>
- #{value}
+ <span id="#{clientId}text"
style="position:absolute;">#{value}</span>
</span>
@@ -149,6 +149,9 @@
#{this:encodeScriptEvents(context, component)};
#{this:encodeInplaceInputCss(context, component)};
- var inplaceInput = new Richfaces.InplaceInput('#{clientId}',
'#{clientId}tempValue', '#{clientId}value', '#{clientId}tabber',
'#{clientId}strut', attributes, events, classes, ['#{clientId}bar',
'#{clientId}ok', '#{clientId}cancel',
'#{clientId}buttons','#{clientId}btns_shadow']);
+ var inplaceInput = new Richfaces.InplaceInput('#{clientId}',
'#{clientId}tempValue', '#{clientId}value', '#{clientId}tabber',
+ '#{clientId}strut', attributes, events, classes,
['#{clientId}bar',
+ '#{clientId}ok', '#{clientId}cancel',
'#{clientId}buttons','#{clientId}btns_shadow'],
+ '#{clientId}text');
</script>
</f:root>
\ No newline at end of file