Holger Knublauch

Added onLoaded event to tree

...@@ -5828,6 +5828,13 @@ app:Tree ...@@ -5828,6 +5828,13 @@ app:Tree
5828 ] ; 5828 ] ;
5829 spin:constraint 5829 spin:constraint
5830 [ rdf:type spl:Argument ; 5830 [ rdf:type spl:Argument ;
5831 + rdfs:comment "An optional JavaScript snippet that is to be executed after the tree has loaded its roots."^^xsd:string ;
5832 + spl:optional "true"^^xsd:boolean ;
5833 + spl:predicate arg:onLoaded ;
5834 + spl:valueType xsd:string
5835 + ] ;
5836 + spin:constraint
5837 + [ rdf:type spl:Argument ;
5831 rdfs:comment "JavaScript code that shall be called if a node has been selected in the tree. In this code, the variable 'resource' points to the URI of the selected resource. The variable 'node' holds the selected low-level tree node."^^xsd:string ; 5838 rdfs:comment "JavaScript code that shall be called if a node has been selected in the tree. In this code, the variable 'resource' points to the URI of the selected resource. The variable 'node' holds the selected low-level tree node."^^xsd:string ;
5832 spl:optional "true"^^xsd:boolean ; 5839 spl:optional "true"^^xsd:boolean ;
5833 spl:predicate arg:onSelect ; 5840 spl:predicate arg:onSelect ;
...@@ -7775,6 +7782,11 @@ arg:oldElementId ...@@ -7775,6 +7782,11 @@ arg:oldElementId
7775 rdfs:label "old element id"^^xsd:string ; 7782 rdfs:label "old element id"^^xsd:string ;
7776 rdfs:subPropertyOf sp:arg . 7783 rdfs:subPropertyOf sp:arg .
7777 7784
7785 +arg:onLoaded
7786 + rdf:type rdf:Property ;
7787 + rdfs:label "on loaded"^^xsd:string ;
7788 + rdfs:subPropertyOf sp:arg .
7789 +
7778 arg:onSelect 7790 arg:onSelect
7779 rdf:type rdf:Property ; 7791 rdf:type rdf:Property ;
7780 rdfs:label "on select"^^xsd:string ; 7792 rdfs:label "on select"^^xsd:string ;
......
...@@ -403,8 +403,9 @@ function appResizeGrid(pane, $Pane, paneState) { ...@@ -403,8 +403,9 @@ function appResizeGrid(pane, $Pane, paneState) {
403 * Will expand if necessary, using a server-side shortest path algorithm. 403 * Will expand if necessary, using a server-side shortest path algorithm.
404 * @param treeId the id of the tree 404 * @param treeId the id of the tree
405 * @param nodeURI the URI of the resource to select 405 * @param nodeURI the URI of the resource to select
406 + * @param queryGraphURI the result of calling ui:currentQueryGraph()
406 */ 407 */
407 -function appSelectTreeNode(treeId, nodeURI) { 408 +function appSelectTreeNode(treeId, nodeURI, queryGraphURI) {
408 409
409 // TODO: Currently this only works on the Tree that was created last 410 // TODO: Currently this only works on the Tree that was created last
410 // but not if multiple trees are on a page 411 // but not if multiple trees are on a page
...@@ -428,6 +429,7 @@ function appSelectTreeNode(treeId, nodeURI) { ...@@ -428,6 +429,7 @@ function appSelectTreeNode(treeId, nodeURI) {
428 429
429 // Load path to root from the server and then call helper function 430 // Load path to root from the server and then call helper function
430 var data = { 431 var data = {
432 + _base: '<' + queryGraphURI + '>',
431 _format: 'json', 433 _format: 'json',
432 _viewClass: 'app:TreeShortestPathCallback', 434 _viewClass: 'app:TreeShortestPathCallback',
433 dataProvider: '<' + dataProviderURI + '>', 435 dataProvider: '<' + dataProviderURI + '>',
......
...@@ -50,5 +50,11 @@ ...@@ -50,5 +50,11 @@
50 }); 50 });
51 </ui:if> 51 </ui:if>
52 52
53 + <ui:if ui:condition="{= bound(?onLoaded) }">
54 + $("#{= ?id }").bind("loaded.jstree", function(event, data) {
55 + {= ?onLoaded }
56 + });
57 + </ui:if>
58 +
53 </script> 59 </script>
54 </ui:createLink> 60 </ui:createLink>
...\ No newline at end of file ...\ No newline at end of file
......