History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: LPP-2606
Type: Bug Bug
Status: Verified Verified
Resolution: Fixed
Priority: -- --
Assignee: Frisco Del Rosario
Reporter: P T Withington
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
OpenLaszlo

$styles does not inherit from superclass

Created: 04/Sep/06 12:45 PM   Updated: 05/Sep/06 02:07 PM
Component/s: Compiler
Affects Version/s: 3.4
Fix Version/s: 3.4

Time Tracking:
Not Specified

Severity: Minor
Fixed in Change#: 1,745
Runtime: N/A
Fix in hand: False


 Description  « Hide
On 2006-09-01, at 20:12 EDT, Adam Wolff wrote:

Hi Tucker,
Ben found a bug with using $style in a class definition. Given:
 <class name="super" bgcolor="${ 'stylea1' }"/>
 <class name="sub" extends="super" x="${ 'stylea2' }"/>

An instance of sub doesn't get the styled value. In general, this
kind
of
thing is handled by passing the collected style attributes as an
Object,
which are then attached to the superclass version of the same in the
ugly
loop at the top of the LzNode constructor. Since right now, the
$style
attribute is a function, this object composition isn't happening.

Thoughts? Feelings? Seems like the easiest thing to do would be to
pass
$styles as a hash.


 All   Comments   Work Log   Change History      Sort Order: Ascending order - Click to sort in descending order
P T Withington - 04/Sep/06 12:45 PM
On Sep 3, P T Withington wrote:

I think the simplest solution would be for me to redefine the $styles method
as follows:

function $styles () {
 var map = super.$styles();
 var styles = { ... };
 for (var k in styles) { map[k] = styles[k]; };
 return map;
}

That means you need a default $styles method on LzNode that returns a _new_
empty hash;

And you call __LZapplyStyleMap on this.$styles().


P T Withington - 04/Sep/06 01:27 PM
Awaiting review from Adam

P T Withington - 04/Sep/06 05:10 PM
r1745 | ptw | 2006-09-04 17:09:08 -0400 (Mon, 04 Sep 2006) | 21 lines
Changed paths:
   M /openlaszlo/branches/coal/WEB-INF/lps/lfc/core/LzNode.as
   M /openlaszlo/branches/coal/WEB-INF/lps/server/src/org/openlaszlo/compiler/NodeModel.java

Change change.ptpIrl8ZB.txt by ptw@tin-woodsman.local /Users/ptw/pending-changes/ on 2006-09-04 12:41:24 EDT

Summary: Make $styles inherit correctly from superclasses

Bugs Fixed:
LPP-2606 $styles does not inherit from superclass

Technical Reviewer: adam (Message-ID: <Pine.OSX.4.64.0609041106470.4824@axe.local>)
QA Reviewer: ben (pending)
Doc Reviewer: n/a

Details:
    Define a default $styles method that returns null. The
    compiler-generated $styles method calls super.$styles and if it is
    a map, adds to that map, otherwise, creates and returns a new map.

    Change LzNode's initialize method to correctly invoke the $styles
    method, not the $styles function in the arglist.

Tests:
    test/style/constraints/constraint-test.lzx

P T Withington - 04/Sep/06 05:11 PM
Assigning to Ben for QA

Benjamin Shine - 05/Sep/06 02:07 PM
This is fixed!