[Laszlo-checkins] r11780 - in openlaszlo/trunk/WEB-INF/lps/lfc: core services
ptw@openlaszlo.org
ptw at openlaszlo.org
Fri Nov 14 12:44:57 PST 2008
Author: ptw
Date: 2008-11-14 12:44:55 -0800 (Fri, 14 Nov 2008)
New Revision: 11780
Modified:
openlaszlo/trunk/WEB-INF/lps/lfc/core/LzNode.lzs
openlaszlo/trunk/WEB-INF/lps/lfc/services/LzUtils.lzs
Log:
Change 20081114-ptw-d by ptw at dueling-banjos.home on 2008-11-14 11:54:33 EST
in /Users/ptw/OpenLaszlo/trunk
for http://svn.openlaszlo.org/openlaszlo/trunk
Summary: Add dependency method for LzNode#presentAttribute
Bugs Fixed:
LPP-7339 Can't use LzNode#presentAttribute in a constraint
Technical Reviewer: max (Message-Id: <200811142019.mAEKJFUh014158 at hedwig.laszlosystems.com>)
QA Reviewer: lou at louiorio.com (pending)
Details:
LzUtils: Make presenting a color use color name (if there is one)
before resorting to #xxxxxx notation. TODO: Make there be a way
you can specify your preferred presentation format.
LzNode: Add the dependency method
Tests:
Test case from bug. Text display of current color correctly
updates now.
Modified: openlaszlo/trunk/WEB-INF/lps/lfc/core/LzNode.lzs
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/lfc/core/LzNode.lzs 2008-11-14 20:09:07 UTC (rev 11779)
+++ openlaszlo/trunk/WEB-INF/lps/lfc/core/LzNode.lzs 2008-11-14 20:44:55 UTC (rev 11780)
@@ -2257,9 +2257,17 @@
*/
function presentAttribute(name, type) {
return this.presentValue(type, this[name]);
+ };
+
+ /** @access private */
+ function $lzc$presentAttribute_dependencies(who , self, name, type) :Array {
+ // Just depends on the attribute being presented. We don't expect
+ // the type to change (do we?)
+ return [ self, name ];
}
+
} // End of LzNode
lz[LzNode.tagname] = LzNode; // publish
Modified: openlaszlo/trunk/WEB-INF/lps/lfc/services/LzUtils.lzs
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/lfc/services/LzUtils.lzs 2008-11-14 20:09:07 UTC (rev 11779)
+++ openlaszlo/trunk/WEB-INF/lps/lfc/services/LzUtils.lzs 2008-11-14 20:44:55 UTC (rev 11780)
@@ -170,12 +170,21 @@
}
/** @access public
- * Converts a floating point rgb.0a to a CSS #RRGGBBAA string
+ * Converts a floating point rgb.0a to a CSS color name (if
+ * appropriate) or #RRGGBBAA string
*/
static function inttohex(n:*, p:int = 6) {
var s = LzColorUtils.stringToColor(n);
if (typeof s != 'number') return s;
+ // look up color names
+ var ctab = lz.colors;
+ for (var name in ctab) {
+ if (ctab[name] === n) {
+ return name;
+ }
+ }
+
// default to 6 characters of padding
return '#' + LzColorUtils.dectohex(s, p);
}
More information about the Laszlo-checkins
mailing list