commit 2513c829a68300739fa08aed38c6aaac13c3ae9e
parent c807d335e97efa7aae85660d202a2ae8971eb736
Author: David Norton <david@nortoncrew.com>
Date: Tue, 6 Jun 2006 20:33:49 +0000
Simple, yet inefficient, searching from upper right-hand corner.
Diffstat:
2 files changed, 24 insertions(+), 8 deletions(-)
diff --git a/chrome/chromeFiles/content/scholar/collectionTreeView.js b/chrome/chromeFiles/content/scholar/collectionTreeView.js
@@ -286,10 +286,22 @@ Scholar.ItemGroup.prototype.getName = function()
Scholar.ItemGroup.prototype.getChildItems = function()
{
- if(this.isCollection())
- return Scholar.getItems(this.ref.getID());
- else if(this.isLibrary())
- return Scholar.getItems();
+ if(this.searchText)
+ {
+ return Scholar.Items.get(Scholar.Items.search(this.searchText));
+ }
else
- return null;
+ {
+ if(this.isCollection())
+ return Scholar.getItems(this.ref.getID());
+ else if(this.isLibrary())
+ return Scholar.getItems();
+ else
+ return null;
+ }
+}
+
+Scholar.ItemGroup.prototype.setSearch = function(searchText)
+{
+ this.searchText = searchText;
}
\ No newline at end of file
diff --git a/chrome/chromeFiles/content/scholar/itemTreeView.js b/chrome/chromeFiles/content/scholar/itemTreeView.js
@@ -16,7 +16,8 @@ Scholar.ItemTreeView.prototype.refresh = function()
var newRows = this._itemGroup.getChildItems();
for(var i = 0; i < newRows.length; i++)
- this._showItem(newRows[i], i+1); //item ref, before row
+ if(newRows[i])
+ this._showItem(newRows[i], i+1); //item ref, before row
this._refreshHashMap();
}
@@ -168,8 +169,11 @@ Scholar.ItemTreeView.prototype.deleteSelection = function()
Scholar.ItemTreeView.prototype.searchText = function(search)
{
- //does nothing, right now.
-// this._refreshHashMap();
+ this._itemGroup.setSearch(search);
+ var oldCount = this.rowCount;
+ this.refresh();
+ this._treebox.rowCountChanged(0,this.rowCount-oldCount);
+ this._treebox.invalidate();
}
Scholar.ItemTreeView.prototype._refreshHashMap = function()