Hi,

I solved my first problem (preload the right pane with the roots folders)
thanks to you. The root had to be visible to be added to selection:

store.addListener("loaded", function(ev) {
    tree.addToSelection(tree.getRoot()); // First I add the root to
selection
    tree.set({hideRoot: true}); // ...THEN I hide it
    tree.getRoot().setOpen(true);
}, this);


I solved my last problem (only wanting to show files in the right pane, not
in the tree) this way:

The data from server:

{
    "name": "root",
    "folders": [
        {
            "name": "Automobil.se",
            "folders": [
                {
                    "name": "Subfolder 1",
                    "files": [
                        "name": "THIS IS A FILE"
                    ]
                } 
            ]
        }
    ]
}

Instead of binding the treeController to the desktopController
(treeController.bind("selection[0].folders", desktopController, "model");),
I do it manually:

treeController.addListener("changeSelection", function(o) {
    var getter = qx.core.Property.$$method.get;
    var data = o.getData().toArray()[0];

    if(data[getter['folders']]) {
        desktopController.setModel(data.get('folders'));
    }
    else if(data[getter['files']]) {
        desktopController.setModel(data.get('files'));
    }
    else {
        desktopController.resetModel();
        return
    }
}, this);


About the orientation issue: At the moment, my desktop.Container extends the
qx.ui.core.scroll.AbstractScrollArea (same as List does).
I'm going to let it extend qx.ui.core.Widget instead and do the navigation
like in the Gallery demo.


Thoughts on this are very appreciated :)

//Rickard


MartinWittemann wrote:
> 
> Hello Rickard,
> 
> your result so far loks really great! But now to your questions:
> 
> 
> Dr. Flink wrote:
>> 
>> The tree controllers store is bound to the new controller through:
>> <p><code>treeController.bind("selection[0].folders", desktopController,
>> "model");</code></p>
>> 
> That looks like it exactly the way i thought of it. :)
> 
> 
> Dr. Flink wrote:
>> 
>> To mark the items as selected in the right pane I made a new Appearence I
>> named "desktopitem". Is this the correct way to go?
>> 
> Yes, why not. You can always apply your own appearance if you like it.
> Another possibility is to overwrite the original appearance called
> 'listitem'.
> 
> 
> Dr. Flink wrote:
>> 
>> I want the tree root content to be initially loaded into the right pane.
>> I tried this, but with no result:
>> <pre>
>> store.addListener("loaded", function(ev) {
>>     tree.getRoot().setOpen(true);
>>     tree.addToSelection(tree.getRoot());
>>     treeController.bind("selection[0].folders", desktopController,
>> "model");
>> }, this);
>> </pre>
>> 
> Your code is doing three things at once. 
> First, the opening of the root folder should work, right? You can see an
> example here:
> http://demo.qooxdoo.org/current/demobrowser/#data~JsonToTree.html
> Second, you are selecting the root. Well, maybe thats working but your
> tree's root folder is not visible so you will not see it (i guess).
> Perhaps you should try to make the root node visible to see if its
> working. Another tip to the selection handling. You can always use models
> and push them into the selection array of the controller. That way, you
> dont have to bother with any tree folder at all!
> Third, you set up the binding. That's working but you don't need to put
> that line into the loaded handler. The binding can handle that nicely
> without any extra code. As soon as the a selection is made, the model of
> the list controller will be set.
> 
> 
> Dr. Flink wrote:
>> 
>> I want the user to be able to navigate through all the arrow keys, not
>> just left/right. Any Ideas?
>> I guess it must have something to do with:
>> <pre>
>> orientation :
>> {
>>     check : ["horizontal", "vertical"],
>>     init : "horizontal",
>>     apply : "_applyOrientation"
>> },
>> ...
>> ...
>> _applyOrientation : function(value, old)
>> {
>>     // Configure spacing
>>     this._applySpacing(this.getSpacing());
>> },
>> </pre>
>> ...I would like to use "both" ;).
>> 
> The orientation property is for the look of the list. Take a look at the
> list demo to see how it can be used:
> http://demo.qooxdoo.org/current/demobrowser/#widget~List.html
> Enabling both would be some kind of 'i don't know what to do'. ;) 
> But thats an interesting task because you have to subclass the list and
> handle the "up" and "down" keys yourself by stepping the right amount of
> list items. So you need to know how many list items are in one line to do
> that job right.
> 
> 
> Dr. Flink wrote:
>> 
>> And, my last question (for now). Is it possible to mark a folder as
>> "leaf" in the model?
>> I do not want the deepest level to be visible in the tree if it is
>> "files" and not "folders".
>> In other words: Automobil.se -> Subfolder 1 (leaf).
>> ...but still, the content inside of subfolder 1 will be rendered in the
>> desktop container (right pane).
>> 
> Well, we don't have such a functionality exactly as you need it. But i can
> imagine that you put an extra flog into your model which holds a boolean
> value if the folder should be visible or not. That flag could be bound to
> visibility property of the widget, which should do this job.
> 
> Regards,
> Martin
> 

-- 
View this message in context: 
http://n2.nabble.com/Bind-tree-controller-to-a-composite-container-tp4255140p4272811.html
Sent from the qooxdoo 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
qooxdoo-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to