Author: max
Date: 2007-10-04 16:51:40 -0700 (Thu, 04 Oct 2007)
New Revision: 6729

Modified:
   openlaszlo/trunk/WEB-INF/lps/lfc/kernel/dhtml/LzInputTextSprite.js
   openlaszlo/trunk/WEB-INF/lps/lfc/kernel/dhtml/LzTextSprite.js
   openlaszlo/trunk/WEB-INF/lps/lfc/services/LzModeManager.lzs
   openlaszlo/trunk/WEB-INF/lps/lfc/views/LzInputText.lzs
   openlaszlo/trunk/WEB-INF/lps/lfc/views/LzText.lzs
   openlaszlo/trunk/lps/components/lz/edittext.lzx
Log:
Change 20071004-maxcarlson-x by [EMAIL PROTECTED] on 2007-10-04 12:49:38 PDT
    in /Users/maxcarlson/openlaszlo/trunk-clean
    for http://svn.openlaszlo.org/openlaszlo/trunk

Summary: Fix Mode manager and LzText/Inputtext modality

New Features:

Bugs Fixed: LPP-3948 - LzModeManager and selectable LzText (real problem comes 
with edittext)

Technical Reviewer: promanik
QA Reviewer: jcrowley
Doc Reviewer: (pending)

Documentation:

Release Notes:

Details: LzTextSprite.js - Expose and set selectable attribute.

LzInputTextSprite.js - Don't become editable when selectable != true.

LzModeManager.lzs - Ensure mView.passModeEvent() exists before calling it.

LzInputText.lzs - Register for LzModeManager.onmode event.  Ensure inputtext 
doesn't become selectable if it isn't inside the view that has modality applied.

LzText.lzs - Set selectable attribute in setSelectable().

edittext.lzx - Add support setSelection(), applyData(), updateData() and 
getValue().
    

Tests: See LPP-3948.  Testcase passes in flash and DHTML.



Modified: openlaszlo/trunk/WEB-INF/lps/lfc/kernel/dhtml/LzInputTextSprite.js
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/lfc/kernel/dhtml/LzInputTextSprite.js  
2007-10-04 23:23:14 UTC (rev 6728)
+++ openlaszlo/trunk/WEB-INF/lps/lfc/kernel/dhtml/LzInputTextSprite.js  
2007-10-04 23:51:40 UTC (rev 6729)
@@ -76,6 +76,7 @@
         this.__LZinputclickdiv.className = 'lzclickdiv';
         this.__LZinputclickdiv.owner = this;
         this.__LZinputclickdiv.onmouseover = function () {
+            if (this.owner.selectable != true) return;
             LzInputTextSprite.prototype.__setglobalclickable(false);
             this.owner.__show();
         }

Modified: openlaszlo/trunk/WEB-INF/lps/lfc/kernel/dhtml/LzTextSprite.js
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/lfc/kernel/dhtml/LzTextSprite.js       
2007-10-04 23:23:14 UTC (rev 6728)
+++ openlaszlo/trunk/WEB-INF/lps/lfc/kernel/dhtml/LzTextSprite.js       
2007-10-04 23:51:40 UTC (rev 6729)
@@ -53,6 +53,7 @@
 LzTextSprite.prototype.__wpadding = 4;
 LzTextSprite.prototype.__hpadding = 4;
 LzTextSprite.prototype.__sizecacheupperbound = 1000;
+LzTextSprite.prototype.selectable = true;
 
 LzTextSprite.prototype.setFontSize = function (fsize) {
     if (fsize == null || fsize < 0) return;
@@ -340,6 +341,7 @@
 }
 
 LzTextSprite.prototype.setSelectable = function (s) {
+    this.selectable = s;
     //Debug.write('setSelectable', s, this.__LZdiv.style);
     if (s) {
         this.__LZdiv.onselectstart = null;

Modified: openlaszlo/trunk/WEB-INF/lps/lfc/services/LzModeManager.lzs
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/lfc/services/LzModeManager.lzs 2007-10-04 
23:23:14 UTC (rev 6728)
+++ openlaszlo/trunk/WEB-INF/lps/lfc/services/LzModeManager.lzs 2007-10-04 
23:51:40 UTC (rev 6729)
@@ -146,7 +146,7 @@
         if (view && view.childOf( mView ) ){
             break;
         } else if (mView) {
-            dosend = mView.passModeEvent( eventStr , view );
+            dosend = mView.passModeEvent ? mView.passModeEvent( eventStr , 
view ) : null;
         }
     }
 

Modified: openlaszlo/trunk/WEB-INF/lps/lfc/views/LzInputText.lzs
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/lfc/views/LzInputText.lzs      2007-10-04 
23:23:14 UTC (rev 6728)
+++ openlaszlo/trunk/WEB-INF/lps/lfc/views/LzInputText.lzs      2007-10-04 
23:51:40 UTC (rev 6729)
@@ -105,6 +105,8 @@
                                             "onfocus" );
     this._onblurDel = new LzDelegate( this , "_gotBlurEvent" , this,
                                             "onblur" );
