Home

# Class goog.ui.AutoComplete.InputHandler

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

extends goog.Disposable

Instance Method Summary
| `addEventHandlers_()` Adds the necessary input event handlers.
| `attachAutoComplete(?goog.ui.AutoComplete ac)` Attach an instance of an AutoComplete
| `attachInput((Element|goog.events.EventTarget|null) 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.
| `attachInputs((Element|null|undefined) var_args)` Attaches the input handler to multiple elements.
| `detachInput((Element|goog.events.EventTarget|null) target)` Detaches the input handler from the provided element.
| `detachInputs((Element|null|undefined) var_args)` Detaches the input handler from multuple elements.

`disposeInternal()`

Deletes or nulls out any references to COM objects, DOM nodes, or other disposable objects. Classes that extend {@code goog.Disposable} should override this method. Not reentrant. To avoid calling it twice, it must only be called from the subclass' {@code disposeInternal} method. Everywhere else the public {@code dispose} method must be used. For example:

    mypackage.MyClass = function() {
    goog.base(this);
    // Constructor logic specific to MyClass.
    ...
    };
    goog.inherits(mypackage.MyClass, goog.Disposable);

    mypackage.MyClass.prototype.disposeInternal = function() {
    goog.base(this, 'disposeInternal');
    // Dispose logic specific to MyClass.
    ...
    };

| `getActiveElement() ⇒ ?Element` Returns the current active element.
| `getAutoComplete() ⇒ ?goog.ui.AutoComplete` Returns the associated autocomplete instance.
| `getCursorPosition() ⇒ number` Returns the current cursor position.
| `getThrottleTime() ⇒ number` 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.
| `getTokenIndex_(string text, number caret) ⇒ number` Gets the index of the currently highlighted token
| `getUpdateDuringTyping() ⇒ boolean` Gets whether the result list is updated during typing.
| `getValue() ⇒ string` Returns the value of the current active element.
| `handleBlur(?goog.events.Event= opt_e)` Handles an element blurring.
| `handleFocus(?goog.events.Event e)` Handles an element getting focus.
| `handleKeyEvent(?goog.events.BrowserEvent e) ⇒ boolean` Handles a key event.
| `handleKeyUp(?goog.events.Event e) ⇒ boolean` Handles the key up event. Registered only if needKeyUpListener returns true.
| `handleMouseDown(?goog.events.BrowserEvent e)` For subclasses to override to handle the mouse-down event.
| `handleSeparator_(?goog.events.BrowserEvent e) ⇒ boolean` Handles a key event for a separator key.
| `moveDown_() ⇒ boolean` Moves hilite down. May hilite next or previous depending on orientation.
| `moveUp_() ⇒ boolean` Moves hilite up. May hilite next or previous depending on orientation.
| `needKeyUpListener() ⇒ boolean`
| `onIeKeyPress_(?goog.events.BrowserEvent e)` Handles the key-press event for IE, checking to see if the user typed a separator character.
| `onKeyDownOnInactiveElement_(?goog.events.BrowserEvent e)` Handles typing in an inactive input element. Activate it.
| `onKeyPress_(?goog.events.BrowserEvent e)` Handles a KEYPRESS event generated by typing in the active input element. Checks if IME input is ended.
| `onKeyUp_(?goog.events.BrowserEvent e)` Handles the key-up event. This is only ever used by Mac FF or when we are in an IME entry scenario.
| `onKey_(?goog.events.BrowserEvent e)` Handles typing in the active input element. Checks if the key is a special key and does the relevent action as appropriate.
| `onMouseDown_(?goog.events.BrowserEvent e)` Handles mouse-down event.
| `onTick_(?goog.events.Event e)` Handles the timer's tick event. Calculates the current token, and reports any update to the autocomplete.
| `parseToken() ⇒ string` Parses a text area or input box for the currently highlighted token.
| `parseToken_() ⇒ string` Parses a text area or input box for the currently highlighted token.
| `processBlur_()` Helper function that does the logic to handle an element blurring.
| `processFocus(?Element target)` Registers handlers for the active element when it receives focus.
| `removeEventHandlers_()` Removes the necessary input event handlers.
| `selectRow(?Object row, boolean= opt_multi) ⇒ boolean` Selects the given row. Implements the SelectionHandler interface.
| `setCursorPosition(number pos)` Sets the cursor at the given position.
| `setGenerateNewTokenOnLiteral(boolean newValue)` Sets whether new tokens should be generated from literals. That is, should hello'world be two tokens, assuming ' is a literal?
| `setPreventDefaultOnTab(boolean newValue)` Sets whether we will prevent the default input behavior (moving focus to the next focusable element) on TAB.
| `setRowJustSelected(boolean justSelected)` Sets whether a row has just been selected.
| `setSeparatorCompletes(boolean newValue)` Sets whether separators perform autocomplete.
| `setSeparatorSelects(boolean newValue)` Sets whether separators perform autocomplete.
| `setSeparators(string separators)` Sets the entry separator characters.
| `setThrottleTime(number time)` Sets the time to wait before updating the results.
| `setTokenText(string tokenText, boolean= opt_multi)` Sets the text of the current token without updating the autocomplete choices.
| `setTrimmingRegExp(?RegExp 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.
| `setUpdateDuringTyping(boolean value)` Sets whether the result list should be updated during typing.
| `setUpsideDown(boolean upsideDown)` Sets whether to flip the orientation of up & down for hiliting next and previous autocomplete entries.
| `setValue(string value)` Sets the value of the current active element.
| `setWhitespaceWrapEntries(boolean newValue)` Sets whether auto-completed tokens should be wrapped with whitespace.
| `splitInput_(string text) ⇒ ?Array` Splits an input string of text at the occurance of a character in {@link goog.ui.AutoComplete.InputHandler.prototype.separators_} and creates an array of tokens. Each token may contain additional whitespace and formatting marks. If necessary use {@link goog.ui.AutoComplete.InputHandler.prototype.trim_} to clean up the entries.
| `startWaitingForIme_()` Starts waiting for IME.
| `stopWaitingForIme_()` Stops waiting for IME.
| `trim_(string text) ⇒ string` Trims a token of characters that we want to ignore
| `update(boolean= opt_force)` Checks if an update has occurred and notified the autocomplete of the new token.