# -*- Mode: HTML; indent-tabs-mode: nil; -*- # The contents of this file are subject to the Netscape Public # License Version 1.1 (the "License"); you may not use this file # except in compliance with the License. You may obtain a copy of # the License at http://www.mozilla.org/NPL/ # # Software distributed under the License is distributed on an "AS # IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or # implied. See the License for the specific language governing # rights and limitations under the License. # # The Original Code is mozilla.org code. # # The Initial Developer of the Original Code is Netscape # Communications Corporation. Portions created by Netscape are # Copyright (C) 1998 Netscape Communications Corporation. All # Rights Reserved. # # Contributor(s): # Ben Goodger (Original Author) # Blake Ross # Pierre Chanial (v 2.0) %bookmarksDTD; ]> false this.tree.focus(); null null 0) for (var k = 0; k < rangeCount; ++k) { var rangeMin = {}; var rangeMax = {}; this.treeBoxObject.view.selection.getRangeAt(k, rangeMin, rangeMax); for (var i = rangeMin.value; i <= rangeMax.value; ++i) { var selectedItem = this.getRowResource(i); var selectedParent = this.getParentResource(i); var isExpanded = this.treeBoxObject.view.isContainerOpen(i); selection.item .push(selectedItem); selection.parent.push(selectedParent); selection.isExpanded.push(isExpanded); } } selection.length = selection.item.length; BookmarksUtils.checkSelection(selection); return selection; ]]> # This function saves the current selection state before the tree is rebuilt # following a command execution. This allows us to remember which item(s) # was/were selected so that the user does not need to constantly refocus the # tree to perform a sequence of commands. [] # This function restores the selection appropriately after a command executes. # This is necessary because most commands trigger a rebuild of the tree which # destroys the selection. The restoration of selection is handled in three # different ways depending on the type of command that has been executed: # 1) Commands that remove rows: # The row immediately after the first range in the selection is selected, # if there is no row immediately after the first range the item before it # is selected # 2) Commands that insert rows: # The newly inserted rows are selected # 3) Commands that do not change the row count # The row(s) that was/were operated on remain selected. # # The calls to save/restore are placed in the doCommand method and thus all # commands must pass through this gate. The result is that this method becomes # the POLICY CENTER FOR POST-VIEW/EDIT SELECTION CHANGES. [] // keep track of the items that we will select // because we can not select rows during a batch. 0) this.mOuter.updateTreeSelection(); // use of a timer to speedup var This = this.mOuter; setTimeout( function (){This.treeBoxObject.view.selection.selectEventsSuppressed = false}, 100) //dump("DND time:"+(Date.now()-date)+"\n") }, onToggleOpenState: function (aRow) { // update the open attribute of the selection var resource = this.mOuter.getRowResource(aRow); var selection = this.mOuter._selection; for (var i=0; i // Adding the transaction listener BMSVC.transactionManager.AddListener(this.bookmarkTreeTransactionListener); BMSVC.transactionManager.RemoveListener(this.bookmarkTreeTransactionListener); 2 1 2