gecko-dev/browser/base/content/toolbarTest.xul

298 lines
10 KiB
Plaintext
Raw Normal View History

2002-08-04 02:55:51 +00:00
<?xml version="1.0"?>
<?xul-overlay href="chrome://global/content/globalOverlay.xul"?>
<?xul-overlay href="chrome://communicator/content/sidebar/sidebarOverlay.xul"?>
<?xml-stylesheet href="chrome://navigator/skin/" type="text/css"?>
<?xml-stylesheet href="chrome://communicator/skin/bookmarks/bookmarks.css" type="text/css"?>
<window id="toolbarTest"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns:nc="http://home.netscape.com/NC-rdf#"
orient="vertical" onload="resetToolbars();">
<script>
<![CDATA[
var rdfs = Components.classes["@mozilla.org/rdf/rdf-service;1"].getService(Components.interfaces.nsIRDFService);
var rdfc = Components.classes["@mozilla.org/rdf/container;1"].getService(Components.interfaces.nsIRDFContainer);
function recurse()
{
}
function resetToolbars()
{
var toolbox = document.getElementById("main-toolbox");
var bmds = rdfs.GetDataSource("rdf:bookmarks");
toolbox.database.AddDataSource(bmds);
bmds = rdfs.GetDataSource("rdf:chrome");
toolbox.database.AddDataSource(bmds);
bmds = rdfs.GetDataSource("rdf:window-mediator");
toolbox.database.AddDataSource(bmds);
var sidebarDS = rdfs.GetDataSource(get_sidebar_datasource_uri());
toolbox.database.AddDataSource(sidebarDS);
// poke around
var db = toolbox.database;
var panelsres = rdfs.GetResource("urn:sidebar:current-panel-list", true);
var panellist = rdfs.GetResource("http://home.netscape.com/NC-rdf#panel-list", true);
var foopy = db.GetTarget(panelsres, panellist, true);
rdfc.Init(db, foopy);
var elts = rdfc.GetElements();
var titletgt = rdfs.GetResource("http://home.netscape.com/NC-rdf#title", true);
while(elts.hasMoreElements()) {
var currElt = elts.getNext().QueryInterface(Components.interfaces.nsIRDFResource);
var title = db.GetTarget(currElt, titletgt, true).QueryInterface(Components.interfaces.nsIRDFLiteral);
dump("*** curr title = " + title.Value + "\n");
}
toolbox.builder.rebuild();
}
function exploreDS()
{
var tree = document.getElementById("dispTree");
var bmds = rdfs.GetDataSource("rdf:bookmarks");
tree.database.AddDataSource(bmds);
bmds = rdfs.GetDataSource("rdf:history");
tree.database.AddDataSource(bmds);
tree.builder.rebuild();
}
function initPopup ()
{
var element = document.popupNode;
var panelSrc = document.getElementById("panelsrc");
var src = element.getAttribute("content");
var popup = document.getElementById("panelpopup");
if (src != panelSrc.getAttribute("src")) {
panelSrc.setAttribute("src", src);
popup.setAttribute("title", element.value);
}
}
]]>
</script>
<popupset>
<popup type="floater" id="panelpopup" onpopupshowing="initPopup();"
menugenerated="true" popupanchor="bottomleft" popupalign="topleft">
<vbox flex="1">
<menuitem label="Add Current Page" class="menuitem-floater"/>
<menuitem label="Manage Bookmarks..." class="menuitem-floater"/>
<iframe flex="1" id="panelsrc" style="min-width: 1px; min-height: 1px;"/>
</vbox>
</popup>
<!--
<popup id="panelpopup" onpopupshowing="initPopup();" orient="vertical"
class="popup-resizable"
style="min-width: 100px; max-width: 300px;">
<vbox class="floater-box">
<hbox class="floater-box-top">
<titlebar flex="1"/>
</hbox>
<hbox class="floater-box-center" flex="1">
<hbox class="floater-children" flex="1">
<iframe flex="1" id="panelsrc" style="width: 170px; height: 200px;"/>
</hbox>
</hbox>
<hbox class="floater-box-bottom">
<resizer direction="bottom" flex="1"/>
<resizer direction="bottomright"/>
</hbox>
</vbox>
</popup>
-->
</popupset>
<toolbox id="main-toolbox"
datasources="chrome://browser/content/toolbarTest.rdf rdf:bookmarks"
ref="urn:mozilla:navigator:toolbars:root">
<template>
<!-- toolbar -->
<rule>
<conditions>
<content uri="?uri"/>
<triple subject="?uri"
predicate="http://home.netscape.com/NC-rdf#child"
object="?items"/>
<member container="?items" child="?item"/>
<triple subject="?item"
predicate="http://home.netscape.com/NC-rdf#Element"
object="toolbar"/>
</conditions>
<bindings>
<binding subject="?item"
predicate="http://home.netscape.com/NC-rdf#Class"
object="?item-class"/>
<binding subject="?item"
predicate="http://home.netscape.com/NC-rdf#Name"
object="?item-name"/>
</bindings>
<action>
<toolbar uri="?item" class="?item-class"
grippytooltiptext="?item-name"/>
</action>
</rule>
<!-- bookmark separators -->
<rule>
<conditions>
<content uri="?uri"/>
<triple subject="?uri"
predicate="http://home.netscape.com/NC-rdf#child"
object="?items"/>
<member container="?items" child="?item"/>
<triple subject="?item"
predicate="http://www.w3.org/1999/02/22-rdf-syntax-ns#type"
object="http://home.netscape.com/NC-rdf#BookmarkSeparator"/>
</conditions>
<action>
<toolbarseparator uri="?item"/>
</action>
</rule>
<!-- installed themes -->
<rule>
<conditions>
<content uri="?uri"/>
<triple subject="?uri"
predicate="http://home.netscape.com/NC-rdf#child"
object="?items"/>
<member container="?items" child="?item"/>
<triple subject="?item"
predicate="http://www.mozilla.org/rdf/chrome#displayName"
object="?item-name"/>
</conditions>
<bindings>
<binding subject="?item"
predicate="http://home.netscape.com/NC-rdf#Class"
object="?item-class"/>
<binding subject="?item"
predicate="http://home.netscape.com/NC-rdf#Icon"
object="?item-icon"/>
<binding subject="?item"
predicate="http://home.netscape.com/NC-rdf#Type"
object="?item-type"/>
</bindings>
<action>
<button uri="?items" class="?item-class button-toolbar bookmarkitem" label="?uri"
tooltiptext="?item-name"
src="?item-icon" type="?item-icon" crop="right"/>
</action>
</rule>
<!-- sidebar panels -->
<rule>
<conditions>
<content uri="?uri"/>
<triple subject="?uri"
predicate="http://home.netscape.com/NC-rdf#child"
object="?item"/>
<triple subject="?item"
predicate="http://home.netscape.com/NC-rdf#panel-list"
object="?panel-list"/>
<member container="?panel-list" child="?panel"/>
<triple subject="?panel"
predicate="http://home.netscape.com/NC-rdf#title"
object="?title"/>
<triple subject="?panel"
predicate="http://home.netscape.com/NC-rdf#content"
object="?content"/>
</conditions>
<action>
<button uri="?panel" class="button-toolbar bookmarkitem"
label="?title" content="?content"
popup="panelpopup"/>
</action>
</rule>
<!-- everything else -->
<rule>
<conditions>
<content uri="?uri"/>
<triple subject="?uri"
predicate="http://home.netscape.com/NC-rdf#child"
object="?items"/>
<member container="?items" child="?item"/>
</conditions>
<bindings>
<binding subject="?item"
predicate="http://home.netscape.com/NC-rdf#Name"
object="?item-name"/>
<binding subject="?item"
predicate="http://home.netscape.com/NC-rdf#Class"
object="?item-class"/>
<binding subject="?item"
predicate="http://home.netscape.com/NC-rdf#Icon"
object="?item-icon"/>
<binding subject="?item"
predicate="http://home.netscape.com/NC-rdf#Type"
object="?item-type"/>
</bindings>
<action>
<button uri="?items" class="?item-class button-toolbar bookmarkitem" label="?item-name"
src="?item-icon" type="?item-icon" crop="right"/>
</action>
</rule>
</template>
</toolbox>
<!--
<tree id="dispTree" datasources="rdf:bookmarks chrome://browser/content/toolbarTest.rdf"
ref="urn:mozilla:navigator:toolbars:root"
style="height: 0px; width: 0px;" flex="1">
<treehead>
<treerow>
<treecell class="treecell-header" label="Item Name"/>
<treecell class="treecell-header" label="Item URI"/>
</treerow>
</treehead>
<template>
<rule>
<conditions>
<content uri="?uri"/>
<triple subject="?uri"
predicate="http://home.netscape.com/NC-rdf#child"
object="?items"/>
<member container="?items" child="?item"/>
<triple subject="?item"
predicate="http://home.netscape.com/NC-rdf#Name"
object="?name"/>
</conditions>
<action>
<treechildren>
<treeitem uri="?item">
<treerow>
<treecell class="treecell-indent bookmarkitem" label="?name"/>
<treecell label="?item"/>
</treerow>
</treeitem>
</treechildren>
</action>
</rule>
</template>
<treecols>
<treecol/>
<splitter class="tree-splitter"/>
<treecol flex="1"/>
</treecols>
<treechildren flex="1"/>
</tree>
-->
<hbox flex="1">
<vbox id="sidebar-box" class="chromeclass-extrachrome"/>
<splitter id="sidebar-splitter" class="chromeclass-extrachrome" />
<hbox flex="1"/>
</hbox>
</window>