From 2513c829a68300739fa08aed38c6aaac13c3ae9e Mon Sep 17 00:00:00 2001 From: David Norton Date: Tue, 6 Jun 2006 20:33:49 +0000 Subject: [PATCH] Simple, yet inefficient, searching from upper right-hand corner. --- .../content/scholar/collectionTreeView.js | 22 ++++++++++++++----- .../content/scholar/itemTreeView.js | 10 ++++++--- 2 files changed, 24 insertions(+), 8 deletions(-) diff --git a/chrome/chromeFiles/content/scholar/collectionTreeView.js b/chrome/chromeFiles/content/scholar/collectionTreeView.js index c0a464a5a..c125b5085 100644 --- 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 index e49cd19ae..301be7ab9 100644 --- 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()