Hi Ric,

what Martin meant with his comment was that the TreeFolder and TreeFile 
widgets in qooxdoo are identical except for their appearance, so it 
doesn't really matter which you use to populate a Tree.

I'd say the Json store is the right approach for what you're trying to 
achieve.


Regards,
Daniel

Riccardo-Maria BIANCHI schrieb:
> MartinWittemann wrote:
>> Hi Luke,
>>
>> I don't get all what you are trying to to but I try to answer everything I
>> get.
>> 1. Creating tree files and tree folders is not really necessary. Just use
>> folders all the time and set the icon to the type you want. That would make
>> the taks much easier. The only difference in qooxdoo is the styling so it
>> really should not be a problem creating folders all the time.
>>   
> Hi Martin,
> 
> I'm also building an application with a tree which has to list files 
> from folders, and then the user has to be able to open those files 
> (image files) clicking on them.
> 
> I have very little experiences with GUIs so far, so my first idea was to 
> use a server-side python function to read folders and then serve the 
> list of files to a qooxdoo tree via JSON.
> 
> But in your answer above you say that it's not really necessary  
> creating tree files and folders. What do you mean exactly? How could I 
> do it?
> 
> Many many thanks for your kind help :-)
> 
> And have a Merry Christmas Time!! :-)
> 
>    Ric.
> 
> 
> 
>> 2. Syncing the selection is not that hard than you think. Every tree folder
>> has a property called model where its representative model object is
>> available. Therefore, you can bind the selection of your model to the
>> modelSelection of the selectbox:
>> treeItem.bind("model.sel", treeItem.getUserData('sel'), "modelSelection);
>> But binding the model selection means that the at least one ListItems in the
>> SelectBox need to have the set model stored in its model property.
>> 3. We can use the same model property for the button listener: 
>> button.addListener("execute", function(){
>>   this.info(treeItem.getModel().getId());
>> });
>> I hope those info helps you a bit to get closer to your goal.
>> Seasonal greetings,
>> Martin
>>
>>
>>
>> lp1051 wrote:
>>   
>>> Good morning,
>>>
>>> I see that higher number of qooxdoo widgets inside Tree, generates
>>> "Unresponsive script" dialog. I know, Derrell warned me, 
>>> so now I am trying some optimizations. I started with tree data
>>> controller,
>>> tree model and binding with delegate options, as it seems to speed things
>>> up.
>>> But! Not much success...
>>> Here is snippet of code :
>>>
>>> * from this model I want to create Folder items from 1st level kids and
>>> File
>>> items from kids on 2nd level
>>> * addListener to button with proper "id" of item (could be maybe solved by
>>> setting userData('id'), but don't know how to assign it in the delegate
>>> option)
>>> * select item from SelectBox based on value of "sel"
>>>
>>> var data = {
>>>      name: "root",
>>>      kids: [
>>>              {name: "folder1", sel:1, id:1, kids: [{name: "file1", sel:3, 
>>> id:3}]},
>>>              {name: "folder2", sel:2, id:2, kids: [{name: "file1", sel:1, 
>>> id:4},
>>> {name: "file2", sel:3, id:5}]}
>>>      ]
>>> };
>>>
>>> model = qx.data.marshal.Json.createModel(data);
>>>
>>> var tree = new qx.ui.tree.Tree();
>>> this.getRoot().add(tree);
>>>
>>> controller = new qx.data.controller.Tree(model, tree, "kids", "name");
>>>
>>>
>>> But how can I then write createItem and configureItem methods? The
>>> following
>>> piece is rather pseudo code, that creates only Folders with the additional
>>> widgets in other columns.
>>>
>>> var delegate =
>>> {
>>>             createItem: function() {
>>>                     var treeItem = new qx.ui.tree.TreeFolder();
>>>                     treeItem.addWidget(new qx.ui.core.Spacer(), {flex: 1});
>>>                     
>>>                     treeItem.setUserData('sel',new qx.ui.form.SelectBox());
>>>                     treeItem.addWidget(treeItem.getUserData('sel'));
>>>                     
>>>                     var button = new qx.ui.form.Button('title', 
>>> 'icon_path');
>>>                     treeItem.setUserData('but', button);
>>>                     treeItem.addWidget(button);
>>>                     button.addListener("execute", function(){this.info('id 
>>> of treeItem is 
>>> '+treeItem.getUserData('id')???)});
>>>
>>>                     treeItem.setOpen(true);
>>>              
>>>                     return treeItem; 
>>>             },
>>>             configureItem: function(item) {
>>>
>>>             }
>>> }; 
>>>
>>> Right now it feels like I would need to split the model in two pieces -
>>> one
>>> with folders, another with files and for each apply different delegate
>>> object. 
>>> I am not sure if it's even possible as data controller needs the path to
>>> children as well...
>>> And still, I have no idea how to implement the selection in SelectBox or
>>> setting userData mentioned in model.
>>> It reminds me a little of table cell renderer Replace or Conditional, but
>>> this time it is not a virtual tree...
>>>
>>> I would really appreciate any hint or guidance.
>>> Thanks,
>>> Luke
>>>
>>> -- 
>>> View this message in context:
>>> http://old.nabble.com/JsonToTree-and-Tree-data-controller-with-delegate-options-usage-tp26840571p26840571.html
>>> Sent from the qooxdoo-devel mailing list archive at Nabble.com.
>>>
>>>
>>> ------------------------------------------------------------------------------
>>> This SF.Net email is sponsored by the Verizon Developer Community
>>> Take advantage of Verizon's best-in-class app development support
>>> A streamlined, 14 day to market process makes app distribution fast and
>>> easy
>>> Join now and get one step closer to millions of Verizon customers
>>> http://p.sf.net/sfu/verizon-dev2dev 
>>> _______________________________________________
>>> qooxdoo-devel mailing list
>>> [email protected]
>>> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
>>>
>>>
>>>     
>>   
> 
> 
> ------------------------------------------------------------------------------
> This SF.Net email is sponsored by the Verizon Developer Community
> Take advantage of Verizon's best-in-class app development support
> A streamlined, 14 day to market process makes app distribution fast and easy
> Join now and get one step closer to millions of Verizon customers
> http://p.sf.net/sfu/verizon-dev2dev 
> _______________________________________________
> qooxdoo-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
> 
> 


------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev 
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to