goog.ui.ac.InputHandler
Provided By | |
---|---|
Extends | |
All Implemented Interfaces | |
All Known Direct Subclasses |
Class for managing the interaction between an auto-complete object and a text-input or textarea.
new InputHandler( opt_separators, opt_literals, opt_multi, opt_throttleTime )
Parameters |
|
---|
Instance Methods
this.addOnDisposeCallback<T>( callback, opt_scope ) → void
void
Invokes a callback function when this object is disposed. Callbacks are invoked in the order in which they were added. If a callback is added to an already disposed Disposable, it will be called immediately.
Defined by | |||||||||
---|---|---|---|---|---|---|---|---|---|
Parameters |
|
this.attachAutoComplete( ac ) → void
void
Attach an instance of an AutoComplete
Parameters |
|
---|
this.attachInput( target ) → void
void
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.
Parameters |
|
---|
this.attachInputs( ...var_args ) → void
void
Attaches the input handler to multiple elements.
Parameters |
|
---|
this.detachInput( target ) → void
void
Detaches the input handler from the provided element.
Parameters |
|
---|
this.detachInputs( ...var_args ) → void
void
Detaches the input handler from multuple elements.
Parameters |
|
---|
this.dispose() → ?
?
Disposes of the object and its resources.
Overrides | ||
---|---|---|
Specified by | ||
Parameters | None. | |
Returns |
|
this.disposeInternal() → void
void
Performs appropriate cleanup. See description of goog.disposable.IDisposable
for examples. Classes that extend goog.Disposable
should override this
method. Not reentrant. To avoid calling it twice, it must only be called from
the subclass' disposeInternal
method. Everywhere else the public dispose
method must be used. For example:
mypackage.MyClass = function() { mypackage.MyClass.base(this, 'constructor'); // Constructor logic specific to MyClass. ... }; goog.inherits(mypackage.MyClass, goog.Disposable); mypackage.MyClass.prototype.disposeInternal = function() { // Dispose logic specific to MyClass. ... // Call superclass's disposeInternal at the end of the subclass's, like // in C++, to avoid hard-to-catch issues. mypackage.MyClass.base(this, 'disposeInternal'); };
Overrides | |
---|---|
Parameters | None. |
this.getActiveElement() → (Element|null)
(Element|null)
Returns the current active element.
Parameters | None. | ||
---|---|---|---|
Returns |
|
this.getAutoComplete() → (goog.ui.ac.AutoComplete|null)
(goog.ui.ac.AutoComplete|null)
Returns the associated autocomplete instance.
Parameters | None. | ||
---|---|---|---|
Returns |
|
this.getCursorPosition() → number
number
Returns the current cursor position.
Parameters | None. | ||
---|---|---|---|
Returns |
|
this.getDisposed() → boolean
boolean
warning Deprecated | Use |
---|
Defined by | |||
---|---|---|---|
Parameters | None. | ||
Returns |
|
this.getThrottleTime() → number
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.
Parameters | None. | ||
---|---|---|---|
Returns |
|
this.getUpdateDuringTyping() → boolean
boolean
Gets whether the result list is updated during typing.
Parameters | None. | ||
---|---|---|---|
Returns |
|
this.getValue() → string
string
Returns the value of the current active element.
Parameters | None. | ||
---|---|---|---|
Returns |
|
this.handleBlur( opt_e ) → void
void
Handles an element blurring.
Parameters |
|
---|
this.handleFocus( e ) → void
void
Handles an element getting focus.
Parameters |
|
---|
this.handleKeyEvent( e ) → boolean
boolean
Handles a key event.
Parameters |
| ||||
---|---|---|---|---|---|
Returns |
|
this.handleKeyUp( e ) → boolean
boolean
Handles the key up event. Registered only if needKeyUpListener returns true.
Parameters |
| ||||
---|---|---|---|---|---|
Returns |
|
this.handleMouseDown( e ) → void
void
For subclasses to override to handle the mouse-down event.
Parameters |
|
---|
this.isDisposed() → boolean
boolean
Overrides | |||
---|---|---|---|
Specified by | |||
Parameters | None. | ||
Returns |
|
this.needKeyUpListener() → boolean
boolean
Parameters | None. | ||
---|---|---|---|
Returns |
|
this.parseToken() → string
string
Parses a text area or input box for the currently highlighted token.
Parameters | None. | ||
---|---|---|---|
Returns |
|
this.processBlur() → void
void
Helper function that does the logic to handle an element blurring.
this.processFocus( target ) → void
void
Registers handlers for the active element when it receives focus.
Parameters |
|
---|
this.registerDisposable( disposable ) → void
void
Associates a disposable object with this object so that they will be disposed together.
Defined by | |||||
---|---|---|---|---|---|
Parameters |
|
this.selectRow( row, opt_multi ) → boolean
boolean
this.setCursorPosition( pos ) → void
void
Sets the cursor at the given position.
Parameters |
|
---|
this.setEndsWithSeparatorRegExp( separatorCheck ) → void
void
Sets the regular expression used to check whether the replacement (used to update the text area after a row is selected) ends with a separator. This can be set to null if the input handler should never automatically append a separator to the replacement string.
Parameters |
|
---|
this.setGenerateNewTokenOnLiteral( newValue ) → void
void
Sets whether new tokens should be generated from literals. That is, should hello'world be two tokens, assuming ' is a literal?
Parameters |
|
---|
this.setPreventDefaultOnTab( newValue ) → void
void
Sets whether we will prevent the default input behavior (moving focus to the next focusable element) on TAB.
Parameters |
|
---|
this.setPreventSelectionOnTab( newValue ) → void
void
Sets whether we will prevent highlighted item selection on TAB.
Parameters |
|
---|
this.setRowJustSelected( justSelected ) → void
void
Sets whether a row has just been selected.
Parameters |
|
---|
this.setSeparatorCompletes( newValue ) → void
void
Sets whether separators perform autocomplete.
Parameters |
|
---|
this.setSeparatorSelects( newValue ) → void
void
Sets whether separators perform autocomplete.
Parameters |
|
---|
this.setSeparators( separators, opt_defaultSeparators ) → void
void
this.setThrottleTime( time ) → void
void
Sets the time to wait before updating the results.
Parameters |
|
---|
this.setTokenText( tokenText, opt_multi ) → void
void
this.setTrimmingRegExp( trimmer ) → void
void
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.
Parameters |
|
---|
this.setUpdateDuringTyping( value ) → void
void
Sets whether the result list should be updated during typing.
Parameters |
|
---|
this.setUpsideDown( upsideDown ) → void
void
Sets whether to flip the orientation of up & down for hiliting next and previous autocomplete entries.
Parameters |
|
---|
this.setValue( value ) → void
void
this.setWhitespaceWrapEntries( newValue ) → void
void
Sets whether auto-completed tokens should be wrapped with whitespace.
Parameters |
|
---|
this.update( opt_force ) → void
void
Checks if an update has occurred and notified the autocomplete of the new token.
Parameters |
|
---|
Instance Properties
this.ac_ → (goog.ui.ac.AutoComplete|null)
(goog.ui.ac.AutoComplete|null)
The AutoComplete instance this inputhandler is associated with.
this.creationStack → (string|undefined)
(string|undefined)
If monitoring the goog.Disposable instances is enabled, stores the creation stack trace of the Disposable instance.
Static Properties
InputHandler.QUOTE_LITERALS → string
string
Literals for quotes.
InputHandler.STANDARD_LIST_SEPARATORS → string
string
Standard list separators.