I'm using a XUL tree with templates to display some content in an RDF datasource.
I started with a tree that had no flags attribute and I was able to write _JavaScript that accessed the properties of the selected node by calling getItemAtIndex. But alas, I could not sort the tree by clicking on the column headers - the reason I switched to RDF in the first place.
Through some playing around I determined that I could get the sorting to work by specifying the tree to have flags="dont-build-content". Great! Except now getItemAtIndex is undefined for this type of tree view. I saw very scant information online about using getResourceAtIndex, but I couldn't figure out how to use this function.
Otherwise, I might just have to instantiate two trees - one with dont-build-content and one without and make the latter invisible. But that seems like a hack in the extreme
So can I have my cake and eat it too? How?
Cheers,
-Marc
tree templates and dont-build-content
-
- Posts: 7
- Joined: March 28th, 2005, 1:37 am
- Location: Santa Clara, CA
- Contact:
-
- Posts: 4019
- Joined: November 16th, 2003, 3:05 am
- Location: Russia, Moscow
since you used "dont-build-content" flag, this is no longer a content tree (that is, actual XUL elements are not created for all items of it), so what do you expect getItemAtIndex to return?
getResourceAtIndex on the other hand, returns the RDF resource, from which the particular item was or will be built. You need to understand this, with non-content trees built from RDF, you can't manipulate the tree, only the underlying datasource. You can see a few working examples in http://menueditor.mozdev.org/ CVS (mostly, tree.xml), you can read about RDF manipulation on XUL planet (there's an RDF guide, linked from the Main tutorial).
You haven't actually posted what you want to do, so I can't tell you, how should you do it.
getResourceAtIndex on the other hand, returns the RDF resource, from which the particular item was or will be built. You need to understand this, with non-content trees built from RDF, you can't manipulate the tree, only the underlying datasource. You can see a few working examples in http://menueditor.mozdev.org/ CVS (mostly, tree.xml), you can read about RDF manipulation on XUL planet (there's an RDF guide, linked from the Main tutorial).
You haven't actually posted what you want to do, so I can't tell you, how should you do it.
-
- Posts: 7
- Joined: March 28th, 2005, 1:37 am
- Location: Santa Clara, CA
- Contact:
Thanks for the info.
Here's what I'm trying to do: http://marc.abramowitz.info/xullog-rdf.php
In particular, look at the showSelected() function. The problem I have now is when I call getResourceAtIndex, I get this error in my JavaScript Console:
Error: uncaught exception: Permission denied to create wrapper class for object of class UnnamedClass
Do I need a signed script to do this?
Here's what I'm trying to do: http://marc.abramowitz.info/xullog-rdf.php
In particular, look at the showSelected() function. The problem I have now is when I call getResourceAtIndex, I get this error in my JavaScript Console:
Error: uncaught exception: Permission denied to create wrapper class for object of class UnnamedClass
Do I need a signed script to do this?
http://marc.abramowitz.info
Author of Yahoo Search Sidebar Firefox extension
OS X / Windows / Linux / FreeBSD
Author of Yahoo Search Sidebar Firefox extension
OS X / Windows / Linux / FreeBSD
-
- Posts: 4019
- Joined: November 16th, 2003, 3:05 am
- Location: Russia, Moscow
Ugh. Remote XUL. I don't know much about it, but if it says it's not allowed, it probably isn't
If you don't get help here, try asking at XulPlanet XUL forum, GeorgeNava there is experienced with remote XUL.
If you don't get help here, try asking at XulPlanet XUL forum, GeorgeNava there is experienced with remote XUL.
-
- Posts: 7
- Joined: March 28th, 2005, 1:37 am
- Location: Santa Clara, CA
- Contact:
A little progress
If I set my browser to enable signed.applets.codebase_principal_support in about:config and then have the function request the UniversalXPConnect privilege:
then I can get it to work. Of course, I cannot ask everyone who visits my site to reconfigure their browser to a more insecure mode (:-)), but I think I've proved that if I sign the JavaScript (which hopefully isn't TOO much of a pain in the butt) then it might work.
Something seems too restrictive about the security model here. I certainly don't want Moz to be as insecure as IE, but in this case the security model is preventing me from reading properties of an RDF that I am already displaying. Not sure what the security exploit is here, but perhaps someone has thought a lot deeper about this and found some nasty things that one could do by reading remote RDF.
Code: Select all
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
then I can get it to work. Of course, I cannot ask everyone who visits my site to reconfigure their browser to a more insecure mode (:-)), but I think I've proved that if I sign the JavaScript (which hopefully isn't TOO much of a pain in the butt) then it might work.
Something seems too restrictive about the security model here. I certainly don't want Moz to be as insecure as IE, but in this case the security model is preventing me from reading properties of an RDF that I am already displaying. Not sure what the security exploit is here, but perhaps someone has thought a lot deeper about this and found some nasty things that one could do by reading remote RDF.
http://marc.abramowitz.info
Author of Yahoo Search Sidebar Firefox extension
OS X / Windows / Linux / FreeBSD
Author of Yahoo Search Sidebar Firefox extension
OS X / Windows / Linux / FreeBSD
-
- Posts: 582
- Joined: July 12th, 2004, 7:20 pm
How to create In-memory RDF from remote XML (12-01-2004)
http://in.geocities.com/skexz/tuts/xul/in-memory.htm
Here's something I stumbled upon that looks interesting.
http://in.geocities.com/skexz/tuts/xul/in-memory.htm
Here's something I stumbled upon that looks interesting.