www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | Submodules | README | LICENSE

commit 098e90fea9a12ee4f8816ad07a0f4bf46da96621
parent 0753d7891020c73b17f11678a1fc6ef29f08d45a
Author: David Norton <david@nortoncrew.com>
Date:   Tue,  6 Jun 2006 22:43:58 +0000

Search field now searches only selection Library/Project.
 - Sort stays
 - Selection remembered

New functions: saveSelection(), rememberSelection() on ItemTreeView

Diffstat:
Mchrome/chromeFiles/content/scholar/collectionTreeView.js | 2+-
Mchrome/chromeFiles/content/scholar/itemTreeView.js | 56++++++++++++++++++++++++++++++++++++++------------------
Mchrome/chromeFiles/content/scholar/overlay.js | 3+++
3 files changed, 42 insertions(+), 19 deletions(-)

diff --git a/chrome/chromeFiles/content/scholar/collectionTreeView.js b/chrome/chromeFiles/content/scholar/collectionTreeView.js @@ -288,7 +288,7 @@ Scholar.ItemGroup.prototype.getChildItems = function() { if(this.searchText) { - return Scholar.Items.get(Scholar.Items.search(this.searchText)); + return Scholar.Items.get(Scholar.Items.search(this.searchText,(this.isCollection() ? this.ref.getID() : null))); } else { diff --git a/chrome/chromeFiles/content/scholar/itemTreeView.js b/chrome/chromeFiles/content/scholar/itemTreeView.js @@ -1,6 +1,7 @@ Scholar.ItemTreeView = function(itemGroup) { this._treebox = null; + this._savedSelection = null; this._dataItems = new Array(); this.rowCount = 0; this._itemGroup = itemGroup; @@ -88,22 +89,16 @@ Scholar.ItemTreeView.prototype.cycleHeader = function(column) } } + this.selection.selectEventsSuppressed = true; + this.saveSelection(); this.sort(); + this.rememberSelection(); + this.selection.selectEventsSuppressed = false; + this._treebox.invalidate(); } Scholar.ItemTreeView.prototype.sort = function() { - this.selection.selectEventsSuppressed = true; - - var selectedIDs = new Array(); - var start = new Object(); - var end = new Object(); - for (var i=0, len=this.selection.getRangeCount(); i<len; i++) - { - this.selection.getRangeAt(i,start,end); - for (var j=start.value; j<=end.value; j++) - selectedIDs.push(this._getItemAtRow(j).getID()); - } var column = this._treebox.columns.getSortedColumn() var order = column.element.getAttribute('sortDirection') == 'descending'; @@ -125,13 +120,6 @@ Scholar.ItemTreeView.prototype.sort = function() this._dataItems.sort(columnSort); this._refreshHashMap(); - this.selection.clearSelection(); - for(var i=0; i < selectedIDs.length; i++) - { - this.selection.toggleSelect(this._itemRowMap[selectedIDs[i]]); - } - this.selection.selectEventsSuppressed = false; - this._treebox.invalidate(); } Scholar.ItemTreeView.prototype.deleteSelection = function() @@ -169,10 +157,18 @@ Scholar.ItemTreeView.prototype.deleteSelection = function() Scholar.ItemTreeView.prototype.searchText = function(search) { + this.selection.selectEventsSuppressed = true; + this.saveSelection(); + this._itemGroup.setSearch(search); var oldCount = this.rowCount; this.refresh(); this._treebox.rowCountChanged(0,this.rowCount-oldCount); + + this.sort(); + + this.rememberSelection(); + this.selection.selectEventsSuppressed = false; this._treebox.invalidate(); } @@ -265,6 +261,30 @@ Scholar.ItemTreeView.prototype.notify = function(action, type, ids) } } +Scholar.ItemTreeView.prototype.saveSelection = function() +{ + this._savedSelection = new Array(); + + var start = new Object(); + var end = new Object(); + for (var i=0, len=this.selection.getRangeCount(); i<len; i++) + { + this.selection.getRangeAt(i,start,end); + for (var j=start.value; j<=end.value; j++) + this._savedSelection.push(this._getItemAtRow(j).getID()); + } +} + +Scholar.ItemTreeView.prototype.rememberSelection = function() +{ + this.selection.clearSelection(); + for(var i=0; i < this._savedSelection.length; i++) + { + if(this._itemRowMap[this._savedSelection[i]] != null) + this.selection.toggleSelect(this._itemRowMap[this._savedSelection[i]]); + } +} + Scholar.ItemTreeView.prototype.canDrop = function(index, orient) { return false; diff --git a/chrome/chromeFiles/content/scholar/overlay.js b/chrome/chromeFiles/content/scholar/overlay.js @@ -83,10 +83,13 @@ var ScholarPane = new function() { if(itemsView) itemsView.unregister(); + + document.getElementById('tb-search').value = ""; if(collectionsView.selection.count == 1 && collectionsView.selection.currentIndex != -1) { var collection = collectionsView._getItemAtRow(collectionsView.selection.currentIndex); + collection.setSearch(''); itemsView = new Scholar.ItemTreeView(collection); document.getElementById('items-tree').view = itemsView;