diff --git a/chrome/chromeFiles/content/scholar/folderTreeView.js b/chrome/chromeFiles/content/scholar/collectionTreeView.js similarity index 70% rename from chrome/chromeFiles/content/scholar/folderTreeView.js rename to chrome/chromeFiles/content/scholar/collectionTreeView.js index e6e73f5f06..c0a464a5a8 100644 --- a/chrome/chromeFiles/content/scholar/folderTreeView.js +++ b/chrome/chromeFiles/content/scholar/collectionTreeView.js @@ -1,4 +1,4 @@ -Scholar.FolderTreeView = function() +Scholar.CollectionTreeView = function() { this._treebox = null; this._dataItems = new Array(); @@ -10,7 +10,7 @@ Scholar.FolderTreeView = function() /* * Unregisters itself from Scholar.Notifier (called on window close) */ -Scholar.FolderTreeView.prototype.unregister = function() +Scholar.CollectionTreeView.prototype.unregister = function() { Scholar.Notifier.unregisterColumnTree(this._unregisterID); } @@ -18,7 +18,7 @@ Scholar.FolderTreeView.prototype.unregister = function() /* * Is called by Scholar.Notifier on any changes to the data layer */ -Scholar.FolderTreeView.prototype.notify = function(action, type, ids) +Scholar.CollectionTreeView.prototype.notify = function(action, type, ids) { ids = Scholar.flattenArguments(ids); var madeChanges = false; @@ -75,7 +75,7 @@ Scholar.FolderTreeView.prototype.notify = function(action, type, ids) this._refreshHashMap(); } -Scholar.FolderTreeView.prototype.setTree = function(treebox) +Scholar.CollectionTreeView.prototype.setTree = function(treebox) { if(this._treebox) return; @@ -88,7 +88,7 @@ Scholar.FolderTreeView.prototype.setTree = function(treebox) this._refreshHashMap(); } -Scholar.FolderTreeView.prototype.getCellText = function(row, column) +Scholar.CollectionTreeView.prototype.getCellText = function(row, column) { var obj = this._getItemAtRow(row); @@ -98,17 +98,17 @@ Scholar.FolderTreeView.prototype.getCellText = function(row, column) return ""; } -Scholar.FolderTreeView.prototype.isContainer = function(row) +Scholar.CollectionTreeView.prototype.isContainer = function(row) { return this._getItemAtRow(row).isCollection(); } -Scholar.FolderTreeView.prototype.isContainerOpen = function(row) +Scholar.CollectionTreeView.prototype.isContainerOpen = function(row) { return this._dataItems[row][1]; } -Scholar.FolderTreeView.prototype.isContainerEmpty = function(row) +Scholar.CollectionTreeView.prototype.isContainerEmpty = function(row) { var itemGroup = this._getItemAtRow(row); if(itemGroup.isCollection()) @@ -117,9 +117,9 @@ Scholar.FolderTreeView.prototype.isContainerEmpty = function(row) return true; } -Scholar.FolderTreeView.prototype.getLevel = function(row) { return this._dataItems[row][2]; } +Scholar.CollectionTreeView.prototype.getLevel = function(row) { return this._dataItems[row][2]; } -Scholar.FolderTreeView.prototype.getParentIndex = function(row) +Scholar.CollectionTreeView.prototype.getParentIndex = function(row) { var thisLevel = this.getLevel(row); if(thisLevel == 0) return -1; @@ -129,7 +129,7 @@ Scholar.FolderTreeView.prototype.getParentIndex = function(row) return -1; } -Scholar.FolderTreeView.prototype.hasNextSibling = function(row, afterIndex) +Scholar.CollectionTreeView.prototype.hasNextSibling = function(row, afterIndex) { var thisLevel = this.getLevel(row); for(var i = afterIndex + 1; i < this.rowCount; i++) @@ -140,7 +140,7 @@ Scholar.FolderTreeView.prototype.hasNextSibling = function(row, afterIndex) } } -Scholar.FolderTreeView.prototype.toggleOpenState = function(row) +Scholar.CollectionTreeView.prototype.toggleOpenState = function(row) { var count = 0; //used to tell the tree how many rows were added/removed var thisLevel = this.getLevel(row); @@ -172,24 +172,24 @@ Scholar.FolderTreeView.prototype.toggleOpenState = function(row) this._refreshHashMap(); } -Scholar.FolderTreeView.prototype._showItem = function(item, level, beforeRow) { this._dataItems.splice(beforeRow, 0, [item, false, level]); this.rowCount++; } +Scholar.CollectionTreeView.prototype._showItem = function(item, level, beforeRow) { this._dataItems.splice(beforeRow, 0, [item, false, level]); this.rowCount++; } -Scholar.FolderTreeView.prototype._hideItem = function(row) { this._dataItems.splice(row,1); this.rowCount--; } +Scholar.CollectionTreeView.prototype._hideItem = function(row) { this._dataItems.splice(row,1); this.rowCount--; } -Scholar.FolderTreeView.prototype._getItemAtRow = function(row) { return this._dataItems[row][0]; } -Scholar.FolderTreeView.prototype.isSorted = function() { return false; } -Scholar.FolderTreeView.prototype.isSeparator = function(row) { return false; } -Scholar.FolderTreeView.prototype.isEditable = function(row, idx) { return false; } -Scholar.FolderTreeView.prototype.getRowProperties = function(row, prop) { } -Scholar.FolderTreeView.prototype.getColumnProperties = function(col, prop) { } -Scholar.FolderTreeView.prototype.getCellProperties = function(row, col, prop) { } -Scholar.FolderTreeView.prototype.getImageSrc = function(row, col) { } -Scholar.FolderTreeView.prototype.performAction = function(action) { } -Scholar.FolderTreeView.prototype.performActionOnCell = function(action, row, col) { } -Scholar.FolderTreeView.prototype.getProgressMode = function(row, col) { } -Scholar.FolderTreeView.prototype.cycleHeader = function(column) { } +Scholar.CollectionTreeView.prototype._getItemAtRow = function(row) { return this._dataItems[row][0]; } +Scholar.CollectionTreeView.prototype.isSorted = function() { return false; } +Scholar.CollectionTreeView.prototype.isSeparator = function(row) { return false; } +Scholar.CollectionTreeView.prototype.isEditable = function(row, idx) { return false; } +Scholar.CollectionTreeView.prototype.getRowProperties = function(row, prop) { } +Scholar.CollectionTreeView.prototype.getColumnProperties = function(col, prop) { } +Scholar.CollectionTreeView.prototype.getCellProperties = function(row, col, prop) { } +Scholar.CollectionTreeView.prototype.getImageSrc = function(row, col) { } +Scholar.CollectionTreeView.prototype.performAction = function(action) { } +Scholar.CollectionTreeView.prototype.performActionOnCell = function(action, row, col) { } +Scholar.CollectionTreeView.prototype.getProgressMode = function(row, col) { } +Scholar.CollectionTreeView.prototype.cycleHeader = function(column) { } -Scholar.FolderTreeView.prototype.deleteSelection = function() +Scholar.CollectionTreeView.prototype.deleteSelection = function() { if(this.selection.count == 0) return; @@ -227,7 +227,7 @@ Scholar.FolderTreeView.prototype.deleteSelection = function() this.selection.select(this.rowCount-1); } -Scholar.FolderTreeView.prototype._refreshHashMap = function() +Scholar.CollectionTreeView.prototype._refreshHashMap = function() { // Create hash map of collection and object ids to row indexes @@ -241,7 +241,7 @@ Scholar.FolderTreeView.prototype._refreshHashMap = function() //Scholar.debug(Scholar.varDump(this.objectRowMap)); } -Scholar.FolderTreeView.prototype.canDrop = function(row, orient) +Scholar.CollectionTreeView.prototype.canDrop = function(row, orient) { if(orient == this.DROP_ON && this._getItemAtRow(row).isCollection()) return true; @@ -250,7 +250,7 @@ Scholar.FolderTreeView.prototype.canDrop = function(row, orient) } -Scholar.FolderTreeView.prototype.drop = function(row, orient) +Scholar.CollectionTreeView.prototype.drop = function(row, orient) { //you can't really do anything here, look to overlay.js - ScholarCollectionsDragObserver } diff --git a/chrome/chromeFiles/content/scholar/itemTreeView.js b/chrome/chromeFiles/content/scholar/itemTreeView.js index db935309af..4de13e3b07 100644 --- a/chrome/chromeFiles/content/scholar/itemTreeView.js +++ b/chrome/chromeFiles/content/scholar/itemTreeView.js @@ -178,15 +178,11 @@ Scholar.ItemTreeView.prototype.searchText = function(search) Scholar.ItemTreeView.prototype._refreshHashMap = function() { - // Create hash map of folder and object ids to row indexes + // Create hash map of item ids to row indexes this._itemRowMap = new Array(); for(var i=0; i < this.rowCount; i++) this._itemRowMap[this._getItemAtRow(i).getID()] = i; - - //Scholar.debug(Scholar.varDump(this.folderRowMap)); - //Scholar.debug(Scholar.varDump(this.objectRowMap)); - } Scholar.ItemTreeView.prototype.getCollectionID = function() diff --git a/chrome/chromeFiles/content/scholar/overlay.js b/chrome/chromeFiles/content/scholar/overlay.js index 022a567782..fae733a66c 100644 --- a/chrome/chromeFiles/content/scholar/overlay.js +++ b/chrome/chromeFiles/content/scholar/overlay.js @@ -3,7 +3,7 @@ */ var ScholarPane = new function() { - var foldersView; + var collectionsView; var itemsView; var promptService = Components.classes["@mozilla.org/embedcomp/prompt-service;1"].getService(Components.interfaces.nsIPromptService); @@ -13,7 +13,7 @@ var ScholarPane = new function() this.toggleDisplay = toggleDisplay; this.newItem = newItem; this.newCollection = newCollection; - this.folderSelected = folderSelected; + this.onCollectionSelected = onCollectionSelected; this.itemSelected = itemSelected; this.deleteItemSelection = deleteItemSelection; this.deleteCollectionSelection = deleteCollectionSelection; @@ -26,12 +26,12 @@ var ScholarPane = new function() */ function onLoad() { - //Initialize folders view - foldersView = new Scholar.FolderTreeView(); - document.getElementById('folders-tree').view = foldersView; + //Initialize collections view + collectionsView = new Scholar.CollectionTreeView(); + document.getElementById('collections-tree').view = collectionsView; //select Library - foldersView.selection.select(0); + collectionsView.selection.select(0); //Create the add menu with each item type var addMenu = document.getElementById('tb-add').firstChild; @@ -52,7 +52,7 @@ var ScholarPane = new function() */ function onUnload() { - foldersView.unregister(); + collectionsView.unregister(); if(itemsView) itemsView.unregister(); } @@ -84,14 +84,14 @@ var ScholarPane = new function() Scholar.Collections.add(Scholar.getString('pane.collections.untitled')); } - function folderSelected() + function onCollectionSelected() { if(itemsView) itemsView.unregister(); - if(foldersView.selection.count == 1 && foldersView.selection.currentIndex != -1) + if(collectionsView.selection.count == 1 && collectionsView.selection.currentIndex != -1) { - var collection = foldersView._getItemAtRow(foldersView.selection.currentIndex); + var collection = collectionsView._getItemAtRow(collectionsView.selection.currentIndex); itemsView = new Scholar.ItemTreeView(collection); document.getElementById('items-tree').view = itemsView; @@ -137,15 +137,15 @@ var ScholarPane = new function() function deleteCollectionSelection() { - if(foldersView.selection.count > 0 && confirm(Scholar.getString('pane.collections.delete'))) - foldersView.deleteSelection(); + if(collectionsView.selection.count > 0 && confirm(Scholar.getString('pane.collections.delete'))) + collectionsView.deleteSelection(); } function renameSelectedCollection() { - if(foldersView.selection.count > 0) + if(collectionsView.selection.count > 0) { - collection = foldersView._getItemAtRow(foldersView.selection.currentIndex); + collection = collectionsView._getItemAtRow(collectionsView.selection.currentIndex); var newName = prompt(Scholar.getString('pane.collections.rename'),collection.getName()); if(newName) diff --git a/chrome/chromeFiles/content/scholar/overlay.xul b/chrome/chromeFiles/content/scholar/overlay.xul index 04a125e823..dda594f516 100644 --- a/chrome/chromeFiles/content/scholar/overlay.xul +++ b/chrome/chromeFiles/content/scholar/overlay.xul @@ -11,7 +11,7 @@