I agree that this is too much of an API change for this late stage, but I don't 
think you need to change the component API as extensively as you do here.

It seems to me you should be able to create a private attribute `__itemclass` 
that is set from itemclassname (when specified by the user) and computed from 
the subview constructor (when not specified), and then use __itemclass in the 
new clauses, rather than itemclassname.  That would leave the API intact 
(although technically incorrect, since itemclassname is not really a class 
name, it is a tag name).  E.g., something like:

<attribute name="itemclassname" type="string">

<setter name="itemclassname" args="tag">
  if ($debug) {
    if (tag && (! lz[tag])) { Debug.error("Invalid itemclassname %s", tag) }
  }
  this.itemclassname = tag;
  this.__itemclass = lz[tag];
  if (onitemclassname.ready) { this.onitemclassname.sendEvent(tag); }
</setter>

<handler name="onaddsubview" args="v"> <![CDATA[
   if classroot.itemclassname == "") {
     classroot.__itemclass = v.constructor;
   }
   ...
</handler>

<method name="addItem" args="txt, value=null">
  new this.__itemclass(this, {text:txt, value:value});
</method>

etc.


On 2010-01-05, at 20:59, Max Carlson wrote:

> Change 20100105-maxcarlson-T by maxcarl...@bank on 2010-01-05 14:09:06 PST
>    in /Users/maxcarlson/openlaszlo/trunk-clean
>    for http://svn.openlaszlo.org/openlaszlo/trunk
> 
> Summary: UPDATED AGAIN: Fix lz/list.lzx to use correct methods for 
> instantiating new items
> 
> Bugs Fixed: LPP-6002 - lztextlistitem warning/errors of undefined properties 
> (title, height, setAttribute), LPP-8690 - Update components to use class 
> references directly instead of tagnames (partial)
> 
> Technical Reviewer: ptw
> QA Reviewer: hminsky
> 
> Details: This has turned into a pretty hairy API-breaking change fairly 
> quickly...  Perhaps we should rethink correcting tagname?  
> 
> Rename *classname to *class.  *class attribute now contains a reference to 
> the class that should be created dynamically.  Directly instantiate classes, 
> instead of looking up by tagname first.
> 
> Tests: Testcase from LPP-6002 no longer warns, component_sampler.lzx 
> continues to work.  lzunit-basedatacombobox.lzx runs as before.
> 
> Files:
> M       test/components/base/lzunit-basedatacombobox.lzx
> M       lps/components/lz/tabslider.lzx
> M       lps/components/lz/radio.lzx
> M       lps/components/lz/list.lzx
> M       lps/components/lz/tabs.lzx
> M       lps/components/base/basetabelement.lzx
> M       lps/components/base/basecombobox.lzx
> M       lps/components/base/basetabslider.lzx
> M       lps/components/base/baselist.lzx
> M       lps/components/base/basetabs.lzx
> M       lps/components/base/basedatacombobox.lzx
> 
> Changeset: 
> http://svn.openlaszlo.org/openlaszlo/patches/20100105-maxcarlson-T.tar
> 
> _______________________________________________
> Laszlo-reviews mailing list
> [email protected]
> http://www.openlaszlo.org/mailman/listinfo/laszlo-reviews


_______________________________________________
Laszlo-reviews mailing list
[email protected]
http://www.openlaszlo.org/mailman/listinfo/laszlo-reviews

Reply via email to