Thank you Thomas.
I am not stopping here. I need to continue on this.
I started by editing demodata.js as an initial attempt.
I don't know why the following in demodata.js is not working.
demodata.js
=========
[{classname:"examples",folder:[
{
{nr:"1",title:"Atoms",name:"Atoms",desc:"Test", file:[
{nr:"2",title:"Atom 1",name:"Atom_1.html",desc:"<p>Test</p>"}
]
}}
]
}]
The code eval(content) throws error.
dataLoader : function(url)
{
var req = new qx.io.remote.Request(url);
req.setTimeout(180000);
req.setProhibitCaching(false);
req.addListener("completed", function(evt)
{
var loadEnd = new Date();
this.debug("Time to load data from server: " + (loadEnd.getTime() -
loadStart.getTime()) + "ms");
var content = evt.getData().getContent();
var start = new Date();
var treeData = eval(content);
var end = new Date();
this.debug("Time to eval tree data: " + (end.getTime() -
start.getTime()) + "ms");
// give the browser a chance to update its UI before doing more
qx.event.Timer.once(function()
{
this.tests.handler = new demobrowser.TreeDataHandler(treeData);
var start = new Date();
this.leftReloadTree();
var end = new Date();
this.debug("Time to build/display tree: " + (end.getTime() -
start.getTime()) + "ms");
// read initial state
var state = this._history.getState();
if (state) {
this.setCurrentSample(state.replace("~", "/"));
//this.widgets["treevi"].setSelectedElement()//TODO: this is a
kludge!
} else {
this.setCurrentSample(this.defaultUrl);
}
},
this, 0);
},
this);
req.addListener("failed", function(evt) {
this.error("Couldn't load file: " + url);
}, this);
var loadStart = new Date();
req.send();
},
Can somebody point the error please?
Firebug complains the following error.
invalid property id
[Break on this error] {nr:"1",title:"Atoms",name:"Atoms",desc:"Test",
file:[\n
DemoBrowser.js (line 1507)
demobrowser.DemoBrowser[70]: Demo loaded... Log.js (line 557
Thank you.
Kanugula.
thron7 wrote:
>
> kanugula wrote:
>> Hello,
>>
>> How can I add a sub folder let's say "atoms" under example folder in left
>> tree in Demo Browser?
>>
>> I looked at gendata.py code, I don't know anything about it.
>> .............................
>> for category in [ "example", "test", "performance" ]:
>> .............................
>>
>> Can somebody thow some light on this as we developed a project similar to
>> Demo Browser, but with deeper tree node herarachy.
>>
>>
>
> Hacking Python code isn't such a bad idea, after all ;-). You had the
> right intuition: Adding a folder under the 'html' directory (where
> 'example', 'test' and 'performance' already are), and adding the folder
> name in the above list in gendata.py gives you an easy way to add own
> samples to the Demobrowser. You then just put your samples (as .html)
> files in this directory, and with the next 'make' for source or build,
> they should show up in the Demobrowser.
>
> But this only gets you so far. The scanning of gendata.py is shallow,
> and as you said you want a deeper node hierarchy. Then you are on your
> own: You could either extend gendata.py to populate a richer JSON
> structure that fills the tree view in Demobrowser; or write this
> functionality in any other programming language you feel comfortable
> with (Perl, Java, ...).
>
> The basic issue at hand is fairly straight-forward: You go through the
> directories of interest and for each file you make a suitable entry in
> the JSON structure (don't be confused by the key 'tests' that holds the
> file entries; that's arbitrary ;). If you want to capture a deeper
> directory structure, do this recursively. The minimal properties of each
> file entry is probably only the file name (We added things like the
> label (for the tree node), a description (extracted from the html file),
> etc., which you might consider neclectable). But the main issue is: You
> have to do this before the app starts, with a shell tool or similar,
> since a web application cannot scan a directory for available files :-).
> That's why we build this JSON file 'demodata.js'.
>
> Once you have this in place, you probably have to take a sharp look at
> the method that parses this JSON file, to build the tree structure. I'm
> afraid it might not be general enough to accommodate arbitrary deep
> structures (I should have cleaned up the code that does this ... :-(.
> The JSON file is retreived in the 'dataLoader' method, and the visual
> tree is built in the 'leftReloadTree' method. (Everything is a bit more
> complicated than necessary, since I initially planned for an alternative
> view besides the hierarchical tree...). In 'leftReloadTree' you will
> find all the Tree building methods Helder wrote about, so there is no
> magic here: The visual tree is simply built from the JSON data, and you
> can do the same in whatever way befits you (e.g. change or invent new
> keys for the data, ...), as long as you keep the data structure and the
> method parsing it in sync.
>
> Thomas
>
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2008.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> _______________________________________________
> qooxdoo-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
>
>
--
View this message in context:
http://www.nabble.com/How-to-add-subfolder-under-example-in-Demo-Browser-left-tree--tp15345113p16768928.html
Sent from the qooxdoo-devel mailing list archive at Nabble.com.
-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel