[Laszlo-checkins] r13907 - openlaszlo/trunk/WEB-INF/lps/lfc/kernel/dhtml

bargull@openlaszlo.org bargull at openlaszlo.org
Fri May 15 11:30:27 PDT 2009


Author: bargull
Date: 2009-05-15 11:30:23 -0700 (Fri, 15 May 2009)
New Revision: 13907

Modified:
   openlaszlo/trunk/WEB-INF/lps/lfc/kernel/dhtml/LzContextMenuKernel.lzs
   openlaszlo/trunk/WEB-INF/lps/lfc/kernel/dhtml/LzSprite.js
Log:
Change 20090515-bargull-LDA by bargull at dell--p4--2-53 on 2009-05-15 17:16:16
    in /home/Admin/src/svn/openlaszlo/trunk
    for http://svn.openlaszlo.org/openlaszlo/trunk

Summary: contextmenu delegate / disabled contextmenu items (DHTML)

New Features:

Bugs Fixed: LPP-8190 (Context menu state not updated immediately in DHTML), LPP-8191 (disabled contextmenuitems lose their ending line break in dhtml)

Technical Reviewer: max
QA Reviewer: mdemmon
Doc Reviewer: (pending)

Documentation:

Release Notes:

Details:
LPP-8190:
Call the contextmenu delegate before sending the onmenuopen-event and constructing the lzcontextmenu-div. This is compliant with the swf-kernel implementations.

LPP-8191:
To match swf look&feel, disabled contextmenu items now have a hover-effect and selection uses onmouseup instead of onmousedown.
Add a new "disabled contextmenu item" css-class to LzSprite. Need to use <a> instead of <span> because IE implements :hover only for <a>. 
And add onclick-handler to prevent default action (required because onmouseup is used).
    

Tests:
see bugreport (tested with Firefox, Safari, IE)




Modified: openlaszlo/trunk/WEB-INF/lps/lfc/kernel/dhtml/LzContextMenuKernel.lzs
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/lfc/kernel/dhtml/LzContextMenuKernel.lzs	2009-05-15 17:04:12 UTC (rev 13906)
+++ openlaszlo/trunk/WEB-INF/lps/lfc/kernel/dhtml/LzContextMenuKernel.lzs	2009-05-15 18:30:23 UTC (rev 13907)
@@ -86,7 +86,11 @@
         document.body.appendChild(s);
     }
     var owner = this.owner;
-    if (send && owner.onmenuopen.ready) owner.onmenuopen.sendEvent(owner);
+    if (send) {
+        var del = this._delegate;
+        if (del != null) del.execute(owner);
+        if (owner.onmenuopen.ready) owner.onmenuopen.sendEvent(owner);
+    }
 
     var o = '';
     var shownItems = 0;
@@ -105,14 +109,15 @@
         _items[caption] = true;
         shownItems += 1;
 
+        o += '<a href="" onclick="return false;" ';
         if (v.enabled) {
-            o += '<a href="" onmousedown="javascript:LzMouseKernel.__showncontextmenu.__select(' + i + ');return false;">'
-                    + caption + '</a>';
+            o += 'onmouseup="LzMouseKernel.__showncontextmenu.__select(' + i + ');return false;"';
         } else {
-            o += caption;
+            o += 'class="disabled"';
         }
+        o += '>' + caption + '</a>';
     }
-    
+
     LzMouseKernel.__showncontextmenu = this;
 
     s.innerHTML = o;
@@ -120,14 +125,11 @@
         s.style.left = LzMouseKernel.__x + 'px';
         s.style.top = LzMouseKernel.__y + 'px';
     }
-    
+
     // Only show menu if there are any visible items
     if (shownItems) {
         s.style.display = 'block';
     }
-
-    var del = this._delegate;
-    if (send && del != null) del.execute(owner);
 }
 
 /** @access private */

Modified: openlaszlo/trunk/WEB-INF/lps/lfc/kernel/dhtml/LzSprite.js
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/lfc/kernel/dhtml/LzSprite.js	2009-05-15 17:04:12 UTC (rev 13906)
+++ openlaszlo/trunk/WEB-INF/lps/lfc/kernel/dhtml/LzSprite.js	2009-05-15 18:30:23 UTC (rev 13907)
@@ -411,6 +411,9 @@
    color: '#FFF',
    backgroundColor: '#333'
 };
+LzSprite.prototype.__defaultStyles['#lzcontextmenu a.disabled'] = {
+   color: '#999 !important'
+};
 
 LzSprite.prototype.__defaultStyles['#lzcontextmenu'] = {
     position: 'absolute',
@@ -422,7 +425,6 @@
     fontSize: '13px',
     'float': 'left',
     margin: '2px',
-    color: '#999',
     minWidth: '100px'
 };
 



More information about the Laszlo-checkins mailing list