goog.ui.ac.InputHandler
Classgoog.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
=}
opt_literals
{?string
=}
opt_multi
{?boolean
=}
opt_throttleTime
{?number
=}
.QUOTE_LITERALS
{string
}Literals for quotes.
.STANDARD_LIST_SEPARATORS
{string
}Standard list separators.
.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
}
opt_scope
{Object
=}
.attachAutoComplete(ac)
Attach an instance of an AutoComplete
ac
{goog.ui.ac.AutoComplete
}
.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
}
.attachInputs(var_args)
Attaches the input handler to multiple elements.
var_args
{...Element
}
.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
}
.detachInputs(var_args)
Detaches the input handler from multuple elements.
var_args
{...Element
}
.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.
void
}
.disposeInternal()
[protected]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()
Returns the current active element.
Element
}
.getAutoComplete()
Returns the associated autocomplete instance.
goog.ui.ac.AutoComplete
}
.getCursorPosition()
Returns the current cursor position.
number
}
.getDisposed
[deprecated]Deprecated. Use {@link #isDisposed} instead.
Inherited from goog.Disposable
.
boolean
}
.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.
number
}
.getUpdateDuringTyping()
Gets whether the result list is updated during typing.
boolean
}
.getValue()
Returns the value of the current active element.
string
}
.handleBlur(opt_e)
[protected]Handles an element blurring.
opt_e
{goog.events.Event
=}
.handleFocus(e)
[protected]Handles an element getting focus.
e
{goog.events.Event
}
.handleKeyEvent(e)
[protected]Handles a key event.
e
{goog.events.BrowserEvent
}
boolean
}
.handleKeyUp(e)
[protected]Handles the key up event. Registered only if needKeyUpListener returns true.
e
{goog.events.Event
}
boolean
}
.handleMouseDown(e)
[protected]For subclasses to override to handle the mouse-down event.
e
{goog.events.BrowserEvent
}
.isDisposed()
Inherited from goog.Disposable
.
boolean
}
.needKeyUpListener()
[protected]boolean
}
.parseToken()
[protected]Parses a text area or input box for the currently highlighted token.
string
}
.processFocus(target)
[protected]Registers handlers for the active element when it receives focus.
target
{Element
}
.registerDisposable(disposable)
Inherited from goog.Disposable
.
Associates a disposable object with this object so that they will be disposed together.
disposable
{goog.disposable.IDisposable
}
.selectRow(row, opt_multi)
Selects the given row. Implements the SelectionHandler interface.
row
{Object
}
opt_multi
{boolean
=}
boolean
}
.setCursorPosition(pos)
Sets the cursor at the given position.
pos
{number
}
.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
}
.setPreventDefaultOnTab(newValue)
Sets whether we will prevent the default input behavior (moving focus to the next focusable element) on TAB.
newValue
{boolean
}
.setRowJustSelected(justSelected)
Sets whether a row has just been selected.
justSelected
{boolean
}
.setSeparatorCompletes(newValue)
Sets whether separators perform autocomplete.
newValue
{boolean
}
.setSeparatorSelects(newValue)
Sets whether separators perform autocomplete.
newValue
{boolean
}
.setSeparators(separators)
Sets the entry separator characters.
separators
{string
}
.setThrottleTime(time)
Sets the time to wait before updating the results.
time
{number
}
.setTokenText(tokenText, opt_multi)
[protected]Sets the text of the current token without updating the autocomplete choices.
tokenText
{string
}
opt_multi
{boolean
=}
.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
}
.setUpdateDuringTyping(value)
Sets whether the result list should be updated during typing.
value
{boolean
}
.setUpsideDown(upsideDown)
Sets whether to flip the orientation of up & down for hiliting next and previous autocomplete entries.
upsideDown
{boolean
}
.setValue(value)
Sets the value of the current active element.
value
{string
}
.setWhitespaceWrapEntries(newValue)
Sets whether auto-completed tokens should be wrapped with whitespace.
newValue
{boolean
}
.update(opt_force)
Checks if an update has occurred and notified the autocomplete of the new token.
opt_force
{boolean
=}