not part of build; adding color and scrollbars, thanx to peterv. Adding late population of grid, respecting the search entry

This commit is contained in:
axel%pike.org 2001-03-05 15:39:28 +00:00
Родитель aa8c76796c
Коммит d5844e66ac
4 изменённых файлов: 67 добавлений и 41 удалений

Просмотреть файл

@ -33,7 +33,7 @@
<script type="text/javascript" src="xulTxTools.js" /> <script type="text/javascript" src="xulTxTools.js" />
<script type="text/javascript" src="DumpDOM.js" /> <script type="text/javascript" src="DumpDOM.js" />
<box align="horizontal"> <box align="horizontal">
<button value="refresh" oncommand="refresh_xalan()" /> <button value="load tests" oncommand="refresh_xalan()" />
<button value="check all" oncommand="check(true)" /> <button value="check all" oncommand="check(true)" />
<button value="uncheck all" oncommand="check(false)" /> <button value="uncheck all" oncommand="check(false)" />
<button value="invert checks" oncommand="invert_check()" /> <button value="invert checks" oncommand="invert_check()" />
@ -49,8 +49,8 @@
<box align="horizontal"> <box align="horizontal">
<titledbox align="horizontal"><title value="search" /> <titledbox align="horizontal"><title value="search" />
<button value="Search for " oncommand="select()"/> <button value="Search for " oncommand="select()"/>
<textfield style="width: 10em;" id="search-name" /><text value=" in " /> <textfield style="width: 10em;" id="search-name" persist="value" /><text value=" in " />
<menulist id="search-field"> <menulist id="search-field" persist="data">
<menupopup> <menupopup>
<menuitem data="1" value="Name" /> <menuitem data="1" value="Name" />
<menuitem data="2" value="Purpose" /> <menuitem data="2" value="Purpose" />
@ -59,21 +59,23 @@
</menulist> </menulist>
</titledbox> </titledbox>
<spring flex="1" /></box> <spring flex="1" /></box>
<grid> <box id="tests" flex="1">
<columns> <grid>
<column/> <columns>
<column flex="1"/> <column/>
<column flex="1"/> <column flex="1"/>
<column flex="1"/> <column flex="1"/>
</columns> <column flex="1"/>
</columns>
<rows id="xalan_grid"> <rows id="xalan_grid">
<row flex="1"> <row flex="1">
<text value=" " class="head"/> <text value=" " class="head"/>
<text value="Name" class="head"/> <text value="Name" class="head"/>
<text value="Purpose" class="head"/> <text value="Purpose" class="head"/>
<text value="Comment" class="head"/> <text value="Comment" class="head"/>
</row> </row>
</rows> </rows>
</grid> </grid>
</box>
</window> </window>

Просмотреть файл

@ -31,6 +31,14 @@ column {
margin-right: 2px; margin-right: 2px;
} }
junkwindow { #tests{
overflow: auto; overflow: auto;
} }
.succeeded {
background-color: green;
}
.failed {
background-color: red;
}

Просмотреть файл

