Hi guys,

here is my problem. I need to extend TabView.js in a very simple way,
actually just to allow tabs to go either at the left (current behavior) or
at the right of the tab bar. So what I did was extending TabView and adding
the following function:


        addSpecial: function(page, right)
        {
            if (qx.core.Variant.isSet("qx.debug", "on"))
            {
                if (!(page instanceof qx.ui.tabview.Page))
                {
                    throw new Error("Incompatible child for TabView: " +
page);
                }
            }

            var button = page.getButton();
            var bar = this.getChildControl("bar");
            var pane = this.getChildControl("pane");

            // Exclude page
            page.exclude();

            // ******** Different code ************ //
            if (right)
            {
                bar.add(button);
            }
            else
            {
                bar.addBefore(button, this.spacer);
            }
            // ******** End of different code ************ //

            pane.add(page);

            // Register button
            this.__radioGroup.add(button);

            // Add state to page
            page.addState(this.__barPositionToState[this.getBarPosition()]);

            // Update states
            page.addState("lastTab");
            var children = this.getChildren();
            if (children[0] == page)
            {
                page.addState("firstTab");
            }
            else
            {
                children[children.length - 2].removeState("lastTab");
            }

            page.addListener("close", this._onPageClose, this);
        },

This code is almost identical to the add function in the original class. Now
this worked quite well in development, but in production I realized that
private variable access is strictly enforced via a scrambling of the
variable names, so the build version of the application was totally failing.
I know I can turn off this scrambling but I would prefer not to, just for
this case. Besides, just copying that code and modifying it is not good (bad
practice). I should be overriding a much smaller section of the code.

So my question is simple, how can I extend the class and still do what I
need? Currently my workaround was to change all the private variables to
protected ones in the base class. That works, but in long term that's not OK
as i dont want to maintain patches against upstream version. I would rather
cooperate now with upstream to know what can be done on this case. I am
ready to provide patches etc, but I would like to find a way that's
acceptable to the Qooxdoo base team (upstream) and my own needs. That could
involve refactoring the code to make overriding specific methods more
easier, if you are OK with that.

I am looking for suggestions on how it could work for both of us, is there
an official policy on this maybe?

Looking forward to your reply,

Jean-Noel

PS: and to be honest I have not only TabView.js but also other classes from
which I extend and suffering the same exact problem.
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to