| 1 |
// Copyright 2007 The Closure Library Authors. All Rights Reserved. |
| 2 |
// |
| 3 |
// Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 |
// you may not use this file except in compliance with the License. |
| 5 |
// You may obtain a copy of the License at |
| 6 |
// |
| 7 |
// http://www.apache.org/licenses/LICENSE-2.0 |
| 8 |
// |
| 9 |
// Unless required by applicable law or agreed to in writing, software |
| 10 |
// distributed under the License is distributed on an "AS-IS" BASIS, |
| 11 |
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 |
// See the License for the specific language governing permissions and |
| 13 |
// limitations under the License. |
| 14 |
|
| 15 |
/** |
| 16 |
* @fileoverview Class for managing the interactions between a rich autocomplete |
| 17 |
* object and a text-input or textarea. |
| 18 |
* |
| 19 |
*/ |
| 20 |
|
| 21 |
goog.provide('goog.ui.ac.RichInputHandler'); |
| 22 |
|
| 23 |
goog.require('goog.ui.ac.InputHandler'); |
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
/** |
| 28 |
* Class for managing the interaction between an autocomplete object and a |
| 29 |
* text-input or textarea. |
| 30 |
* @param {?string=} opt_separators Seperators to split multiple entries. |
| 31 |
* @param {?string=} opt_literals Characters used to delimit text literals. |
| 32 |
* @param {?boolean=} opt_multi Whether to allow multiple entries |
| 33 |
* (Default: true). |
| 34 |
* @param {?number=} opt_throttleTime Number of milliseconds to throttle |
| 35 |
* keyevents with (Default: 150). |
| 36 |
* @constructor |
| 37 |
* @extends {goog.ui.ac.InputHandler} |
| 38 |
*/ |
| 39 |
goog.ui.ac.RichInputHandler = function( |
| 40 |
opt_separators, opt_literals, opt_multi, opt_throttleTime) { |
| 41 |
goog.ui.ac.InputHandler.call( |
| 42 |
this, opt_separators, opt_literals, opt_multi, opt_throttleTime); |
| 43 |
}; |
| 44 |
goog.inherits(goog.ui.ac.RichInputHandler, goog.ui.ac.InputHandler); |
| 45 |
|
| 46 |
|
| 47 |
/** |
| 48 |
* Selects the given rich row. The row's select(target) method is called. |
| 49 |
* @param {Object} row The row to select. |
| 50 |
* @return {boolean} Whether to suppress the update event. |
| 51 |
* @override |
| 52 |
*/ |
| 53 |
goog.ui.ac.RichInputHandler.prototype.selectRow = function(row) { |
| 54 |
var suppressUpdate = |
| 55 |
goog.ui.ac.RichInputHandler.superClass_.selectRow.call(this, row); |
| 56 |
row.select(this.ac_.getTarget()); |
| 57 |
return suppressUpdate; |
| 58 |
}; |