@ -84,8 +84,10 @@ txDocSet.prototype = {
if (!isGood){ if (!isGood){
dump(" and failed\n\n"); dump(" and failed\n\n");
this.mVerbose=true; this.mVerbose=true;
handle_result(this.mName,false);
} else { } else {
dump(" and succeeded\n\n"); dump(" and succeeded\n\n");
handle_result(this.mName,true);
} }
if (this.mVerbose){ if (this.mVerbose){
dump("Result:\n"); dump("Result:\n");

Просмотреть файл

@ -23,7 +23,7 @@
var pop_last=0, pop_chunk=25; var pop_last=0, pop_chunk=25;
var isinited=false; var isinited=false;
var xalan_base, xalan_xml, xalan_elems, xalan_length, content_row, target; var xalan_base, xalan_xml, xalan_elems, xalan_length, content_row, target;
var pref; var matchRE, matchNameTag, matchFieldTag;
function loaderstuff(eve) { function loaderstuff(eve) {
var ns = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"; var ns = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
@ -33,8 +33,11 @@ function loaderstuff(eve) {
content_row.appendChild(document.createElementNS(ns,"text")); content_row.appendChild(document.createElementNS(ns,"text"));
content_row.appendChild(document.createElementNS(ns,"text")); content_row.appendChild(document.createElementNS(ns,"text"));
content_row.appendChild(document.createElementNS(ns,"text")); content_row.appendChild(document.createElementNS(ns,"text"));
content_row.setAttribute("class", "notrun");
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect'); netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
target = document.getElementById("xalan_grid"); target = document.getElementById("xalan_grid");
matchNameTag = document.getElementById("search-name");
matchFieldTag = document.getElementById("search-field");
xalan_base = document.getElementById("xalan_base"); xalan_base = document.getElementById("xalan_base");
xalan_xml = document.implementation.createDocument("","",null); xalan_xml = document.implementation.createDocument("","",null);
xalan_xml.addEventListener("load", xalanIndexLoaded, false); xalan_xml.addEventListener("load", xalanIndexLoaded, false);
@ -46,12 +49,11 @@ function loaderstuff(eve) {
function xalanIndexLoaded(e) { function xalanIndexLoaded(e) {
xalan_elems = xalan_xml.getElementsByTagName("test"); xalan_elems = xalan_xml.getElementsByTagName("test");
xalan_length = xalan_elems.length; xalan_length = xalan_elems.length;
populate_xalan();
return true; return true;
} }
function refresh_xalan() { function refresh_xalan() {
while(target.hasChildNodes()) target.removeChild(target.lastChild); while(target.childNodes.length>1) target.removeChild(target.lastChild);
xalan_elems = xalan_xml.getElementsByTagName("test"); xalan_elems = xalan_xml.getElementsByTagName("test");
xalan_length = xalan_elems.length; xalan_length = xalan_elems.length;
populate_xalan(); populate_xalan();
@ -61,22 +63,29 @@ function refresh_xalan() {
function populate_xalan() { function populate_xalan() {
var upper=pop_last+pop_chunk; var upper=pop_last+pop_chunk;
var current,test,i,j, re=/\/err\//; var current,test,i,j, lName, re=/\/err\//;
var searchField = matchFieldTag.getAttribute("data");
var matchValue = matchNameTag.value;
if (matchValue.length==0) matchValue='.';
var matchRE = new RegExp(matchValue);
for (i=pop_last;i<Math.min(upper,xalan_length);i++){ for (i=pop_last;i<Math.min(upper,xalan_length);i++){
current = content_row.cloneNode(true); current = content_row.cloneNode(true);
test = xalan_elems.item(i); test = xalan_elems.item(i);
if (!test.getAttribute("file").match(re)){ if (!test.getAttribute("file").match(re)){
current.setAttribute("id", test.getAttribute("file"));
current.childNodes.item(1).setAttribute("value", current.childNodes.item(1).setAttribute("value",
test.getAttribute("file")); test.getAttribute("file"));
for (j=0;j<test.childNodes.length;j++){ for (j=1;j<test.childNodes.length;j+=2){
if (test.childNodes.item(j).localName=="purpose") lName = test.childNodes.item(j).localName;
current.childNodes.item(2).setAttribute("value", if (lName=="purpose")
test.childNodes.item(j).firstChild.nodeValue); current.childNodes.item(2).setAttribute("value",
if (test.childNodes.item(j).localName=="comment") test.childNodes.item(j).firstChild.nodeValue);
current.childNodes.item(3).setAttribute("value", if (lName=="comment")
test.childNodes.item(j).firstChild.nodeValue); current.childNodes.item(3).setAttribute("value",
test.childNodes.item(j).firstChild.nodeValue);
} }
target.appendChild(current); if (matchRE.test(current.childNodes.item(searchField)
.getAttribute("value"))) target.appendChild(current);
} }
} }
if (pop_last+pop_chunk<xalan_length){ if (pop_last+pop_chunk<xalan_length){
@ -99,6 +108,14 @@ function dump_checked(){
do_transforms(todo); do_transforms(todo);
} }
function handle_result(name,success){
var classname = (success ? "succeeded" : "failed");
var content_row = document.getElementById(name);
if (content_row){
content_row.setAttribute("class",classname);
}
}
function hide_checked(yes){ function hide_checked(yes){
var checks = document.getElementsByTagName("checkbox"); var checks = document.getElementsByTagName("checkbox");
for (i=0;i<checks.length;i++){ for (i=0;i<checks.length;i++){
@ -109,15 +126,12 @@ function hide_checked(yes){
} }
function select(){ function select(){
var se = document.getElementById("search-name"); var searchField = matchFieldTag.getAttribute("data");
var searchField = document.getElementById("search-field"); var matchRE = new RegExp(matchNameTag.value);
searchField = searchField.getAttribute("data");
var re = new RegExp(se.value);
if (searchField<1 || searchField>3) return;
var nds = target.childNodes; var nds = target.childNodes;
for (i=1;i<nds.length;i++){ for (i=1;i<nds.length;i++){
node=nds.item(i).childNodes.item(searchField); node=nds.item(i).childNodes.item(searchField);
if (re.test(node.getAttribute("value"))) if (matchRE.test(node.getAttribute("value")))
nds.item(i).firstChild.setAttribute("checked",true); nds.item(i).firstChild.setAttribute("checked",true);
} }
} }