On 2011-02-11, at 15:45, André Bargull wrote:

> I'd prefer a more light-weight solution than using <text> as a trampoline for 
> the <formatter> mixin. LPP-7793 itself is a bit complicated due to the 
> differences between lzs and lzx mixins, the fact it's necessary to ship the 
> actual sources of the mixin etc. etc.

Me too, and thank you for reminding me about LPP-7793!

> Shouldn't it be possible to add a simple lzs-class to the lfc which only 
> mixes-in lz.Formatter and use that class as the trampoline? For example:
>    public final class LzFormatterTrampoline with LzFormatter { /* empty */ }

That's an interesting idea, but I actually think I would rather waste 1 <view> 
in the user program than add another copy of the LzFormatter methods to the LFC 
(yes, we could optimize mixins for space, but we don't right now).

> and later in the <formatter> mixin:
> <mixin name="formatter">
> <!--- @access private -->
> <attribute name="__trampoline" value="new LzFormatterTrampoline()" />
> <method name="abbreviate" args="...args">return 
> this.__trampoline.abbreviate.apply(this.__trampoline, args);</method>
> <method name="formatToString" args="...args">return 
> this.__trampoline.formatToString.apply(this.__trampoline, args);</method>
> <method name="pad" args="...args">return 
> this.__trampoline.pad.apply(this.__trampoline, args);</method>
> </mixin>
> 
> Alternatively, you could use a single, shared <text> instance as the 
> trampoline to avoid creating a separate <text> instance for every <formatter>:
> <text id="__formatter_trampoline" visible="false" />
> <mixin name="formatter">
> <method name="abbreviate" args="...args">return 
> __formatter_trampoline.abbreviate.apply(__formatter_trampoline, 
> args);</method>
> <method name="formatToString" args="...args">return __formatter_trampoline 
> .formatToString.apply(__formatter_trampoline, args);</method>
> <method name="pad" args="...args">return 
> __formatter_trampoline.pad.apply(__formatter_trampoline, args);</method>
> </mixin>

Too bad I can't make __trampoline a class-allocated property and refer to it as 
lz.formatter.__trampoline.

I will take your last suggestion.  That seems the best.

> PS:
> With the new <formatter> mixin you can also remove the TODO in lzunit.lzx and 
> simply let <Test> mixin <formatter>.

I'll add that to the change.

> On 2/11/2011 8:20 PM, P T Withington wrote:
>> Change ptw-20110211-H4Y by [email protected] on 2011-02-11 13:55:49 EST
>>     in /Users/ptw/OpenLaszlo/trunk-3
>>     for http://svn.openlaszlo.org/openlaszlo/trunk
>> 
>> Summary: Support dynamic tooltips
>> 
>> Bugs Fixed: LPP-9750 Make a way for a tooltip to update itself before it is 
>> displayed
>> 
>> Technical Reviewer: [email protected] (pending)
>> QA Reviewer: [email protected] (pending)
>> Doc Reviewer: [email protected] (pending)
>> 
>> Release Notes:
>> 
>>     The content of a<tooltip>  can now be set from a CSS<stylesheet>
>>     using the `content` property.
>> 
>>     <tooltip>  now has an `update` method that is called before a
>>     tooltip is (potentially) displayed.  You can subclass<tooltip>
>>     and override this method to compute the tooltip text dynamically,
>>     or set the text to the empty string to prevent it from being
>>     displayed.
>> 
>>     A new mixin<formatter>  has been added that can be used to add the
>>     methods available in the lz.Formatter kernel mixin to any LZX
>>     class.
>> 
>> Details:
>> 
>>     LzIdleKernel: Give the `__update` method a pretty name, since it
>>     shows up at the top of every stack trace.
>> 
>>     LzFormatter: Give the custom object example a little more vertical
>>     room so you can see it without scrolling.
>> 
>>     lzx-autoincludes: Add `cssfonts` (was missed in an earlier checkin),
>>     and `formatter`.
>> 
>>     tooltip:  Add the `update` method and the `content` style property.
>> 
>>     formatter: LZX mixin wrapper for the `LzFormatter` kernel mixin.
>> 
>> Tests:
>>     Test case from bug report used as example in tooltip documentation
>> 
>> Files:
>> M       WEB-INF/lps/lfc/kernel/LzIdleKernel.lzs
>> M       WEB-INF/lps/lfc/compiler/LzFormatter.lzs
>> M       WEB-INF/lps/misc/lzx-autoincludes.properties
>> M       lps/components/lz/tooltip/tooltip.lzx
>> A       lps/components/mixins/formatter.lzx
>> 
>> Changeset: http://svn.openlaszlo.org/openlaszlo/patches/ptw-20110211-H4Y.tar
>> 
>> 


Reply via email to