mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-03-05 16:22:53 +00:00
read-only filter lists live!
fix up a bunch of stuff to make XBL widgets initialize after being inserted into the document
This commit is contained in:
parent
178a8c19eb
commit
d0528c2204
@ -32,12 +32,10 @@ function filterEditorOnLoad()
|
|||||||
if (args.filter) {
|
if (args.filter) {
|
||||||
gFilter = window.arguments[0].filter;
|
gFilter = window.arguments[0].filter;
|
||||||
|
|
||||||
dump("Filter editor loading with filter " + gFilter.filterName + "\n");
|
|
||||||
initializeDialog(gFilter);
|
initializeDialog(gFilter);
|
||||||
} else {
|
} else {
|
||||||
if (args.filterList)
|
if (args.filterList)
|
||||||
setScope(getScopeFromFilterList(args.filterList));
|
setScope(getScopeFromFilterList(args.filterList));
|
||||||
dump("New filter\n");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -83,14 +81,18 @@ function initializeDialog(filter)
|
|||||||
|
|
||||||
// now test by initializing the psuedo <searchterm>
|
// now test by initializing the psuedo <searchterm>
|
||||||
var searchTerm = document.getElementById("searchTerm");
|
var searchTerm = document.getElementById("searchTerm");
|
||||||
dump("initializing " + searchTerm + "\n");
|
|
||||||
|
|
||||||
var filterRowContainer = document.getElementById("filterListItem");
|
var filterRowContainer = document.getElementById("filterTermList");
|
||||||
var numTerms = filter.numTerms;
|
var numTerms = filter.numTerms;
|
||||||
for (var i=0; i<numTerms; i++) {
|
for (var i=0; i<numTerms; i++) {
|
||||||
var filterRow = createFilterRow(filter, i);
|
var filterRow = createFilterRow(filter, i);
|
||||||
filterRowContainer.appendChild(filterRow);
|
filterRowContainer.appendChild(filterRow);
|
||||||
|
|
||||||
|
setScope(getScope(filter))
|
||||||
|
// now that it's been added to the document, we can initialize it.
|
||||||
|
initializeFilterRow(filter, i);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function createFilterRow(filter, index)
|
function createFilterRow(filter, index)
|
||||||
@ -115,19 +117,21 @@ function createFilterRow(filter, index)
|
|||||||
// probably straight JS but I don't know how that's done.
|
// probably straight JS but I don't know how that's done.
|
||||||
var searchtermContainer = document.getElementById("searchterms");
|
var searchtermContainer = document.getElementById("searchterms");
|
||||||
var searchTerm = document.createElement("searchterm");
|
var searchTerm = document.createElement("searchterm");
|
||||||
try {
|
|
||||||
dump("created searchTerm: " + searchTerm + "\n");
|
|
||||||
dump("searchTerm tagname = " + searchTerm.tagName + "\n");
|
|
||||||
} catch (ex) {
|
|
||||||
dump("searchTerm dump Error: " + ex + "\n");
|
|
||||||
}
|
|
||||||
searchTerm.id = "searchTerm" + index;
|
|
||||||
searchTerm.searchattribute = searchAttr;
|
|
||||||
searchTerm.searchattribute = searchOp;
|
|
||||||
searchTerm.searchvalue = searchVal;
|
|
||||||
searchTerm.initialize(filter, index);
|
|
||||||
|
|
||||||
|
// need to add it to the document before we can do anything about it
|
||||||
|
searchTerm.id = "searchTerm" + index;
|
||||||
searchtermContainer.appendChild(searchTerm);
|
searchtermContainer.appendChild(searchTerm);
|
||||||
|
// now re-find the inserted element
|
||||||
|
searchTerm = document.getElementById(searchTerm.id);
|
||||||
|
|
||||||
|
|
||||||
|
searchTerm.searchattribute = searchAttr;
|
||||||
|
searchTerm.searchoperator = searchOp;
|
||||||
|
searchTerm.searchvalue = searchVal;
|
||||||
|
|
||||||
|
// probably a noop?
|
||||||
|
// searchTerm.initialize(filter, index);
|
||||||
|
|
||||||
|
|
||||||
// now return the row
|
// now return the row
|
||||||
return searchrow;
|
return searchrow;
|
||||||
@ -137,11 +141,41 @@ function createFilterRow(filter, index)
|
|||||||
// the children of each treecell
|
// the children of each treecell
|
||||||
function constructRow(treeCellChildren)
|
function constructRow(treeCellChildren)
|
||||||
{
|
{
|
||||||
|
var treeitem = document.createElement("treeitem");
|
||||||
var row = document.createElement("treerow");
|
var row = document.createElement("treerow");
|
||||||
for (var i = 0; i<treeCellChildren.length; i++) {
|
for (var i = 0; i<treeCellChildren.length; i++) {
|
||||||
var treecell = document.createElement("treecell");
|
var treecell = document.createElement("treecell");
|
||||||
|
treecell.setAttribute("allowevents", "true");
|
||||||
|
treeCellChildren[i].setAttribute("flex", "1");
|
||||||
treecell.appendChild(treeCellChildren[i]);
|
treecell.appendChild(treeCellChildren[i]);
|
||||||
row.appendChild(treecell);
|
row.appendChild(treecell);
|
||||||
}
|
}
|
||||||
return row;
|
treeitem.appendChild(row);
|
||||||
|
return treeitem;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getFilterObject(filter, index)
|
||||||
|
{
|
||||||
|
var attrib = new Object;
|
||||||
|
var operator = new Object;
|
||||||
|
var value = new Object;
|
||||||
|
var booleanAnd = new Object;
|
||||||
|
var header = new Object;
|
||||||
|
|
||||||
|
filter.GetTerm(index, attrib, operator, value, booleanAnd, header);
|
||||||
|
|
||||||
|
var result = { attribute: attrib.value,
|
||||||
|
operator: operator.value,
|
||||||
|
value: value.value,
|
||||||
|
booleanAnd: booleanAnd.value,
|
||||||
|
header: header.value };
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
function initializeFilterRow(filter, index)
|
||||||
|
{
|
||||||
|
var filterTermObject = document.getElementById("searchTerm" + index);
|
||||||
|
|
||||||
|
filterTermObject.initialize(filter, index);
|
||||||
}
|
}
|
||||||
|
@ -52,16 +52,19 @@ Rights Reserved.
|
|||||||
<box orient="horizontal">
|
<box orient="horizontal">
|
||||||
</box>
|
</box>
|
||||||
<box style="min-height:200px">
|
<box style="min-height:200px">
|
||||||
|
<searchterms id="searchterms">
|
||||||
<searchterm id="searchTerm"
|
<searchterm id="searchTerm"
|
||||||
searchattribute="searchAttr"
|
searchattribute="searchAttr"
|
||||||
searchoperator="searchOp"
|
searchoperator="searchOp"
|
||||||
searchvalue="searchValue"/>
|
searchvalue="searchValue"/>
|
||||||
|
</searchterms>
|
||||||
<tree class="inset" flex="1">
|
<tree class="inset" flex="1">
|
||||||
<treecol id="a" />
|
<treecol id="a" />
|
||||||
<treecol id="b"/>
|
<treecol id="b"/>
|
||||||
<treecol id="c"/>
|
<treecol id="c"/>
|
||||||
|
|
||||||
<treechildren>
|
<treechildren id="filterTermList">
|
||||||
|
<!--
|
||||||
<treeitem id="filterListItem">
|
<treeitem id="filterListItem">
|
||||||
<treerow>
|
<treerow>
|
||||||
<treecell allowevents="true">
|
<treecell allowevents="true">
|
||||||
@ -82,6 +85,7 @@ Rights Reserved.
|
|||||||
<treecell value="text here"/>
|
<treecell value="text here"/>
|
||||||
</treerow>
|
</treerow>
|
||||||
</treeitem>
|
</treeitem>
|
||||||
|
-->
|
||||||
</treechildren>
|
</treechildren>
|
||||||
|
|
||||||
</tree>
|
</tree>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user