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

Unified Diff: chrome/browser/resources/shared/js/cr/ui/table/table_single_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_single_selection_model.js
diff --git a/chrome/browser/resources/shared/js/cr/ui/table/table_single_selection_model.js b/chrome/browser/resources/shared/js/cr/ui/table/table_single_selection_model.js
deleted file mode 100644
index c1da65f5c9113bed8272217f7b4e345c356bd389..0000000000000000000000000000000000000000
--- a/chrome/browser/resources/shared/js/cr/ui/table/table_single_selection_model.js
+++ /dev/null
@@ -1,59 +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 single selection model for table
- */
-cr.define('cr.ui.table', function() {
- const ListSingleSelectionModel = cr.ui.ListSingleSelectionModel;
-
- /**
- * Creates a new selection model that is to be used with tables.
- * This implementation supports single selection.
- * Selected item is stored, not index, so selection is 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 TableSingleSelectionModel(opt_length) {
- ListSingleSelectionModel.apply(this, arguments);
- }
-
- TableSingleSelectionModel.prototype = {
- __proto__: ListSingleSelectionModel.prototype,
-
-
- /**
- * Adjusts the selection after reordering of items in the table.
- * @param {!Array.<number>} permutation The reordering permutation.
- */
- adjustToReordering: function(permutation) {
- if (this.leadIndex != -1)
- this.leadIndex = permutation[this.leadIndex];
-
- var oldSelectedIndex = this.selectedIndex;
- if (oldSelectedIndex != -1) {
- this.selectedIndex = permutation[oldSelectedIndex];
- }
- },
-
- /**
- * 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.
- * @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) {
- ListSingleSelectionModel.prototype.adjust.call(
- this, this.length, itemsRemoved, itemsAdded);
- }
- };
-
- return {
- TableSingleSelectionModel: TableSingleSelectionModel
- };
-});
« no previous file with comments | « chrome/browser/resources/shared/js/cr/ui/table/table_selection_model.js ('k') | chrome/browser/resources/shared_resources.grd » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698