mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-13 13:25:37 +00:00
- not built -
adding tree outliner view test
This commit is contained in:
parent
3bca042764
commit
1a747ff552
143
extensions/venkman/resources/content/tests/tree.js
Normal file
143
extensions/venkman/resources/content/tests/tree.js
Normal file
@ -0,0 +1,143 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License
|
||||
* Version 1.1 (the "License"); you may not use this file except in
|
||||
* compliance with the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is The JavaScript Debugger
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation
|
||||
* Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation.
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the
|
||||
* terms of the GNU Public License (the "GPL"), in which case the
|
||||
* provisions of the GPL are applicable instead of those above.
|
||||
* If you wish to allow use of your version of this file only
|
||||
* under the terms of the GPL and not to allow others to use your
|
||||
* version of this file under the MPL, indicate your decision by
|
||||
* deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this
|
||||
* file under either the MPL or the GPL.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Robert Ginda, <rginda@netscape.com>, original author
|
||||
*
|
||||
*/
|
||||
|
||||
var sampleShare = new Object();
|
||||
var sampleTree = new TreeOView(sampleShare);
|
||||
|
||||
function SampleRecord (name, gender)
|
||||
{
|
||||
this.setColumnPropertyName ("sample-name", "name");
|
||||
this.setColumnPropertyName ("sample-gender", "gender");
|
||||
this.name = name;
|
||||
this.gender = gender;
|
||||
}
|
||||
|
||||
SampleRecord.prototype = new TreeOViewRecord(sampleShare);
|
||||
|
||||
sampleTree.childData.appendChild (new SampleRecord ("vinnie", "male"));
|
||||
var betty = new SampleRecord ("betty", "female");
|
||||
betty.reserveChildren();
|
||||
betty.open()
|
||||
betty.appendChild (new SampleRecord ("kid1", "male"));
|
||||
var kid2 = new SampleRecord ("kid2", "male");
|
||||
kid2.reserveChildren();
|
||||
var kid22 = new SampleRecord ("kid22", "female");
|
||||
kid2.appendChild (kid22);
|
||||
betty.appendChild (kid2);
|
||||
sampleTree.childData.appendChild (betty);
|
||||
sampleTree.childData.appendChild (new SampleRecord ("joey", "male"));
|
||||
|
||||
function onload ()
|
||||
{
|
||||
|
||||
var outliner = document.getElementById("sample-outliner");
|
||||
outliner.outlinerBoxObject.view = sampleTree;
|
||||
dt();
|
||||
// debugger;
|
||||
}
|
||||
|
||||
function toggleBetty ()
|
||||
{
|
||||
if (betty.isHidden)
|
||||
betty.unHide();
|
||||
else
|
||||
betty.hide();
|
||||
}
|
||||
|
||||
function formatRecord (rec, indent)
|
||||
{
|
||||
var str = "";
|
||||
|
||||
for (var i in rec._colValues)
|
||||
str += rec._colValues[i] + ", ";
|
||||
|
||||
str += "[";
|
||||
|
||||
str += rec.calculateVisualRow() + ", ";
|
||||
str += rec.childIndex + ", ";
|
||||
str += rec.level + ", ";
|
||||
str += rec.visualFootprint + ", ";
|
||||
str += rec.isHidden + "]";
|
||||
|
||||
dd (indent + str);
|
||||
}
|
||||
|
||||
function formatBranch (rec, indent)
|
||||
{
|
||||
for (var i = 0; i < rec.childData.length; ++i)
|
||||
{
|
||||
formatRecord (rec.childData[i], indent);
|
||||
if (rec.childData[i].childData)
|
||||
formatBranch(rec.childData[i], indent + " ");
|
||||
}
|
||||
}
|
||||
|
||||
function dbg()
|
||||
{
|
||||
var a = 0;
|
||||
dbg2();
|
||||
var c = 0;
|
||||
}
|
||||
|
||||
function dbg2()
|
||||
{
|
||||
var nothere;
|
||||
var nope = null;
|
||||
var f = false;
|
||||
var i = 4;
|
||||
var d = Number.MAX_VALUE;
|
||||
var s = "hello world";
|
||||
var fun = dbg;
|
||||
var obj = new Object();
|
||||
debugger;
|
||||
guessThis();
|
||||
}
|
||||
|
||||
function dt()
|
||||
{
|
||||
formatBranch(sampleTree.childData, "");
|
||||
}
|
||||
|
||||
var guessThis =
|
||||
function ()
|
||||
{
|
||||
var x = 1;
|
||||
}
|
||||
|
||||
var observer = {
|
||||
onFoo: function (){}
|
||||
}
|
||||
|
||||
|
39
extensions/venkman/resources/content/tests/tree.xul
Normal file
39
extensions/venkman/resources/content/tests/tree.xul
Normal file
@ -0,0 +1,39 @@
|
||||
<?xml version="1.0"?>
|
||||
|
||||
<?xml-stylesheet href="chrome://venkman/skin/venkman.css" type="text/css"?>
|
||||
|
||||
<window
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
orient="vertical" onload="onload();" height="300" width="200"
|
||||
persist="top left">
|
||||
<script>
|
||||
<![CDATA[
|
||||
var DEBUG = true;
|
||||
]]>
|
||||
</script>
|
||||
<script src="chrome://venkman/content/venkman-utils.js"/>
|
||||
<script>
|
||||
<![CDATA[
|
||||
dd = function (msg) { dump("-*- tree: " + msg + "\n"); }
|
||||
ASSERT = function (expr, msg) {
|
||||
if (!expr)
|
||||
dd ("** ASSERTION FAILED: " + msg + " **\n" + getStackTrace());
|
||||
}
|
||||
]]>
|
||||
</script>
|
||||
<script src="chrome://venkman/content/outliner-utils.js"/>
|
||||
<script src="chrome://venkman/content/tests/tree.js"/>
|
||||
<outliner flex="1" id="sample-outliner">
|
||||
<outlinercol id="sample-name" label="Name" primary="true" flex="1"
|
||||
class="outlinercol-header outlinercol-inset-header"/>
|
||||
<splitter class="sample-splitter"/>
|
||||
<outlinercol flex="1" id="sample-gender" label="Gender"
|
||||
class="outlinercol-header outlinercol-inset-header"/>
|
||||
<outlinerbody id="sample-body" flex="1"/>
|
||||
</outliner>
|
||||
|
||||
<button onclick="document.location.href=document.location.href" label="reload"/>
|
||||
<button onclick="toggleBetty()" label="toggle betty"/>
|
||||
<button onclick="dt()" label="dump tree"/>
|
||||
<button onclick="dbg();" label="debug"/>
|
||||
</window>
|
Loading…
Reference in New Issue
Block a user