Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1986)

Unified Diff: chrome/browser/resources/shared/js/cr/ui/table/table_selection_model.js

Issue 7038024: Move sorting logic from table to list. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed autofill phones. Created 9 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/resources/shared/js/cr/ui/table/table_selection_model.js
diff --git a/chrome/browser/resources/shared/js/cr/ui/table/table_selection_model.js b/chrome/browser/resources/shared/js/cr/ui/table/table_selection_model.js
deleted file mode 100644
index d4a197a164b4e9a726ce0d41856eb34d6ad565f1..0000000000000000000000000000000000000000
--- a/chrome/browser/resources/shared/js/cr/ui/table/table_selection_model.js
+++ /dev/null
@@ -1,65 +0,0 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-/**
- * @fileoverview This is a multiple selection model for table
- */
-cr.define('cr.ui.table', function() {
- const ListSelectionModel = cr.ui.ListSelectionModel;
-
- /**
- * Creates a new selection model that is to be used with tables.
- * This implementation supports multiple selection.
- * Selected items are stored, not indexes, so selections are preserved
- * after items reordering (e.g. because of sort).
- * @param {number=} opt_length The number of items in the selection.
- * @constructor
- * @extends {!cr.EventTarget}
- */
- function TableSelectionModel(opt_length) {
- ListSelectionModel.apply(this, arguments);
- }
-
- TableSelectionModel.prototype = {
- __proto__: ListSelectionModel.prototype,
-
-
- /**
- * Adjusts the selection after reordering of items in the table.
- * @param {!Array.<number>} permutation The reordering permutation.
- */
- adjustToReordering: function(permutation) {
- var oldLeadIndex = this.leadIndex;
-
- var oldSelectedIndexes = this.selectedIndexes;
- this.selectedIndexes = oldSelectedIndexes.map(function(oldIndex) {
- return permutation[oldIndex];
- }).filter(function(index) {
- return index != -1;
- });
-
- if (oldLeadIndex != -1)
- this.leadIndex = permutation[oldLeadIndex];
- },
-
- /**
- * Adjust the selection by adding or removing a certain numbers of items.
- * This should be called by the owner of the selection model as items are
- * added and removed from the underlying data model.
- * This implementation updates selection model length only. The actual
- * selected indexes changes are processed in adjustToReordering.
- * @param {number} index The index of the first change.
- * @param {number} itemsRemoved Number of items removed.
- * @param {number} itemsAdded Number of items added.
- */
- adjust: function(index, itemsRemoved, itemsAdded) {
- ListSelectionModel.prototype.adjust.call(
- this, this.length, itemsRemoved, itemsAdded);
- }
- };
-
- return {
- TableSelectionModel: TableSelectionModel
- };
-});

Powered by Google App Engine
This is Rietveld 408576698