Change 20090924-maxcarlson-T by [email protected] on 2009-09-24  
08:57:17 PDT
     in /Users/maxcarlson/openlaszlo/trunk-clean
     for http://svn.openlaszlo.org/openlaszlo/trunk

Summary: Compile style attribute for <attribute/>

Bugs Fixed: LPP-7357 - Simple mechanism for making <attribute>s CSS  
styleable (partial)

Technical Reviewer: ptw

Details: lzx.rnc - Add style attribute to attributeElement declaration

LzNode.lzs - Add a fallback argument to __LZstyleBindAttribute() which  
is used to compute the value if the style lookup fails.

ViewSchema.java - Add "style" to the <attribute/> schema.

NodeModel.java - Add a fallbackexpression property and setter to  
CompiledAttribute.  When computing the binder method for a style,  
include the fallback expression if it's been defined.  In  
addAttributeElement() look for a style attribute.  If one is found, it  
takes precedance over any existing value attribute - but the value is  
preserved as a fallbackexpression, and binder and dependancy methods  
are still installed.


Tests:
<canvas>
     <stylesheet>
         stylableclass {
             background-color: #555588;
             textColor: #FFFFFF;
         }
     </stylesheet>

     <class name="stylableclass">
         <attribute name="foo" type="color" value="red"/>
         <attribute name="bgcolor" style="background-color" value="$ 
{this.foo}"/>
         <text fontsize="24" fgcolor="$style 
{'textColor'}">stylableclass</text>
     </class>

     <stylableclass/>
</canvas>

matched the correct style when the style attribute is set to something  
that matches, e.g. 'background-color'.  If style is set to something  
that fails, the value attribute works for simple values, e.g. 'red'  
and also for $once and $always constraints.

Files:
M       WEB-INF/lps/schema/lzx.rnc
M       WEB-INF/lps/lfc/core/LzNode.lzs
M       WEB-INF/lps/server/src/org/openlaszlo/compiler/ViewSchema.java
M       WEB-INF/lps/server/src/org/openlaszlo/compiler/NodeModel.java

Changeset: 
http://svn.openlaszlo.org/openlaszlo/patches/20090924-maxcarlson-T.tar
_______________________________________________
Laszlo-reviews mailing list
[email protected]
http://www.openlaszlo.org/mailman/listinfo/laszlo-reviews

Reply via email to