ConceptTree
This control is based on the YUI TreeView Control version 2.9.0 (scripts are included in the minified version of the API)
and provides a hierarchical representation of the DAB concept method.
- Required CSS:
<link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/2.9.0/build/fonts/fonts-min.css" />
<link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/2.9.0/build/treeview/assets/skins/sam/treeview.css" />
When a tree node is expanded, the method
extend is called on the correspondent Concept (available in the data
property).
As depicted in the image above (the test page is available here) each Concept is rendered using its
uri; rendering customization (e.g. icons visualization besides the uri)
can be done with the options.onCreateNode
and options.onLoadComplete
functions (see also onCreateNode and
onLoadComplete methods)
Constructor
ConceptTree
-
dabNode
-
id
-
[options]
Parameters:
-
dabNode
DABthe DAB node on which the concept method is called in order to generate concepts related to the given
keyword
-
id
Stringid of an existent HTML container (typically
<div>
element) in which the tree is inserted -
[options]
Object optionalobject literal of optional properties
-
[onCreateNode]
Function optionalcallback function called when a new tree node is created; this function can be used to customize the new tree node aspect and/or functionalities. See here for the default implementation
-
element
Concept \ DAB -
parentTreeNode
YAHOO.widget.HTMLNodethe parent tree node -
isRoot
Boolean
-
-
[keyword]
String optionalthe keyword by which generate the related concepts. If omitted it can be set with the conceptKeyword method
-
[onLoadComplete]
Function optionalcallback function called when all the expanded node children have been rendered. If omitted it can be set with the onLoadComplete method
-
treeNodes array
YAHOO.widget.HTMLNode []
-
-
[onError]
Function optionalthis function is called if an error occurs during the execution of the extend method on the target tree node
-
treeNode
YAHOO.widget.HTMLNode -
error
Stringthe error message
-
-
Item Index
Methods
conceptKeyword
-
keyword
Get and optionally set the keyword by which to generate the related concepts; the concepts will be rendered as tree nodes when the root tree node is expanded
onCreateNode
-
[callback]
Get and optionally set the callback function called when a new tree node is created; this function can be used to customize the new tree node aspect and/or functionalities. The default implementation is as follows:
function(element, parentTreeNode, isRoot){
var oData = null;
if(isRoot){
// element is the DAB node
oData = element.report().title;
}else{
// element is a Concept
oData = element.uri();
}
return oData;
}
Parameters:
Returns:
the current onCreateNode
function
onLoadComplete
-
[callback]
Get and optionally set the function called when all the expanded node children have been rendered
Parameters:
-
[callback]
Function optionalcallback function called when all the expanded node children have been rendered
-
treeNodes array
YAHOO.widget.HTMLNode []of rendered tree nodes. Each tree node provides the correspondent Concept in the
data
property
-
Returns:
the current onLoadComplete
function
relationExtension
-
treeNode
-
An
Get and optionally set the relations by which to extend
the treeNode
related concept.
An example of use of this method can be found here
where this method is used to set a single relation selected by the user (see also the image above).
See also Concept extend method
Parameters:
-
treeNode
YAHOO.widget.HTMLNodethe target tree node
-
An
Relation/String []