Class for managing the interaction between an auto-complete object and a text-input or textarea.
extends goog.Disposable| Instance Method Summary | |
addKeyEvents_()Adds the necessary key 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() ⇒ ?ElementReturns the current active element. | |
getAutoComplete() ⇒ ?goog.ui.AutoCompleteReturns the associated autocomplete instance. | |
getCursorPosition() ⇒ numberReturns the current cursor position. | |
getThrottleTime() ⇒ numberGets 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) ⇒ numberGets the index of the currently highlighted token | |
getUpdateDuringTyping() ⇒ booleanGets whether the result list is updated during typing. | |
getValue() ⇒ stringReturns 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) ⇒ booleanHandles a key event. | |
handleKeyUp(?goog.events.Event e) ⇒ booleanHandles the key up event. Registered only if needKeyUpListener returns true. | |
handleSeparator_(?goog.events.BrowserEvent e) ⇒ booleanHandles a key event for a separator key. | |
moveDown_() ⇒ booleanMoves hilite down. May hilite next or previous depending on orientation. | |
moveUp_() ⇒ booleanMoves 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. | |
onTick_(?goog.events.Event e)Handles the timer's tick event. Calculates the current token, and reports any update to the autocomplete. | |
parseToken() ⇒ stringParses a text area or input box for the currently highlighted token. | |
parseToken_() ⇒ stringParses 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. | |
removeKeyEvents_()Removes the necessary key event handlers. | |
selectRow(?Object row, boolean= opt_multi) ⇒ booleanSelects 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) ⇒ ?ArraySplits 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) ⇒ stringTrims 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. | |