+    this._modemanagerDel = new LzDelegate( this, "_modechanged", LzModeManager,
+                                            "onmode" );
 }
 
 /**
@@ -230,4 +232,61 @@
     return [ self, "text" ];
 }
 
+/** 
+  * this attribute control the LzText::selectable attribute trough its setter
+  * @access private
+  */
+var _allowselectable=true;
+
+/** 
+  * cache true value of selectable
+  * @access private
+  */
+var _selectable;
+
+/** 
+  * Catch all LzModeManager events
+  * @access private
+  */
+function _modechanged(modalview) {
+    // !modalview = "LzModeManager release a view" => so allowselectable
+    if ( !modalview ) {
+        this._setallowselectable(true);
+    } else {
+        // LzModeManager make modalview as modal
+        // (modalview.nodeLevel > this.nodeLevel) = "This cannot be a child of 
the setted modal view"
+        // so not allowselectable
+        if ( modalview.nodeLevel > this.nodeLevel ) {
+            this._setallowselectable( false );
+        } else {
+            // is this a child of the setted modal view
+            var parentSeeking = this;
+
+            do {
+                parentSeeking = parentSeeking.parent;
+            } while ( parentSeeking != canvas && parentSeeking != modalview );
+
+            this._setallowselectable(parentSeeking != canvas);
+        }
+    }
+}
+
+/** 
+  * update the selectable status based on cached value
+  * @access private
+  */
+function _setallowselectable(value) {
+    this._allowselectable = value;
+    this.setSelectable( this._selectable );
+}
+
+/** 
+  * @access private
+  */
+function setSelectable(value) {
+    this._selectable = value;
+    // depending on allowselectable : the setted value or false !
+    super.setSelectable( this._allowselectable ? value : false );
+}
+
 } // End of LzInputText

Modified: openlaszlo/trunk/WEB-INF/lps/lfc/views/LzText.lzs
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/lfc/views/LzText.lzs   2007-10-04 23:23:14 UTC 
(rev 6728)
+++ openlaszlo/trunk/WEB-INF/lps/lfc/views/LzText.lzs   2007-10-04 23:51:40 UTC 
(rev 6729)
@@ -790,9 +790,8 @@
   * @param Boolean isSel: true if the text may be selected by the user
   */
 function setSelectable ( isSel ){
+    this.selectable = isSel;
     this.sprite.setSelectable(isSel);
-    //this.__LZtextclip.selectable = isSel;
-
 }
 
 /**

Modified: openlaszlo/trunk/lps/components/lz/edittext.lzx
===================================================================
--- openlaszlo/trunk/lps/components/lz/edittext.lzx     2007-10-04 23:23:14 UTC 
(rev 6728)
+++ openlaszlo/trunk/lps/components/lz/edittext.lzx     2007-10-04 23:51:40 UTC 
(rev 6729)
@@ -115,6 +115,10 @@
           field.setPattern(r);
         </method>
 
+        <method name="setSelection" args="start,end">
+            field.setSelection(start, end);
+        </method>
+
         <!--- @keywords private -->
         <method name="getFocusRect"  >
            var fx = this.getAttributeRelative('x',canvas);
@@ -194,10 +198,28 @@
 
         <!--- @keywords private -->
         <method name="applyData" args="d">
-            this.setText(d);
+            this.field.applyData( d );
         </method>
 
         <!--- @keywords private -->
+        <method name="updateData">
+            this.updateText();
+            return this.text;
+        </method>
+
+        <!-- Updates the text property of the component to the text that is
+             entered in its input field. -->
+        <method name="updateText">
+            this.setText( this.field.getText() );
+        </method>
+
+        <!--- Returns string displayed in this component, like getText().
+              @return String: the string displayed. -->
+        <method name="getValue">
+            return  this.field.getText();
+        </method>
+
+        <!--- @keywords private -->
         <method name="_showEnabled">
             if (_enabled) {
                 this.field.setAttribute('enabled', true);


_______________________________________________
Laszlo-checkins mailing list
[email protected]
http://www.openlaszlo.org/mailman/listinfo/laszlo-checkins

Reply via email to