[Laszlo-dev] when setAttribute('XXXX', v) is different from setXXX(v)
P T Withington
ptw at pobox.com
Fri Nov 2 10:52:17 PDT 2007
Not sure what you mean here. Calling `setAttribute('source', ...`
will call setSource same as any other attribute with a setter, so you
can rewrite the example, but...
I think the real bug here is that in LZX you say `resource=...` to set
the source of a view, and that we ought to allow you to say
`setAttribute('resource'...` to be consistent, rather than telling you
you call `setSource` to change `resource` at run time.
Sure, we have to maintain the old interface. But I think this
interface may have evolved without really being designed, so maybe it
is time to design it?
On 2007-11-01, at 16:31 EDT, Benjamin Shine wrote:
>
> Lou is in the process of converting the examples from using the
> special setters (setXXX(v))
> to using the standard setAttribute pattern.
>
> He points out that in at least one case, setAttribute('XXXX', v) is
> different from setXXX(v);
> notably, for the "source" attribute on LzView. "source" is a
> javascript-only attribute,
> according to the lps3 reference. So, we need to fine-tune our rule,
> which currently is:
>
> "always use setAttribute('XXX', v) instead of setXXX(v) when 'XXX'
> is an attribute."
>
> This should become... what, exactly?
>
> On Nov 1, 2007, at 12:58 PM, Lou Iorio wrote:
>
>> Hi Ben,
>>
>> In some cases, it seems that the setXXX method has more functionality
>> than setAttribute, for example view.setSource.
>>
>> Lou
>>
>> Begin forwarded message:
>>
>>> From: Lou Iorio <liorio at laszlosystems.com>
>>> Date: November 1, 2007 12:31:30 PM GMT-04:00
>>> To: Benjamin Shine <ben at laszlosystems.com>
>>> Subject: Re: [JIRA] Updated: (LPP-4949) Change setXXX(foo) in
>>> examples to setAttribute("XXX", foo)
>>>
>>> But no change to stuff that doesn't have corresponding attributes,
>>> right?
>>>
>>> Like LzCursor and LzFocus
>>>
>>> Lou
>>>
>>> On Oct 30, 2007, at 10:05 PM, Benjamin Shine wrote:
>>>
>>>> Yep, exactly.
>>>>
>>>> On Oct 30, 2007, at 2:04 PM, Lou Iorio wrote:
>>>>
>>>>> So, for example, I would change this:
>>>>>
>>>>> <canvas height="125">
>>>>> <debug x="400"/>
>>>>> <simplelayout/>
>>>>> <!-- Single line text, the default -->
>>>>> <text id="t1" bgcolor="#ffcccc" resize="false">
>>>>> Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
>>>>> </text>
>>>>> <text id="t2" bgcolor="#ccffcc" resize="true">
>>>>> Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
>>>>> </text>
>>>>> <button text="setText(...)">
>>>>> <handler name="onclick">
>>>>> t1.setText('resize='+t1.resize);
>>>>> t2.setText('resize='+t2.resize);
>>>>> </handler>
>>>>> </button>
>>>>> </canvas>
>>>>>
>>>>>
>>>>> to this:
>>>>> <canvas height="125">
>>>>> <debug x="400"/>
>>>>> <simplelayout/>
>>>>> <!-- Single line text, the default -->
>>>>> <text id="t1" bgcolor="#ffcccc" resize="false">
>>>>> Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
>>>>> </text>
>>>>> <text id="t2" bgcolor="#ccffcc" resize="true">
>>>>> Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
>>>>> </text>
>>>>> <button text="setAttribute('text', ...)">
>>>>> <handler name="onclick">
>>>>> t1.setAttribute('text', 'resize='+t1.resize);
>>>>> t2.setAttribute('text', 'resize='+t2.resize);
>>>>> </handler>
>>>>> </button>
>>>>> </canvas>
>>>>>
>>>>>
>>>>> Begin forwarded message:
>>>>>
>>>>>> From: "Amy Muntz (JIRA)" <jira at laszlosystems.com>
>>>>>> Date: October 29, 2007 12:43:26 PM GMT-04:00
>>>>>> To: liorio at laszlosystems.com
>>>>>> Subject: [JIRA] Updated: (LPP-4949) Change setXXX(foo) in
>>>>>> examples to setAttribute("XXX", foo)
>>>>>>
>>>>>> [ http://www.openlaszlo.org/jira/browse/LPP-4949?page=all ]
>>>>>>
>>>>>> Amy Muntz updated LPP-4949:
>>>>>> ---------------------------
>>>>>>
>>>>>> Assignee: Lou Iorio (was: John Sundman)
>>>>>> Priority: P0 (was: --)
>>>>>>
>>>>>>> Change setXXX(foo) in examples to setAttribute("XXX", foo)
>>>>>>> ----------------------------------------------------------
>>>>>>>
>>>>>>> Key: LPP-4949
>>>>>>> URL: http://www.openlaszlo.org/jira/browse/LPP-4949
>>>>>>> Project: OpenLaszlo
>>>>>>> Issue Type: Task
>>>>>>> Components: Documentation
>>>>>>> Affects Versions: 4.0.6/Jujube
>>>>>>> Reporter: Benjamin Shine
>>>>>>> Assigned To: Lou Iorio
>>>>>>> Priority: P0
>>>>>>> Fix For: RingDing
>>>>>>>
>>>>>>>
>>>>>>> We are leaning towards deprecating the public-ness of the
>>>>>>> setXXX methods, in favor of just setting everything with
>>>>>>> foo.setAttribute("XXX", bar).
>>>>>>> However, the examples use the special setters all over.
>>>>>>> Therefore, they should be converted to use the preferred syntax.
>>>>>>
>>>>>> --
>>>>>> This message is automatically generated by JIRA.
>>>>>> -
>>>>>> If you think it was sent incorrectly contact one of the
>>>>>> administrators: http://www.openlaszlo.org/jira/secure/Administrators.jspa
>>>>>> -
>>>>>> For more information on JIRA, see: http://www.atlassian.com/software/jira
>>>>>>
>>>>>>
>>>>>
>>>>
>>>
>>
>
More information about the Laszlo-dev
mailing list