Hello,

the standard .clone() method in 0.5.3 didn't work for me so I wrote a 
replacement which does. Maybe you find this useful.

Cheers,

Christian

/**
 * replacing clone method
 */

QxWidget.prototype.clone = function ( cloneRecursive, customPropertyList )
{
  var     i, propertyName,
          cloneInstance         = new window[ this.classname ],
          propertyIngoreList     = 
this._clonePropertyIgnoreList.split(QxConst.CORE_COMMA);
          propertyList          = QxUtil.isValid( customPropertyList ) ?
                                   customPropertyList : 
this._properties.split(QxConst.CORE_COMMA);
   
    // copy properties
    for ( i=0; i < propertyList.length; i++ )
    {
        propertyName = propertyList[i];
        if ( ! propertyIngoreList.contains(propertyName) )
        {
            propertyName = propertyName.toFirstUp();
            cloneInstance[QxConst.INTERNAL_SET + 
propertyName](this[QxConst.INTERNAL_GET + propertyName]());
        };
    };
   
    // clone recursion
    if ( cloneRecursive )
    {
        this._cloneRecursive ( cloneInstance );
    };
   
    return cloneInstance;
};

/**
 * adding missing _cloneRecursive method
 */
QxWidget.prototype._cloneRecursive = function ( cloneInstance )
{
    var i, children = this.getChildren();
    if ( children )
    {
        for ( i=0; i < children.length; i++)
        {
            cloneInstance.add ( children[i].clone(true) );
        };
    };
};

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
qooxdoo-devel mailing list
qooxdoo-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to