166 lines
5.7 KiB
XML
166 lines
5.7 KiB
XML
<?xml version="1.0"?>
|
|
|
|
<?xml-stylesheet href="chrome://communicator/skin/"?>
|
|
<?xml-stylesheet href="chrome://communicator/content/bookmarks/oTest.css"?>
|
|
|
|
<?xul-overlay href="chrome://global/content/globalOverlay.xul"?>
|
|
|
|
<window id="bookmarksOutlinerTest" width="640" height="480"
|
|
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
|
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
|
orient="vertical"
|
|
onload="Startup();">
|
|
|
|
|
|
<script>
|
|
<![CDATA[
|
|
var bookmarksBuilderObserver = {
|
|
onToggleOpenState: function (aIndex) {
|
|
dump("*** onToggleOpenState(" + aIndex + ");\n");
|
|
},
|
|
|
|
onCycleHeader: function (aColID, aDOMElement) {
|
|
dump("*** onCycleHeader(" + aColID + ", " + aDOMElement + ");\n");
|
|
},
|
|
|
|
onCycleCell: function (aIndex, aColID) {
|
|
dump("*** onCycleCell(" + aIndex + ", " + aColID + ");\n");
|
|
},
|
|
|
|
onSelectionChanged: function () {
|
|
dump("*** onSelectionChanged\n");
|
|
},
|
|
|
|
isEditable: function (aIndex, aColID) {
|
|
dump("*** isEditable(" + aIndex + ", " + aColID + ");\n");
|
|
return aColID == "NameColumn";
|
|
},
|
|
|
|
onSetCellText: function (aIndex, aColID, aValue) {
|
|
dump("*** onSetCellText(" + aIndex + ", " + aColID + ", " + aValue + ");\n");
|
|
},
|
|
|
|
onPerformAction: function (aAction) {
|
|
dump("*** onPerformAction(" + aAction + ");\n");
|
|
},
|
|
|
|
onPerformActionOnRow: function (aAction, aIndex) {
|
|
dump("*** onPerformActionOnRow(" + aAction + ", " + aIndex + ");\n");
|
|
},
|
|
|
|
onPerformActionOnCell: function (aAction, aIndex, aColID) {
|
|
dump("*** onPerformActionOnCell(" + aAction + ", " + aIndex + ", " + aColID + ");\n");
|
|
}
|
|
};
|
|
|
|
function Startup()
|
|
{
|
|
var outliner = document.getElementById("tree");
|
|
var builder = outliner.builder.QueryInterface(Components.interfaces.nsIXULOutlinerBuilder);
|
|
builder.addObserver(bookmarksBuilderObserver);
|
|
}
|
|
|
|
function getItemRect(aEvent)
|
|
{
|
|
var outliner = document.getElementById("outliner-proper");
|
|
var obo = outliner.boxObject.QueryInterface(Components.interfaces.nsIOutlinerBoxObject);
|
|
var row = { };
|
|
var col = { };
|
|
var elt = { };
|
|
obo.getCellAt(aEvent.clientX, aEvent.clientY, row, col, elt);
|
|
|
|
var x = { };
|
|
var y = { };
|
|
var w = { };
|
|
var h = { };
|
|
var crp = { };
|
|
obo.getCoordsForCellItem(row.value, col.value, elt.value, x, y, w, h, crp);
|
|
dump("*** (x,y) = (" + x.value + "," + y.value + "); (w,h) = (" + w.value + "," + h.value + ");\n");
|
|
}
|
|
|
|
const kRDF_NS = "http://www.w3.org/1999/02/22-rdf-syntax-ns#";
|
|
function createContextMenu (aEvent)
|
|
{
|
|
var outliner = document.getElementById("outliner-proper");
|
|
var obo = outliner.boxObject.QueryInterface(Components.interfaces.nsIOutlinerBoxObject);
|
|
var row = { };
|
|
var col = { };
|
|
var elt = { };
|
|
obo.getCellAt(aEvent.clientX, aEvent.clientY, row, col, elt);
|
|
dump("*** row.value = " + row.value + "\n")
|
|
|
|
var outlinerBody = document.getElementById("tree");
|
|
var rowResource = outlinerBody.builder.getResourceAtIndex(row.value);
|
|
|
|
const kRDFSvcContractID = "@mozilla.org/rdf/rdf-service;1";
|
|
const kRDFSvcIID = Components.interfaces.nsIRDFService;
|
|
const kRDFSvc = Components.classes[kRDFSvcContractID].getService(kRDFSvcIID);
|
|
var database = outlinerBody.database;
|
|
|
|
const krType = kRDFSvc.GetResource(kRDF_NS + "type");
|
|
var typeNode = kDatabase.GetTarget(rowResource, krType, true);
|
|
typeNode = typeNode.QueryInterface(Components.interfaces.nsIRDFResource);
|
|
dump("*** typeNode = " + typeNode.Value + "\n");
|
|
aEvent.preventBubble();
|
|
}
|
|
]]>
|
|
</script>
|
|
|
|
<!-- tooltips -->
|
|
<popupset id="aTooltipSet"/>
|
|
|
|
<popupset id="contextSet">
|
|
<popup id="bookmarkContextMenu" onpopupshowing="createContextMenu(event);"/>
|
|
</popupset>
|
|
|
|
<toolbox>
|
|
<toolbar>
|
|
<button class="button-toolbar-2" label="Foopy Noopy" oncommand="alert('hi');"/>
|
|
</toolbar>
|
|
</toolbox>
|
|
|
|
<stack>
|
|
<button label="Foopy Noopy" flex="1"/>
|
|
<bulletinboard flex="1">
|
|
<textbox value="NerpNerp" left="10" top="50" onblur="this.setAttribute('hidden','true');"/>
|
|
</bulletinboard>
|
|
</stack>
|
|
|
|
<outliner flex="1" flags="dont-test-empty" id="outliner-proper">
|
|
<outlinercols>
|
|
<outlinercol id="NameColumn"
|
|
class="outlinercol-header outlinercol-inset-header sortDirectionIndicator"
|
|
flex="1"
|
|
sort="rdf:http://home.netscape.com/NC-rdf#Name"
|
|
sortActive="true"
|
|
label="Name"
|
|
persist="width hidden sortActive sortDirection"
|
|
primary="true" />
|
|
|
|
<splitter class="tree-splitter"/>
|
|
|
|
<outlinercol id="URLColumn"
|
|
class="outlinercol-header outlinercol-inset-header sortDirectionIndicator"
|
|
flex="1"
|
|
sort="rdf:http://home.netscape.com/NC-rdf#URL"
|
|
label="Location"
|
|
persist="width hidden sortActive sortDirection" />
|
|
</outlinercols>
|
|
|
|
<outlinerbody id="tree" datasources="rdf:bookmarks rdf:internetsearch rdf:files" flex="1"
|
|
onclick="getItemRect(event);" ref="NC:BookmarksRoot">
|
|
<template>
|
|
<outlinerrow uri="rdf:*" properties="rdf:http://www.w3.org/1999/02/22-rdf-syntax-ns#type rdf:http://home.netscape.com/NC-rdf#loading">
|
|
<outlinercell ref="NameColumn"
|
|
label="rdf:http://home.netscape.com/NC-rdf#Name" />
|
|
|
|
<outlinercell ref="URLColumn"
|
|
label="rdf:http://home.netscape.com/NC-rdf#URL" />
|
|
</outlinerrow>
|
|
</template>
|
|
</outlinerbody>
|
|
</outliner>
|
|
|
|
</window>
|
|
|