[Laszlo-dev] For Review: Change 20081028-maxcarlson-7 Summary: Move colors out of global namespace

Max Carlson max at openlaszlo.org
Mon Nov 3 12:51:52 PST 2008


Change 20081028-maxcarlson-7 by maxcarlson at Bank on 2008-10-28 15:23:04  
PDT
     in /Users/maxcarlson/openlaszlo/trunk-clean
     for http://svn.openlaszlo.org/openlaszlo/trunk

Summary: Move colors out of global namespace

Bugs Fixed: LPP-6985 - Move colors out of global namespace

Technical Reviewer: ptw
QA Reviewer: promanik

Documentation:  Global colors have been moved to the 'lz.colors'  
object, so any scripts referring to colors will need to change, e.g.
   var col = red;

should be:
   var col = lz.colors.red;

In most cases, setting the type of the attribute you intend to set to  
a color will work, e.g. changing from:

   <class name="kitten" extends="animal" >
     <attribute name="furcolor" value="white" />
   </class>

to:
   <class name="kitten" extends="animal" >
     <attribute name="furcolor" value="white" type="color"/>
   </class>

will set the furcolor to the color 'white', resolving the issue.

See 'lps/components/base/colors.lzx' for an example of defining new  
global colors.

Release Notes: Global colors have been moved to the 'lz.colors' object.

Details: neighborhoodclasses.lzx - Add type to attribute so the color  
is found

subclassing.lzx - Look up global color values in 'lz.colors'

LzUtils.lzs - Look up global color values in 'lz.colors'.  Move color  
processing routines to static methods in LzColorUtils class so they  
are available early enough to be called by the compiler.

LzNode.lzs - Add type argument to __LZstyleBindAttribute, so the style  
id can be applied based on type using acceptAttribute().

LzConstants.lzs - Move deprecated global color declarations to  
lz.colors.

Library.lzs - Move LzConstants include after LzDefs - so the 'lz' in  
'lz.colors' is defined.

LzDefs.lzs - Change LzStyleIdent to store the style id as a type, to  
be looked up based on type when the style is applied.

LzSprite.js, LzInputTextSprite.js, LzSprite.as, PresentationTypes.lzs,  
LaszloView.lzs, LaszloCanvas.lzs, drawview.lzx - Use  
LzColorUtils.hextoint() to avoid deprecation warnings.

CSSHandler.java - Look up value of CSS identifiers later when they're  
applied to the attribute at runtime, based on type.

NodeModel.java - Add type to emitted __LZstyleBindAttribute()  
declarations.  Use LzColorUtils.convertColor() to do color conversions  
at runtime.

lzunit.lzx - Look up the value of 'red' in lz.colors.

colors.lzx - Declare new colors in lz.colors.

Tests: test/style/metasuite.lzx, test/lfc/lzunit-lzutils.lzx,  
components (which rely extensively on color values/attributes for  
styling) run as before in component sampler.

Files:
M      test/style/neighborhood/neighborhoodclasses.lzx
M      test/style/constraints/subclassing.lzx
M      test/lfc/lzunit-lzutils.lzx
M      WEB-INF/lps/lfc/kernel/dhtml/LzSprite.js
M      WEB-INF/lps/lfc/kernel/dhtml/LzInputTextSprite.js
M      WEB-INF/lps/lfc/kernel/swf9/LzSprite.as
M      WEB-INF/lps/lfc/services/LzUtils.lzs
M      WEB-INF/lps/lfc/core/LzNode.lzs
M      WEB-INF/lps/lfc/core/PresentationTypes.lzs
M      WEB-INF/lps/lfc/core/LzConstants.lzs
M      WEB-INF/lps/lfc/core/Library.lzs
M      WEB-INF/lps/lfc/core/LzDefs.lzs
M      WEB-INF/lps/lfc/views/LaszloView.lzs
M      WEB-INF/lps/lfc/views/LaszloCanvas.lzs
M      WEB-INF/lps/server/src/org/openlaszlo/css/CSSHandler.java
M      WEB-INF/lps/server/src/org/openlaszlo/compiler/NodeModel.java
M      lps/components/lzunit/lzunit.lzx
M      lps/components/extensions/drawview.lzx
M      lps/components/base/colors.lzx

Changeset: http://svn.openlaszlo.org/openlaszlo/patches/20081028-maxcarlson-7.tar


More information about the Laszlo-dev mailing list