> > Maybe a better approach is to add an updateSchema method to ViewCompiler, > patterned on the one in ClassCompiler, that will add the instance > interstitials at schema time if the instance has mixins and re-write the DOM > tag to be the most-specific interstitial (as illustrated above). Then the > compilation phase will just do the right thing, and forward references > should just work. >
That does sound like a much better idea. > > On 2009-11-16, at 01:42, Henry Minsky wrote: > > > Change 20091116-hqm-B by [email protected] on 2009-11-16 01:22:06 EST > > in /Users/hqm/openlaszlo/trunk > > for http://svn.openlaszlo.org/openlaszlo/trunk > > > > Summary: allow mixin spec on instances > > > > New Features: > > > > Bugs Fixed: LPP-8602 Allow with="" on instances declarations > > > > Technical Reviewer: ptw > > QA Reviewer: max > > Doc Reviewer: (pending) > > > > Documentation: > > > > Release Notes: > > > > Overview: > > > > LZX instances can now accept the "with" attribute to add mixins > > > > Details: > > > > schema/lfc-undeclared.lzx: > > Move mixin declaration to <node> > > > > compiler/NodeModel.java: > > Check if an instance has methods OR mixins, to decide whether to > make an anon class for it. > > > > compiler/CanvasCompiler.java: > > Needed to make a copy of the child element list, so I don't get a > concurrent access exception from the > > iterator. The issue is that the ClassModel mixin processor appends stuff > to the DOM, which would cause this issue. > > I'm a little perturbed that I needed to do this, why wasn't this > happening before when regular class mixins were > > getting compiled? > > > > compiler/ClassModel.java: > > Factor out code to parse mixins, to make it easier to read. > > > > If we're modeling an instance rather than a class, use the tagname > > as the superclass instead of the "extends" attribute val. > > > > > > > > Tests: > > > > smokecheck in swf10,dhtml,swf8 > > > > test case (use swf10 for most strict compiler test) > > [note, I ought to make a lztest unit test for this, maybe to go into > smokecheck?] > > > > <canvas> > > <simplelayout/> > > <text>Each instance should have a 40x40 colored square. First two > squares will turn green when clicked on</text> > > <class name="colored_square" bgcolor="#ccffcc" width="40" height="40"/> > > > > <!-- regular old instance which makes anon class --> > > <view name="nomixin" width="40" height="40" bgcolor="#cccccc"> > > <text>instance with no mixin</text> > > <handler name="onclick"> > > this.setAttribute('bgcolor', 0x00ff00); > > </handler> > > </view> > > > > > > <!-- instance which uses mixins and makes anon class --> > > <view name="mymixin" with="colored_square" > > > <text>instance with mixin</text> > > <handler name="onclick"> > > this.setAttribute('bgcolor', 0x00ff00); > > </handler> > > </view> > > > > <!-- instance which has no methods so would not normally make an anon > class, except that it it uses a mixin--> > > <view name="simplemixin" with="colored_square" bgcolor="#cc0000" > > > <text>instance with mixin but no methods</text> > > </view> > > > > > > </canvas> > > > > > > Files: > > M WEB-INF/lps/schema/lfc-undeclared.lzx > > M > WEB-INF/lps/server/src/org/openlaszlo/compiler/CanvasCompiler.java > > M WEB-INF/lps/server/src/org/openlaszlo/compiler/ClassModel.java > > M WEB-INF/lps/server/src/org/openlaszlo/compiler/NodeModel.java > > > > Changeset: > http://svn.openlaszlo.org/openlaszlo/patches/20091116-hqm-B.tar > > > > _______________________________________________ > > Laszlo-reviews mailing list > > [email protected] > > http://www.openlaszlo.org/mailman/listinfo/laszlo-reviews > > -- Henry Minsky Software Architect [email protected]
_______________________________________________ Laszlo-reviews mailing list [email protected] http://www.openlaszlo.org/mailman/listinfo/laszlo-reviews
