<basetabpane> is doing some more voodoo, that's why the standard way using `determinePlacement` doesn't work here (from <basetabpane>#createChildren()):

// Intercept basetabpane initstage for its content. Note: createChildren
// gets called before init.
var is = "late"
if (this['initstage'] != null) {
    is = this.initstage;
}
this.initstage = null;
myChildren.push( { name: "basetabpanecontent",
                   attrs: { name: 'content', parent: this,
                            initstage: is },
                   children: contentChildren } );
super.createChildren( myChildren );

<basetabpane> dynamically creates its content (<basetabpanecontent>) and set the initstage to "late" by default. AFAIK this magic cannot be done by `determinePlacement`. So only for the sake of performance, <basetabpane> sacrifices simplicity, stability etc.


On 3/18/2011 7:35 PM, P T Withington wrote:
I agree that such a mechanism is fragile (apparently, since I have made this 
comment twice!).

But is this what `determinePlacement` `defaultplacement` and `ignoreplacment` 
are for?  Should tabpanes just be using that mechanism?

On 2011-03-18, at 14:26, André Bargull wrote:

Currently<basetabpane>  uses the "_keepchildren" attribute to splice some children from the beginning of the array passed to 
createChildren(). That mechanism is a bit fragile, especially if one wants to subclass<tabpane>. In LPP-4773, I've proposed to an 
option to differentiate where to place the children of<basetabpane>. For example the<swatchview>  in<tabpane>  will be 
marked with `options="notcontentchild"`, that way<basetabpane>#createChildren() knows where to place<swatchview>.

On 3/18/2011 7:09 PM, P T Withington wrote:
I hadn't seen 4773 before.  Can you summarize your "simple proposal"?

On 2011-03-18, at 11:04, André Bargull wrote:

This looks similar to LPP-4773, so better don't make the same mistake twice!


You left a (n uncommented) Debug.info in there.

Perhaps we should extend initstage to handle this case?  I.e., have initstage 
be able to specify which children to init when?  I'm always leery of using 
explicit constants like '3'.

On 2011-03-18, at 02:12,max at 
openlaszlo.org<http://www.openlaszlo.org/mailman/listinfo/laszlo-dev>    wrote:

/  Author: max
/>/  Date: 2011-03-17 23:12:38 -0700 (Thu, 17 Mar 2011)
/>/  New Revision: 18917
/>/
/>/  Modified:
/>/    components/trunk/lib/tab/tab.lzx
/>/  Log:
/>/  Change maxcarlson-20110317-Rbc bymaxcarlson at 
friendly<http://www.openlaszlo.org/mailman/listinfo/laszlo-dev>    on 2011-03-17 
10:12:51 PDT
/>/     in /Users/maxcarlson/openlaszlo/trunk2/my-apps/components-clean
/>/     forhttp://svn.openlaszlo.org/components/trunk
/>/
/>/  Summary: Defer instantiation of tab contents until open()
/>/
/>/  Bugs Fixed: LPP-9826 (partial)
/>/
/>/  Technical Reviewer: promanik
/>/  QA Reviewer: hminsky
/>/
/>/  Details: Use method from tabslider/tabelement to defer child creation 
until open().
/>/
/>/  Tests: test/tab_test.lzx starts up ~3x faster.
/>/
/>/
/>/
/>/  Modified: components/trunk/lib/tab/tab.lzx
/>/  ===================================================================
/>/  --- components/trunk/lib/tab/tab.lzx    2011-03-17 23:50:35 UTC (rev 18916)
/>/  +++ components/trunk/lib/tab/tab.lzx    2011-03-18 06:12:38 UTC (rev 18917)
/>/  @@ -90,6 +90,9 @@
/>/              if (this.selected === selected) return;
/>/              this.selected = selected;
/>/
/>/  +            // If we still have children to create, do it!
/>/  +            if (this.__remainingChildren) this.__finishCreate();
/>/  +
/>/              // Tell the tabgroup about the change (unless initiated by it)
/>/              var istabgroup = (this.parent instanceof lz.tabgroup);
/>/              if (istabgroup&&    !parent.updating&&    this.selected) {
/>/  @@ -181,6 +184,33 @@
/>/              ]]>
/>/</method>
/>/
/>/  +<!--- Override view.createChildren() to create only the first three
/>/  +              children (the layout, tabtitle and tabpanel), deferring the 
rest
/>/  +              until __finishCreate() is called
/>/  +              @access private -->
/>/  +<method name="createChildren" args="children">
/>/  +<![CDATA[
/>/  +            var istabgroup = (this.parent instanceof lz.tabgroup);
/>/  +            if (istabgroup&&    (! this.selected)) {
/>/  +                super.createChildren(children.splice(0, 3));
/>/  +                if (children.length) {
/>/  +                    this.__remainingChildren = children;
/>/  +                }
/>/  +            } else {
/>/  +                super.createChildren(children);
/>/  +            }
/>/  +            //Debug.info('createChildren', children);
/>/  +            ]]>
/>/  +</method>
/>/  +<!--- Finish creating children
/>/  +              @access private -->
/>/  +<method name="__finishCreate">
/>/  +<![CDATA[
/>/  +            super.createChildren(this.__remainingChildren);
/>/  +            Debug.info('__finishCreate', this.__remainingChildren);
/>/  +            this.__remainingChildren = null;
/>/  +            ]]>
/>/  +</method>
/>/</class>
/>/
/>/
/>/
/>/
/>/  _______________________________________________
/>/  Laszlo-checkins mailing list
/>/  Laszlo-checkins at 
openlaszlo.org<http://www.openlaszlo.org/mailman/listinfo/laszlo-dev>
/>/  http://www.openlaszlo.org/mailman/listinfo/laszlo-checkins
/




Reply via email to