richinputhandler.js 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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. * @fileoverview Class for managing the interactions between a rich autocomplete
  16. * object and a text-input or textarea.
  17. *
  18. */
  19. goog.provide('goog.ui.ac.RichInputHandler');
  20. goog.require('goog.ui.ac.InputHandler');
  21. /**
  22. * Class for managing the interaction between an autocomplete object and a
  23. * text-input or textarea.
  24. * @param {?string=} opt_separators Seperators to split multiple entries.
  25. * @param {?string=} opt_literals Characters used to delimit text literals.
  26. * @param {?boolean=} opt_multi Whether to allow multiple entries
  27. * (Default: true).
  28. * @param {?number=} opt_throttleTime Number of milliseconds to throttle
  29. * keyevents with (Default: 150).
  30. * @constructor
  31. * @extends {goog.ui.ac.InputHandler}
  32. */
  33. goog.ui.ac.RichInputHandler = function(
  34. opt_separators, opt_literals, opt_multi, opt_throttleTime) {
  35. goog.ui.ac.InputHandler.call(
  36. this, opt_separators, opt_literals, opt_multi, opt_throttleTime);
  37. };
  38. goog.inherits(goog.ui.ac.RichInputHandler, goog.ui.ac.InputHandler);
  39. /**
  40. * Selects the given rich row. The row's select(target) method is called.
  41. * @param {Object} row The row to select.
  42. * @return {boolean} Whether to suppress the update event.
  43. * @override
  44. */
  45. goog.ui.ac.RichInputHandler.prototype.selectRow = function(row) {
  46. var suppressUpdate =
  47. goog.ui.ac.RichInputHandler.superClass_.selectRow.call(this, row);
  48. row.select(this.ac_.getTarget());
  49. return suppressUpdate;
  50. };