Hi list,
i use treefullcontrol in my app. and it has a few "columns"(images as well as text) to display some status information of the tree folders/files. I become my status info from the backend approx. 5 times per minute so i have to update my tree(mainly columns text/image - rarely folder/files) and i'm searching for the efficient way to do this. The brutal way is to delete the tree and build it again, but it costs to much CPU resources and can take some seconds. So i'm looking for a better way to update my treefullcontrol.

Any help is appreciated,


You have to "find" the widgets in your tree. Then, setIcon is an easy task.

1. add to your TreeFolder-Objects an unique Name as pathpart
2. run every level to find the specific item (see code)
3. item.setIcon(...), qx.ui.core.Widget.flushGlobalQueues();

Tip: Do not add and remove treeitems without flush the queues, there is
an error in the qooxdoo class qx.core.Parent.

Bye, Christian.

Thank you for your help, Christian. The idea with subpath looks rather elegant(i solved this by adding a unique id to all tree-nodes and recursive going through the tree until i find the node with the right one). Subpath solution should be quicker. My second problem is "setIcon". I'm not sure how to do this, because my node rows has a few columns like:
 +Folder           statusImage1     infoText1     statusImage2   infoText2
     |
--File statusImage1 infoText1 statusImage2 infoText2

and i don't really know how to replace infoText or statusImage in the File/Folder without deleting them. Or is it better to remove the node, build it again and add at current position?
/**
 * Find in the qxTree the Folder-item pointed with subPath.
 *
 * @param {String} subPath  the subPath in the qxFolderTree
 * @param rootTree {Container-Object}
 * @param {Boolean} openOnTheFly
 * @return {qx.ui.treefullcontrol.FolderTree}
 */
qx.Proto._getQxSubTree = function(subPath, rootTree, openOnTheFly) {
    var pathList = subPath.split("/");
    var run = rootTree;

    for (var i=0; i<pathList.length; i++) {
        var childs = [];
        if (run.getContainerObject()){
            childs = run.getContainerObject().getChildren();
        }
        for (var j=0; j<childs.length; j++) {
            var item = childs[j];
            var usrData = item.getUserData('path_part');
            if (usrData == pathList[i]) {
                //this.debug("SearchOk: "+usrData);
                run = childs[j];
                if (openOnTheFly){
                    //... setSelectedElement doesn't do that.
                    run.open();
                }
                break;
            }
        }
    }
    return run;
};

-------------------------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to