<html>
<head>
<title>example</title>
<SCRIPT>
function diputreeOnDblclick() {
var diputree = parent.frames["diputree"].document.diputree;
// event
var docElement = "#/1";
var pEvent = "#xpointer(hasevent/*)";
var event = diputree.lookup (docElement, pEvent);
// source
var pSourceURI = diputree.lookup(event,"#xpointer(hassource/uri/s)");
var pSource = diputree.getValue( pSourceURI );
var source = diputree.lookup(docElement, pSource);
// source text
var pText = diputree.lookup(source,"#xpointer(lt)");
var text = diputree.getValue( pText );
document.outputForm.sourceField.value = text;
// location
var pLocation = diputree.lookup(event,"#xpointer(haslocation/*)");
var location = diputree.getName(pLocation);
document.outputForm.locationField.value = location;
// button
var pButton = diputree.lookup(event,"#xpointer(hasbutton/button/i)");
var button = diputree.getValue( pButton );
document.outputForm.buttonField.value = button;
}
</SCRIPT>
</head>
<body>
<form name="outputForm" id="outputForm">
<p>source:
<P><input type="text" name="sourceField" id="sourceField">
<p>location:
<P><input type="text" name="locationField" id="locationField">
<p>button:
<P><input type="text" name="buttonField" id="buttonField">
</form>
</body>
</html>
The event that occurred, this will be a dblclick event because we only listen for dblclick events.
// event
var docElement = "#/1";
var pEvent = "#xpointer(hasevent/*)";
var event = diputree.lookup (docElement, pEvent);
The source of the event, this will the node that was clicked.
// source
var pSourceURI = diputree.lookup(event,"#xpointer(hassource/uri/s)");
var pSource = diputree.getValue( pSourceURI );
var source = diputree.lookup(docElement, pSource);
The text of the node that was clicked.
// source text
var pText = diputree.lookup(source,"#xpointer(lt)");
var text = diputree.getValue( pText );
document.outputForm.sourceField.value = text;
The location were was clicked. This can be handle, icon or label.
// location
var pLocation = diputree.lookup(event,"#xpointer(haslocation/*)");
var location = diputree.getName(pLocation);
document.outputForm.locationField.value = location;
The button that was clicked.
// button
var pButton = diputree.lookup(event,"#xpointer(hasbutton/button/i)");
var button = diputree.getValue( pButton );
document.outputForm.buttonField.value = button;