From xap-commits-return-866-apmail-incubator-xap-commits-archive=incubator.apache.org@incubator.apache.org Thu Dec 07 16:27:59 2006 Return-Path: Delivered-To: apmail-incubator-xap-commits-archive@locus.apache.org Received: (qmail 35588 invoked from network); 7 Dec 2006 16:27:58 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 7 Dec 2006 16:27:58 -0000 Received: (qmail 65070 invoked by uid 500); 7 Dec 2006 16:28:07 -0000 Delivered-To: apmail-incubator-xap-commits-archive@incubator.apache.org Received: (qmail 65044 invoked by uid 500); 7 Dec 2006 16:28:06 -0000 Mailing-List: contact xap-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: xap-dev@incubator.apache.org Delivered-To: mailing list xap-commits@incubator.apache.org Received: (qmail 65035 invoked by uid 99); 7 Dec 2006 16:28:06 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 07 Dec 2006 08:28:06 -0800 X-ASF-Spam-Status: No, hits=-9.4 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 07 Dec 2006 08:27:56 -0800 Received: by eris.apache.org (Postfix, from userid 65534) id AB8C91A9846; Thu, 7 Dec 2006 08:27:14 -0800 (PST) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r483526 - /incubator/xap/trunk/WebContent/examples/widgets/AttributeTester.js Date: Thu, 07 Dec 2006 16:27:14 -0000 To: xap-commits@incubator.apache.org From: mturyn@apache.org X-Mailer: svnmailer-1.1.0 Message-Id: <20061207162714.AB8C91A9846@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: mturyn Date: Thu Dec 7 08:27:13 2006 New Revision: 483526 URL: http://svn.apache.org/viewvc?view=rev&rev=483526 Log: 1.) Added function to report list/combobox text/value. 2.) Changed list item appending function so that: a.) ...each item will have a slightly different text and value b.) ...selected or unselected items can be added. 2.) Added function to allow attribute value entry using a carriage return---not necessary, but a.) convenient, and b.) a good illustration of how to do that sort of thing (keystroke filtering). Modified: incubator/xap/trunk/WebContent/examples/widgets/AttributeTester.js Modified: incubator/xap/trunk/WebContent/examples/widgets/AttributeTester.js URL: http://svn.apache.org/viewvc/incubator/xap/trunk/WebContent/examples/widgets/AttributeTester.js?view=diff&rev=483526&r1=483525&r2=483526 ============================================================================== --- incubator/xap/trunk/WebContent/examples/widgets/AttributeTester.js (original) +++ incubator/xap/trunk/WebContent/examples/widgets/AttributeTester.js Thu Dec 7 08:27:13 2006 @@ -1,6 +1,6 @@ AttributeTester = function(){} -// Used in checking MCO reolution: +// Used in checking MCO resolution: AttributeTesterAlias = AttributeTester ; @@ -8,10 +8,41 @@ element.setAttribute(name, value); } +// Hit 'return' in the "value" field, set the attribute: +AttributeTester.prototype.setAttributeOnCR = function(event,element, name, value){ + if(event.keyChar=='\r'){ + this.setAttribute(element,name,value) ; + } +} + + AttributeTester.prototype.getAttribute = function(element, name){ - return element.setAttribute(name); + return element.getAttribute(name); +} + +AttributeTester.prototype.getAttributeCaption = function(element, name){ + return "Name: '"+name+"', value: "+element.getAttribute(name)+"."; } +AttributeTester.prototype.reportTextValueAttributes = function(element){ + this.reportAttributes(element, ["text", "value"] ) ; +} + +AttributeTester.prototype.reportAttributes = function(element, names){ + var arr = names ; + if(typeof names == "string"){ + arr = [ names] ; + } + var attributeValuesString = "Attribute-->value\n"; + for ( var ii=0; ii" + +element.getAttribute(arr[ii])+"\n"; + } + alert(attributeValuesString) ; +} + + + AttributeTester.prototype.toggleBooleanAttribute = function(element, name){ var val = element.getAttribute(name) ; var newVal = (val=="true")?"false":"true" ; @@ -40,7 +71,7 @@ document.body.appendChild(l); this._logDiv = l; dojo.event.connect(this._logDiv, "ondblclick",this,"clearLog"); - this._logDiv.innerHTML="[Double-click to clear.]

" ; + this._logDiv.innerHTML="[Double-click to clear.]

" ; } text = text.replace(/&/g, '&').replace(//g, '>'); @@ -54,7 +85,20 @@ } -AttributeTester.prototype.clearLog = function(){ + +AttributeTester.prototype.clearLog = function(event){ + + if( event.layerY && (event.layerY - this._logDiv.scrollTop) < 125){ + + if( this._logDiv.style.height=="350px" ){ + this._logDiv.style.height = "25px" ; + } else { + this._logDiv.style.height = "350px" ; + } + + return ; + } + if (this._logDiv){ this._logDiv.innerHTML = "" ; } @@ -62,7 +106,7 @@ //IMPORTANT this works if you remove the same thing twice, -//no error. BEcause we still found element in hashtable? +//no error. Because we still found element in hashtable? AttributeTester.prototype.insertBefore = function( element ){ alert("insert before"); var newElement = element.getOwnerDocument().createElement("freePane","http://openxal.org/ui"); @@ -95,14 +139,18 @@ alert("New dom node = " + parent.toXml()); } -AttributeTester.prototype.appendListItem = function(element) { + +AttributeTester.newOptionItemCount=-1; +AttributeTester.prototype.appendListItem = function(element,selectedP) { alert("append"); var newElement = element.getOwnerDocument().createElement("listItem", "http://openxal.org/ui"); - newElement.setAttribute("text", "NEW INSERT"); - newElement.setAttribute("value","NEW VALUE"); - newElement.setAttribute("selected", "true"); + var caption="originally " ; + caption += ((selectedP)?"selected.":"not selected.") ; + newElement.setAttribute("text", ""+(++AttributeTester.newOptionItemCount)+": new text, " + caption); + newElement.setAttribute("value",""+(AttributeTester.newOptionItemCount)+": new value, " + caption); + newElement.setAttribute("selected", ""+selectedP); element.appendChild(newElement); - alert("New dom node = " + element.toXml()); + alert("New dom node:\n" + newElement.toXml()); }