home *** CD-ROM | disk | FTP | other *** search
/ Internet.Works 39 / Issue 39.iso / mac / MacSoftware / Netscape 6 Full Installer / Installer Modules / browser.xpi / viewer / res / samples / rdf / DOMDataSourceViewer.js < prev    next >
Encoding:
JavaScript  |  2000-09-29  |  2.0 KB  |  64 lines

  1. /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
  2.  * The contents of this file are subject to the Netscape Public
  3.  * License Version 1.1 (the "License"); you may not use this file
  4.  * except in compliance with the License. You may obtain a copy of
  5.  * the License at http://www.mozilla.org/NPL/
  6.  * 
  7.  * Software distributed under the License is distributed on an "AS
  8.  * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
  9.  * implied. See the License for the specific language governing
  10.  * rights and limitations under the License.
  11.  * 
  12.  * The Original Code is Mozilla Communicator client code, released
  13.  * March 31, 1998.
  14.  * 
  15.  * The Initial Developer of the Original Code is Netscape
  16.  * Communications Corporation. Portions created by Netscape are
  17.  * Copyright (C) 1998-1999 Netscape Communications Corporation. All
  18.  * Rights Reserved.
  19.  */
  20.  
  21. var RDF = Components.classes['@mozilla.org/rdf/rdf-service;1'].getService();
  22. RDF = RDF.QueryInterface(Components.interfaces.nsIRDFService);
  23.  
  24. var domds;
  25.  
  26. function loadUrl() {
  27.     var urlwidget = document.getElementById("url");
  28.     
  29.     if (!urlwidget)
  30.         url = "resource:/res/samples/rdf/domviewer.html";
  31.     else
  32.         url = urlwidget.value;
  33.     
  34.     dump("Loading " + url + " into " + parent.window.frames["srcdoc"] +"\n");
  35.  
  36.     var win = window.frames["srcdoc"];
  37.     win.location=url;
  38.  
  39. }
  40.  
  41.  
  42. function setMode(mode, active) {
  43.     
  44.     domds.setMode(mode, active);
  45. }
  46.  
  47. function refreshTree() {
  48.  
  49.     dump("refresh..\n");
  50.     var ds = RDF.GetDataSource("rdf:domds");
  51.     domds = ds.QueryInterface(Components.interfaces.nsIDOMDataSource);
  52.     var win = window.frames["srcdoc"];
  53.     domds.setWindow(win);
  54.  
  55.     var tree = document.getElementById("dataSourceTree");
  56.     tree.clearItemSelection();
  57.     tree.setAttribute("ref","NC:DOMRoot");
  58. }
  59.  
  60. function onSrcLoaded() {
  61.     var ds = RDF.GetDataSource("rdf:domds");
  62.     domds = ds.QueryInterface(Components.interfaces.nsIDOMDataSource);
  63. }
  64.