The goog.ui.ac.InputHandler Class

goog.ui.ac.InputHandler
> goog.Disposable

goog.ui.ac.InputHandler(opt_separators, opt_literals, opt_multi, opt_throttleTime)

Class for managing the interaction between an auto-complete object and a text-input or textarea.

opt_separators {?string=}
Separators to split multiple entries.
opt_literals {?string=}
Characters used to delimit text literals.
opt_multi {?boolean=}
Whether to allow multiple entries (Default: true).
opt_throttleTime {?number=}
Number of milliseconds to throttle keyevents with (Default: 150). Use -1 to disable updates on typing. Note that typing the separator will update autocomplete suggestions.

.QUOTE_LITERALS {string}

Literals for quotes.

@const

.STANDARD_LIST_SEPARATORS {string}

Standard list separators.

@const

.ac_ {goog.ui.ac.AutoComplete}

The AutoComplete instance this inputhandler is associated with.

.addOnDisposeCallback(callback, opt_scope)

Inherited from goog.Disposable .

Invokes a callback function when this object is disposed. Callbacks are invoked in the order in which they were added.

callback {!Function}
The callback function.
opt_scope {Object=}
An optional scope to call the callback in.

.attachAutoComplete(ac)

Attach an instance of an AutoComplete

ac {goog.ui.ac.AutoComplete}
Autocomplete object.

.attachInput(target)

Attaches the input handler to a target element. The target element should be a textarea, input box, or other focusable element with the same interface.

target {Element|goog.events.EventTarget}
An element to attach the input handler too.

.attachInputs(var_args)

Attaches the input handler to multiple elements.

var_args {...Element}
Elements to attach the input handler too.

.creationStack {string}

Inherited from goog.Disposable .

If monitoring the goog.Disposable instances is enabled, stores the creation stack trace of the Disposable instance.

.detachInput(target)

Detaches the input handler from the provided element.

target {Element|goog.events.EventTarget}
An element to detach the input handler from.

.detachInputs(var_args)

Detaches the input handler from multuple elements.

var_args {...Element}
Variable arguments for elements to unbind from.

.dispose()

Inherited from goog.Disposable .

Disposes of the object. If the object hasn't already been disposed of, calls {@link #disposeInternal}. Classes that extend {@code goog.Disposable} should override {@link #disposeInternal} in order to delete references to COM objects, DOM nodes, and other disposable objects. Reentrant.

returns {void}
Nothing.

.getActiveElement()

Returns the current active element.

returns {Element}
The currently active element.

.getAutoComplete()

Returns the associated autocomplete instance.

returns {goog.ui.ac.AutoComplete}
The associated autocomplete instance.

.getCursorPosition()

Returns the current cursor position.

returns {number}
The index of the cursor position.

.getThrottleTime()

Gets the time to wait before updating the results. If the update during typing flag is switched on, this delay counts from the last update, otherwise from the last keypress.

returns {number}
Throttle time in milliseconds.

.getUpdateDuringTyping()

Gets whether the result list is updated during typing.

returns {boolean}
Value of the flag.

.getValue()

Returns the value of the current active element.

returns {string}
The value of the current active element.

.isDisposed()

Inherited from goog.Disposable .

returns {boolean}
Whether the object has been disposed of.

.registerDisposable(disposable)

Inherited from goog.Disposable .

Associates a disposable object with this object so that they will be disposed together.

disposable {goog.disposable.IDisposable}
that will be disposed when this object is disposed.

.selectRow(row, opt_multi)

Selects the given row. Implements the SelectionHandler interface.

row {Object}
The row to select.
opt_multi {boolean=}
Should this be treated as a single or multi-token auto-complete? Overrides previous setting of opt_multi on constructor.
returns {boolean}
Whether to suppress the update event.

.setCursorPosition(pos)

Sets the cursor at the given position.

pos {number}
The index of the cursor position.

.setGenerateNewTokenOnLiteral(newValue)

Sets whether new tokens should be generated from literals. That is, should hello'world be two tokens, assuming ' is a literal?

newValue {boolean}
boolean value indicating whether or not new tokens should be generated from literals.

.setPreventDefaultOnTab(newValue)

Sets whether we will prevent the default input behavior (moving focus to the next focusable element) on TAB.

newValue {boolean}
Whether to preventDefault on TAB.

.setRowJustSelected(justSelected)

Sets whether a row has just been selected.

justSelected {boolean}
Whether or not the row has just been selected.

.setSeparatorCompletes(newValue)

Sets whether separators perform autocomplete.

newValue {boolean}
Whether to autocomplete on separators.

.setSeparatorSelects(newValue)

Sets whether separators perform autocomplete.

newValue {boolean}
Whether to autocomplete on separators.

.setSeparators(separators)

Sets the entry separator characters.

separators {string}
The separator characters to set.

.setThrottleTime(time)

Sets the time to wait before updating the results.

time {number}
New throttle time in milliseconds.

.setTrimmingRegExp(trimmer)

Sets the regular expression used to trim the tokens before passing them to the matcher: every substring that matches the given regular expression will be removed. This can also be set to null to disable trimming.

trimmer {RegExp}
Regexp to use for trimming or null to disable it.

.setUpdateDuringTyping(value)

Sets whether the result list should be updated during typing.

value {boolean}
New value of the flag.

.setUpsideDown(upsideDown)

Sets whether to flip the orientation of up & down for hiliting next and previous autocomplete entries.

upsideDown {boolean}
Whether the orientation is upside down.

.setValue(value)

Sets the value of the current active element.

value {string}
The new value.

.setWhitespaceWrapEntries(newValue)

Sets whether auto-completed tokens should be wrapped with whitespace.

newValue {boolean}
boolean value indicating whether or not auto-completed tokens should be wrapped with whitespace.

.update(opt_force)

Checks if an update has occurred and notified the autocomplete of the new token.

opt_force {boolean=}
If true the menu will be forced to update.