Class SweetDevRia.Suggest
Extends
RiaComponent, RiaComponent.
Defined in: Suggest.js.
Constructor Attributes | Constructor Name and Description |
---|---|
SweetDevRia.Suggest(id, preselectedValue, itemPerPage, triggerLength, filterMode, bufferSize, multiSelect, multiField, caseSensitive, stackSelection, forceSelection, paginable, max)
This is the Suggest component class
|
Field Attributes | Field Name and Description |
---|---|
<static> |
SweetDevRia.Suggest.CONTAINS
This constant indicates that the search for a pattern will be process from anywhere in the values.
|
<static> |
SweetDevRia.Suggest.CUSTOM
This constant indicates that the filtering of values will be process from a custom matcher.
|
<static> |
SweetDevRia.Suggest.DEFAULT_POPUP_MAX_HEIGHT
This value estimate the size in pixel consumed by the borders of the popup (vertical dimension).
|
<static> |
SweetDevRia.Suggest.ENDSWITH
This constant indicates that the search for a pattern will be process from the values end.
|
<static> |
SweetDevRia.Suggest.PAGEBAR_NUMBER
This constant indicates the number of page to display in the pageBar.
|
<static> |
SweetDevRia.Suggest.POPUP_BORDERS_SIZE
This value estimate the size in pixel consumed by the borders of the popup (vertical dimension).
|
<static> |
SweetDevRia.Suggest.REGEXP
This constant indicates that the filtering of values will be process from regexp expressions.
|
<static> |
SweetDevRia.Suggest.SELECTION_MODE
This constant indicates the view mode Selection, displaying the selected items
|
<static> |
SweetDevRia.Suggest.SEPARATOR
This constant indicates the way to concatenate the values selected in multiSelect mode + singleField mode.
|
<static> |
SweetDevRia.Suggest.SIMPLE_REGEXP
This constant indicates that the filtering of values will be process from simple regexp expressions, managing only * and ?.
|
<static> |
SweetDevRia.Suggest.STARTSWITH
This constant indicates that the search for a pattern will be process from the values begin.
|
<static> |
SweetDevRia.Suggest.SUGGEST_MODE
This constant indicates the view mode Suggestion, displaying the suggested items
|
*************************** TEMPLATE ****************************
|
Method Attributes | Method Name and Description |
---|---|
<private> |
addIdToSelection(item)
Add a SuggestItem to the selection, in the Suggest reference
|
<private> |
addInputToSelection(item)
Add an item to the selection, in HTML code
|
<private> |
addItemToSelection(item)
Add a SuggestItem to the selection, both in the Suggest reference and in the HTML code
Is not in charge of the multi selection compatibility
|
This method is called after cleaning the HTML render of the items
To be overridden !!
|
|
This method is called after drawing the popup footer
To be overridden !!
|
|
This method is called after drawing the popup header
To be overridden !!
|
|
This method is called after drawing the selected values
To be overridden !!
|
|
This method is called after hiding the suggest popup
To be overridden !!
|
|
afterHighlightItem(item)
This method is called after cleaning the HTML render of the items
To be overridden !!
|
|
This method is called after analyzing a key stroked on the input field
To be overridden !!
|
|
afterOnItemKeyStroke(evt, item)
This method is called after analyzing a key stroked on an item
To be overridden !!
|
|
This method is called after processing the response with the values from server
To be overridden !!
|
|
This method is called after treating an item selection switch
To be overridden !!
|
|
This method is called after processing the user action switching the view mode
To be overridden !!
|
|
afterProcessInputValue(newInputValue, pageNumber)
This method is called after processing the input value
|
|
This method is called after rendering the button
To be overridden !!
|
|
This method is called after restoring the input value
To be overridden !!
|
|
afterRetrieveValues(value, pageNumber)
This method is called after sending the request to get values from server
To be overridden !!
|
|
This method is called after showing the suggest popup
To be overridden !!
|
|
This method is called after switching the popup visibility
To be overridden !!
|
|
afterSwitchViewMode(viewMode)
This method is called after switching the view mode
To be overridden !!
|
|
afterUnhighlightItem(item)
This method is called after cleaning the HTML render of the items
To be overridden !!
|
|
afterUpdateClass(item)
This method is called after updating the HTML render of an item class
To be overridden !!
|
|
This method is called after updating the input render
To be overridden !!
|
|
afterUpdateSelection(newInputValue)
This method is called after updating the selection
To be overridden !!
|
|
This method is called after updating the selection on blur
To be overridden !!
|
|
afterValueSelected(item)
This method is called after the value has changed in the input
To be overridden !!
|
|
This method is called before cleaning the HTML render of the items
To be overridden !!
|
|
This method is called before drawing the popup footer
To be overridden !!
|
|
This method is called before drawing the popup header
To be overridden !!
|
|
This method is called before drawing the selected values
To be overridden !!
|
|
This method is called before hiding the suggest popup
To be overridden !!
|
|
beforeHighlightItem(item)
This method is called before highlightning an item
To be overridden !!
|
|
This method is called before analyzing a key stroked on the input field
To be overridden !!
|
|
beforeOnItemKeyStroke(evt, item)
This method is called before analyzing a key stroked on an item
To be overridden !!
|
|
This method is called before processing the response with the values from server
To be overridden !!
|
|
This method is called before treating an item selection switch
To be overridden !!
|
|
This method is called before processing the user action switching the view mode
To be overridden !!
|
|
beforeProcessInputValue(newInputValue, pageNumber)
This method is called before processing the input value
To be overridden !!
|
|
This method is called before rendering the button
To be overridden !!
|
|
This method is called before restoring the input value
To be overridden !!
|
|
beforeRetrieveValues(value, pageNumber)
This method is called before sending the request to get values from server
To be overridden !!
|
|
This method is called before showing the suggest popup
To be overridden !!
|
|
This method is called before switching the popup visibility
To be overridden !!
|
|
beforeSwitchViewMode(viewMode)
This method is called before switching the view mode
To be overridden !!
|
|
beforeUnhighlightItem(item)
This method is called before unhighlightning an item
To be overridden !!
|
|
beforeUpdateClass(item)
This method is called before updating the HTML render of an item class
To be overridden !!
|
|
This method is called before updating the input render
To be overridden !!
|
|
beforeUpdateSelection(newInputValue)
This method is called before updating the selection
To be overridden !!
|
|
This method is called before updating the selection on blur
To be overridden !!
|
|
<private> |
callSwitchItemSelectionAction(evt, suggest)
|
This method clear all items presents in the suggestion list.
|
|
closePopup(originalTarget)
Method called by the popup manager.
|
|
<private> |
createHTMLItem(item, index)
This method create a new suggested item in the suggestion list, for the item and at the specified index.
|
<private> |
createItemInputField(item)
Create a result input for the item given in parameter, or fill the one existing, in singleSelection mode
|
<private> |
Create the pageBar for the suggest
|
<private> <static> |
SweetDevRia.Suggest.createSuggestData(inputValue, items, truncated, pageNumber)
Creates a SuggestData from parameters values
|
This method is called when data are found
To be overridden !!
|
|
This method is called when data are not found
To be overriden !!
|
|
<private> |
deleteItemInputField(item)
Delete a result input for the item given in parameter, or clean the one existing, in singleSelection mode
|
This method draws the header in the suggest popup, according to the getFooterHtmlCode result.
|
|
This method draws the header in the suggest popup.
|
|
This method set the selected items into the suggestion list.
|
|
extractHTMLIndex(id)
Extract the HTML index of an element from its id.
|
|
This method is called to get statistic data
|
|
Return the component's buffer
|
|
Return the button div element
|
|
Return the first result input, contained in the input container.
|
|
Return the suggest popup footer element
|
|
Return the html code for the suggest popup footer.
|
|
Return the suggest popup header element
|
|
Return the html code for the suggest popup header.
|
|
This method return the link to display to permit the switch of the view mode, suggestions <-> selections
Combine it with getViewMode to know what is currently displayed.
|
|
Return the current highlightened item, or null if none are highlightened.
|
|
getHTMLId(index)
Return the HTML id formated from an index.
|
|
getInput()
Return the input element
|
|
Return the resulting inputs container
|
|
Return the input element's value
|
|
getItemHtmlCode(item)
This method is used to render a SuggestItem in the HTML suggestion/selection list in the suggestion popup.
|
|
Return the number of result inputs (implicitly the number of selected items).
|
|
Return the list ul element containing the suggest items
|
|
Return the selected items, in multiSelect
|
|
Return the text to insert in the input when multiple values are selected.
|
|
<private> |
Return the pageBar container id for this suggest
|
<private> |
Return the pageBar container id for this suggest
|
<private> |
getRefineableData(value)
Get some data refined from other ones in buffer.
|
Return the selected item corresponding to that id
|
|
Return the number of items selected at present.
|
|
<private> |
Return the parameters to send to the server to update this component's server model
|
Return the selected item, in singleSelect
|
|
Return the text to insert in the input when a single value is selected.
|
|
Return the div containing header, items and footer : the suggest popup
|
|
getValue()
get the input element's value
|
|
Return the component's view manager
|
|
Return the current view mode
|
|
<private> |
goToPage(pageNumber)
Load a page.
|
<private> |
Hide the pageBar
|
This method hides the suggest popup
|
|
highlightItem(item)
This method highlights an item in the list.
|
|
Return true if an Ajax request is in progress, false otherwise
|
|
<private> |
isFirstMatchSecond(part, word)
return true if the first value match the second one, according to the current filterMode
|
isItemSelected(item)
Return the selected state of an item
|
|
<private> |
isTimout()
Return True if the timer between 2 AJAX call don't exist or is elapsed
This method is called before sending a new input value to the server
|
This method test the visibility of the suggested item list
|
|
itemsInSuggest(inputValue, items)
This method is called when all possibilities are loaded in suggest
|
|
onChange()
This Method is called when a suggest loses focus
To be overridden
|
|
onInputKeyStroke(evt)
Event Handler put on the input field
Decide which action should be executed, depending of the key stroked.
|
|
onItemKeyStroke(evt, item)
Event Handler put on each suggested item.
|
|
onKeyUp(evt)
This method is called when a key is released
To be overridden !!
|
|
onRetrieveValues(evt)
Callback method of the retrieving action
Is in charge of the data processing launch.
|
|
onSelect()
This method is called when selecting a node.
|
|
onSwitchItemSelectionAction(item, keepOpen)
This method is triggered on the item selection action
|
|
onSwitchViewModeAction(event)
This method is triggered on the view mode switch action ( suggestions <-> selections )
|
|
This method is called when unselecting a node.
|
|
preprocess(items)
Creates a new Value from the input values
To be overriden !!!
|
|
<private> |
processData(suggestData, autoShowItems)
Process some new data in the suggest, and optionnally show the suggest popup
|
processInputValue(newInputValue, pageNumber)
Process the input value, for an optional page.
|
|
<private> |
refineBufferedData(bufferedData, value)
Refine the items contained in the bufferedData, according to the value given in parameter
Clean up all the old items which no longer fits the actual value.
|
<private> |
removeButtonClassName(className)
Remove a class for the button.
|
<private> |
removeIdFromSelection(item)
Remove a SuggestItem from the selection, in the Suggest reference
|
<private> |
removeInputFromSelection(item)
Remove an item from the selection, in HTML code
|
<private> |
removeItemFromSelection(item)
Remove a SuggestItem from the selection, both in the Suggest reference and in the HTML code
|
Update the button rendering, according to the current class
|
|
<private> |
This method resize the suggest popup (height dimension)
|
<private> |
This method resize the suggest popup (width dimension)
|
Restore the input search value, on refocusing
This mean that in multiSelect mode, the input field switch to the previous searched value
|
|
retrieveValues(value, pageNumber)
Retrieve the values from the server, for the input value and page number given in parameter
Process the Ajax Call.
|
|
<private> |
setButtonClassName(className)
Set a class for the button.
|
setEnable(enable, init)
Allow to change the suggest state
|
|
<private> |
setHTMLItems(items)
This method set a list of items into the suggestion list.
|
setInputEnable(enable)
Allow to change the input state
|
|
setInputValue(value)
Set the input element's value
|
|
setItemEnable(itemId, enable)
Allow to disable or enable an suggest item with an item id
|
|
setItemEnableByIndex(itemIndex, enable)
Allow to disable or enable an suggest item with an item index
|
|
setItemSelected(item)
Set a SuggestItem selected, both in the Suggest reference and in the HTML code
Does nothing if the item is already selected
|
|
setItemUnselected(item)
Set a SuggestItem unselected, both in the Suggest reference and in the HTML code
Does nothing if the item is already unselected
|
|
setItemVisible(itemId, visible)
Allow to change an item visibility
|
|
setItemVisibleByIndex(itemIndex, visible)
Allow to change an item visibility
|
|
<private> |
This method position the suggest popup
|
setValue(item)
Set the input element's value
|
|
setVisible(visible, init)
Allow to change the suggets visibility
|
|
<private> |
showPageBar(actualPage, totalPageNumber)
Show the pageBar
|
This method shows the suggest popup
|
|
<private> |
startTimer(timerInterval)
This method start a new timer
|
<private> |
This method Process the input value if their is no AJAX call or set a new
shorter timer if the previous value is not again returned by the server
|
switchItemSelection(item, keepOpen, keepFocus)
Switch a SuggestItem state.
|
|
switchSuggestPopupVisibility(event, suggest)
This method switchs the popup visibility
|
|
switchViewMode(viewMode)
This method switchs the view mode into the popup ( suggestions <-> selections )
|
|
<private> |
testEquality(str1, str2)
Test the equality of two strings, according to the current caseSensitive property
|
<private> |
testRefinement(suggestData, value)
Test if a SuggestData could be refined for a specific value
Return null if none could be created.
|
unhighlightItem(item)
This method unhighlight an item in the list.
|
|
Unselect all the items selected
Does nothing if no items are selected
|
|
updateClass(item)
Updates the class of the HTML render of an item.
|
|
This method updates the input render depending of the current selection
|
|
<private> |
updateItemsSpecificities(items)
Updates the items specificities, regarding their inner data
|
updateSelection(newInputValue)
Updates the selection, according to the current input value and the previous selected items.
|
|
Updates the selection on input blur
This mean that in singleSelect mode, if the forceSelection is disabled, the selection switch to the user's value entered in the input.
|
Class Detail
SweetDevRia.Suggest(id, preselectedValue, itemPerPage, triggerLength, filterMode, bufferSize, multiSelect, multiField, caseSensitive, stackSelection, forceSelection, paginable, max)
This is the Suggest component class
- Parameters:
- {String} id
- Id of this table
- {String} preselectedValue
- The initial value of the input field
- {int} itemPerPage
- The number of item to display per suggestion page.
- {int} triggerLength
- The number of characters required before evaluating the field.
- {int} filterMode
- The mode of filter of the suggest.
- {int} bufferSize
- The size of the client buffer.
- {boolean} multiSelect
- The selection behavior of the suggest.
- {boolean} multiField
- The selections renders in HTML, in multiSelect mode enabled.
- {boolean} caseSensitive
- The case state of the suggest.
- {boolean} stackSelection
- The selection persistence state of the suggest
- {boolean} forceSelection
- The type of selection of the suggest, in singleSelection only.
- {boolean} paginable
- The paginable state of the suggest.
- {maxPopupHeight} max
- height size in pixel of the popup.
Field Detail
<static>
{int}
SweetDevRia.Suggest.CONTAINS
This constant indicates that the search for a pattern will be process from anywhere in the values.
<static>
{int}
SweetDevRia.Suggest.CUSTOM
This constant indicates that the filtering of values will be process from a custom matcher.
<static>
{int}
SweetDevRia.Suggest.DEFAULT_POPUP_MAX_HEIGHT
This value estimate the size in pixel consumed by the borders of the popup (vertical dimension).
<static>
{int}
SweetDevRia.Suggest.ENDSWITH
This constant indicates that the search for a pattern will be process from the values end.
<static>
{int}
SweetDevRia.Suggest.PAGEBAR_NUMBER
This constant indicates the number of page to display in the pageBar.
<static>
{int}
SweetDevRia.Suggest.POPUP_BORDERS_SIZE
This value estimate the size in pixel consumed by the borders of the popup (vertical dimension).
<static>
{int}
SweetDevRia.Suggest.REGEXP
This constant indicates that the filtering of values will be process from regexp expressions.
<static>
{int}
SweetDevRia.Suggest.SELECTION_MODE
This constant indicates the view mode Selection, displaying the selected items
<static>
{String}
SweetDevRia.Suggest.SEPARATOR
This constant indicates the way to concatenate the values selected in multiSelect mode + singleField mode.
<static>
{int}
SweetDevRia.Suggest.SIMPLE_REGEXP
This constant indicates that the filtering of values will be process from simple regexp expressions, managing only * and ?.
<static>
{int}
SweetDevRia.Suggest.STARTSWITH
This constant indicates that the search for a pattern will be process from the values begin.
<static>
{int}
SweetDevRia.Suggest.SUGGEST_MODE
This constant indicates the view mode Suggestion, displaying the suggested items
template
*************************** TEMPLATE ****************************
Method Detail
<private>
addIdToSelection(item)
Add a SuggestItem to the selection, in the Suggest reference
- Parameters:
- {SuggestItem} item
- the item to add
<private>
addInputToSelection(item)
Add an item to the selection, in HTML code
- Parameters:
- {SuggestItem} item
- the item to add in HTML
- See:
- addItemToSelection
<private>
addItemToSelection(item)
Add a SuggestItem to the selection, both in the Suggest reference and in the HTML code
Is not in charge of the multi selection compatibility
- Parameters:
- {SuggestItem} item
- the item to add
afterClearHTMLItems()
This method is called after cleaning the HTML render of the items
To be overridden !!
afterDrawFooter()
This method is called after drawing the popup footer
To be overridden !!
afterDrawHeader()
This method is called after drawing the popup header
To be overridden !!
afterDrawSelectedValues()
This method is called after drawing the selected values
To be overridden !!
afterHideSuggestPopup()
This method is called after hiding the suggest popup
To be overridden !!
afterHighlightItem(item)
This method is called after cleaning the HTML render of the items
To be overridden !!
- Parameters:
- {SuggestItem} item
- the item to highlight
afterOnInputKeyStroke(evt)
This method is called after analyzing a key stroked on the input field
To be overridden !!
- Parameters:
- {Event} evt
- HTML event
afterOnItemKeyStroke(evt, item)
This method is called after analyzing a key stroked on an item
To be overridden !!
- Parameters:
- {Event} evt
- HTML event
- {SuggestItem} item
- the item where the event was triggered
afterOnRetrieveValues(evt)
This method is called after processing the response with the values from server
To be overridden !!
- Parameters:
- {Map} evt
- the event which contains the data //TODO
afterOnSwitchItemSelectionAction(item)
This method is called after treating an item selection switch
To be overridden !!
- Parameters:
- {SuggestItem} item
- the item to switch
afterOnSwitchViewModeAction()
This method is called after processing the user action switching the view mode
To be overridden !!
afterProcessInputValue(newInputValue, pageNumber)
This method is called after processing the input value
- Parameters:
- {String} newInputValue
- The input value to process
- {int} pageNumber
- the number of the page to process. Default is set to 1. To be overridden !!
afterRenderButton()
This method is called after rendering the button
To be overridden !!
afterRestoreInputValue()
This method is called after restoring the input value
To be overridden !!
afterRetrieveValues(value, pageNumber)
This method is called after sending the request to get values from server
To be overridden !!
- Parameters:
- {String} value
- the value we are requesting
- {int} pageNumber
- the page number to get. 1 if no specified.
afterShowSuggestPopup()
This method is called after showing the suggest popup
To be overridden !!
afterSwitchSuggestPopupVisibility()
This method is called after switching the popup visibility
To be overridden !!
afterSwitchViewMode(viewMode)
This method is called after switching the view mode
To be overridden !!
- Parameters:
- {int} viewMode
- the mode to switch to
afterUnhighlightItem(item)
This method is called after cleaning the HTML render of the items
To be overridden !!
- Parameters:
- {SuggestItem} item
- the item to unhighlight
afterUpdateClass(item)
This method is called after updating the HTML render of an item class
To be overridden !!
- Parameters:
- {SuggestItem} item
- the item to update the class
afterUpdateInputRender()
This method is called after updating the input render
To be overridden !!
afterUpdateSelection(newInputValue)
This method is called after updating the selection
To be overridden !!
- Parameters:
- {String} newInputValue
- The new input value
afterUpdateSelectionOnBlur()
This method is called after updating the selection on blur
To be overridden !!
afterValueSelected(item)
This method is called after the value has changed in the input
To be overridden !!
- Parameters:
- {SuggestItem} item
- the item to update the class
{boolean}
beforeClearHTMLItems()
This method is called before cleaning the HTML render of the items
To be overridden !!
- Returns:
- True if this method can be called, else false.
{boolean}
beforeDrawFooter()
This method is called before drawing the popup footer
To be overridden !!
- Returns:
- True if this method can be called, else false.
{boolean}
beforeDrawHeader()
This method is called before drawing the popup header
To be overridden !!
- Returns:
- True if this method can be called, else false.
{boolean}
beforeDrawSelectedValues()
This method is called before drawing the selected values
To be overridden !!
- Returns:
- True if this method can be called, else false.
{boolean}
beforeHideSuggestPopup()
This method is called before hiding the suggest popup
To be overridden !!
- Returns:
- True if this method can be called, else false.
{boolean}
beforeHighlightItem(item)
This method is called before highlightning an item
To be overridden !!
- Parameters:
- {SuggestItem} item
- the item to highlight
- Returns:
- True if this method can be called, else false.
{boolean}
beforeOnInputKeyStroke(evt)
This method is called before analyzing a key stroked on the input field
To be overridden !!
- Parameters:
- {Event} evt
- HTML event
- Returns:
- True if this method can be called, else false.
{boolean}
beforeOnItemKeyStroke(evt, item)
This method is called before analyzing a key stroked on an item
To be overridden !!
- Parameters:
- {Event} evt
- HTML event
- {SuggestItem} item
- the item where the event was triggered
- Returns:
- True if this method can be called, else false.
{boolean}
beforeOnRetrieveValues(evt)
This method is called before processing the response with the values from server
To be overridden !!
- Parameters:
- {Map} evt
- the event which contains the data //TODO
- Returns:
- True if this method can be called, else false.
{boolean}
beforeOnSwitchItemSelectionAction(item)
This method is called before treating an item selection switch
To be overridden !!
- Parameters:
- {SuggestItem} item
- the item to switch
- Returns:
- True if this method can be called, else false.
{boolean}
beforeOnSwitchViewModeAction()
This method is called before processing the user action switching the view mode
To be overridden !!
- Returns:
- True if this method can be called, else false.
{boolean}
beforeProcessInputValue(newInputValue, pageNumber)
This method is called before processing the input value
To be overridden !!
- Parameters:
- {String} newInputValue
- The input value to process
- {int} pageNumber
- the number of the page to process. Default is set to 1.
- Returns:
- True if this method can be called, else false.
{boolean}
beforeRenderButton()
This method is called before rendering the button
To be overridden !!
- Returns:
- True if this method can be called, else false.
{boolean}
beforeRestoreInputValue()
This method is called before restoring the input value
To be overridden !!
- Returns:
- True if this method can be called, else false.
{boolean}
beforeRetrieveValues(value, pageNumber)
This method is called before sending the request to get values from server
To be overridden !!
- Parameters:
- {String} value
- the value we are requesting
- {int} pageNumber
- the page number to get. 1 if no specified.
- Returns:
- True if this method can be called, else false.
{boolean}
beforeShowSuggestPopup()
This method is called before showing the suggest popup
To be overridden !!
- Returns:
- True if this method can be called, else false.
{boolean}
beforeSwitchSuggestPopupVisibility()
This method is called before switching the popup visibility
To be overridden !!
- Returns:
- True if this method can be called, else false.
{boolean}
beforeSwitchViewMode(viewMode)
This method is called before switching the view mode
To be overridden !!
- Parameters:
- {int} viewMode
- the mode to switch to
- Returns:
- True if this method can be called, else false.
{boolean}
beforeUnhighlightItem(item)
This method is called before unhighlightning an item
To be overridden !!
- Parameters:
- {SuggestItem} item
- the item to unhighlight
- Returns:
- True if this method can be called, else false.
{boolean}
beforeUpdateClass(item)
This method is called before updating the HTML render of an item class
To be overridden !!
- Parameters:
- {SuggestItem} item
- the item to update the class
- Returns:
- True if this method can be called, else false.
{boolean}
beforeUpdateInputRender()
This method is called before updating the input render
To be overridden !!
- Returns:
- True if this method can be called, else false.
{boolean}
beforeUpdateSelection(newInputValue)
This method is called before updating the selection
To be overridden !!
- Parameters:
- {String} newInputValue
- The new input value
- Returns:
- True if this method can be called, else false.
{boolean}
beforeUpdateSelectionOnBlur()
This method is called before updating the selection on blur
To be overridden !!
- Returns:
- True if this method can be called, else false.
<private>
callSwitchItemSelectionAction(evt, suggest)
- Parameters:
- evt
- suggest
clearHTMLItems()
This method clear all items presents in the suggestion list.
closePopup(originalTarget)
Method called by the popup manager. To override if the behaviour has to be changed.
- Parameters:
- originalTarget
<private>
createHTMLItem(item, index)
This method create a new suggested item in the suggestion list, for the item and at the specified index.
- Parameters:
- {SuggestItem} item
- the item to set into the list
- {int} index
- the index of the item in that list
<private>
createItemInputField(item)
Create a result input for the item given in parameter, or fill the one existing, in singleSelection mode
- Parameters:
- {SuggestItem} item
- the item to add
<private>
createPageBar()
Create the pageBar for the suggest
<private> <static>
{SuggestData}
SweetDevRia.Suggest.createSuggestData(inputValue, items, truncated, pageNumber)
Creates a SuggestData from parameters values
- Parameters:
- {String} inputValue
- The value of the input which correspond this object
- {Array} items
- The array of SuggestItem of this object
- {boolean} truncated
- Whether this data is truncated or not
- {int} pageNumber
- The page number this data are related to.
- Returns:
- the new SuggestData created
dataFound()
This method is called when data are found
To be overridden !!
dataNotFound()
This method is called when data are not found
To be overriden !!
<private>
deleteItemInputField(item)
Delete a result input for the item given in parameter, or clean the one existing, in singleSelection mode
- Parameters:
- {SuggestItem} item
- the item to delete
drawFooter()
This method draws the header in the suggest popup, according to the getFooterHtmlCode result.
- See:
- getFooterHtmlCode
drawHeader()
This method draws the header in the suggest popup.
It first draws the getHeaderHtmlCode, then the getHeaderSelectionLink.
- See:
- getHeaderHtmlCode
- getHeaderSelectionLink
drawSelectedValues()
This method set the selected items into the suggestion list.
{int}
extractHTMLIndex(id)
Extract the HTML index of an element from its id.
- Parameters:
- id
- Returns:
- the index of the HTML element's id given in parameter
- See:
- getHTMLId
getAnalysis()
This method is called to get statistic data
{SuggestBuffer}
getBuffer()
Return the component's buffer
- Returns:
- the component's buffer
{HTMLElement}
getButton()
Return the button div element
- Returns:
- div button element
{HTMLElement}
getFirstItemSelectionInput()
Return the first result input, contained in the input container.
- Returns:
- the first result input element.
{HTMLElement}
getFooter()
Return the suggest popup footer element
- Returns:
- the suggest popup footer element
{String}
getFooterHtmlCode()
Return the html code for the suggest popup footer.
To be overiden !!
- Returns:
- The html code for the suggest popup footer
{HTMLElement}
getHeader()
Return the suggest popup header element
- Returns:
- the suggest popup header element
{String}
getHeaderHtmlCode()
Return the html code for the suggest popup header. None by default.
To be overiden !!
- Returns:
- The html code for the suggest popup header
{String}
getHeaderSelectionLink()
This method return the link to display to permit the switch of the view mode, suggestions <-> selections
Combine it with getViewMode to know what is currently displayed.
- Returns:
- The HTML code to set into the header to allow that switch. Default is an HTML link.
- See:
- getViewMode
{SuggestItem}
getHighlightenedItem()
Return the current highlightened item, or null if none are highlightened.
- Returns:
- the current highlightened item, or null
{String}
getHTMLId(index)
Return the HTML id formated from an index.
- Parameters:
- index
- Returns:
- the HTML id formated from an index.
- See:
- extractHTMLIndex
{Input}
getInput()
Return the input element
- Returns:
- input element
{HTMLElement}
getInputSelectionContainer()
Return the resulting inputs container
- Returns:
- the resulting input container
{String}
getInputValue()
Return the input element's value
- Returns:
- input element value
{String}
getItemHtmlCode(item)
This method is used to render a SuggestItem in the HTML suggestion/selection list in the suggestion popup.
Return an HTML formatted text according to the item given in parameter
To be overiden for a rich display !!
- Parameters:
- {SuggestItem} item
- The item to render.
- Returns:
- the html view of the SuggestItem
{int}
getItemSelectionInputNumber()
Return the number of result inputs (implicitly the number of selected items).
- Returns:
- the number of result inputs
{HTMLElement}
getItemsList()
Return the list ul element containing the suggest items
- Returns:
- list ul element containing the suggest items
{Array(SuggestItem)}
getMultiSelectedItems()
Return the selected items, in multiSelect
- Returns:
- the selected items, in multiSelect
{String}
getMultiSelectInputRender()
Return the text to insert in the input when multiple values are selected.
The number of items by default.
To be overridden !!
- Returns:
- The text to insert in the input when multiple values are selected.
<private>
{String}
getPageBarId()
Return the pageBar container id for this suggest
<private>
{String}
getPageBarWrapId()
Return the pageBar container id for this suggest
<private>
{SuggestData}
getRefineableData(value)
Get some data refined from other ones in buffer.
Return null if none could be created.
- Parameters:
- {String} value
- The value to refine from.
- Returns:
- the new SuggestData created from an old one, or null if none could have been created
{SuggestItem}
getSelectedItemFromId(id)
Return the selected item corresponding to that id
- Parameters:
- {String} id
- the id of the item
- Returns:
- the item corresponding to that id
{int}
getSelectedItemsNumber()
Return the number of items selected at present.
- Returns:
- the number of items selected at present.
<private>
{Map}
getServerModelUpdate()
Return the parameters to send to the server to update this component's server model
- Returns:
- the parameters to send to the server to update this component's server model
{SuggestItem}
getSingleSelectedItem()
Return the selected item, in singleSelect
- Returns:
- the selected item, in singleSelect
{String}
getSingleSelectInputRender()
Return the text to insert in the input when a single value is selected.
The selected item value by default
To be overridden !!
- Returns:
- The text to insert in the input when a single value is selected.
{HTMLElement}
getSuggestPopup()
Return the div containing header, items and footer : the suggest popup
- Returns:
- the div containing header, items and footer : the suggest popup
getValue()
get the input element's value
- Returns:
- input element value
{SuggestItemViewManager}
getViewManager()
Return the component's view manager
- Returns:
- the component's view manager
{int}
getViewMode()
Return the current view mode
- Returns:
- the current view mode
<private>
goToPage(pageNumber)
Load a page.
- Parameters:
- {int} pageNumber
- The number of the page to load
- See:
- pageBar.goToPage(pageNumber);
<private>
hidePageBar()
Hide the pageBar
hideSuggestPopup()
This method hides the suggest popup
highlightItem(item)
This method highlights an item in the list. Also unhighlight the current one.
- Parameters:
- {SuggestItem} item
- the item to highlight
- See:
- getHighlightenedItem
{boolean}
isAjaxInProgress()
Return true if an Ajax request is in progress, false otherwise
- Returns:
- true if an Ajax request is in progress, false otherwise
<private>
{boolean}
isFirstMatchSecond(part, word)
return true if the first value match the second one, according to the current filterMode
- Parameters:
- {String} part
- The string deciding of the *pattern* that word must match
- {String} word
- The word to test for the *pattern* part.
- Returns:
- true if part matches into word
{boolean}
isItemSelected(item)
Return the selected state of an item
- Parameters:
- {SuggestItem} item
- the item to test
- Returns:
- true if the item is selected, false otherwise
<private>
{boolean}
isTimout()
Return True if the timer between 2 AJAX call don't exist or is elapsed
This method is called before sending a new input value to the server
- Returns:
- True if the timer don't exist is elapsed, False in an other case
{boolean}
itemsAreVisible()
This method test the visibility of the suggested item list
- Returns:
- true if the suggested item list is visible, else false
itemsInSuggest(inputValue, items)
This method is called when all possibilities are loaded in suggest
- Parameters:
- inputValue
- items
onChange()
This Method is called when a suggest loses focus
To be overridden
onInputKeyStroke(evt)
Event Handler put on the input field
Decide which action should be executed, depending of the key stroked.
- Parameters:
- {Event} evt
- HTML event
onItemKeyStroke(evt, item)
Event Handler put on each suggested item.
Decide which action should be executed, depending of the key stroked.
- Parameters:
- {Event} evt
- HTML event
- {SuggestItem} item
- the item where the event was triggered
onKeyUp(evt)
This method is called when a key is released
To be overridden !!
- Parameters:
- {Event} evt
- HTML event
onRetrieveValues(evt)
Callback method of the retrieving action
Is in charge of the data processing launch.
- Parameters:
- {Map} evt
- the event which contains the data //TODO
{String}
onSelect()
This method is called when selecting a node.
To be overiden !!
onSwitchItemSelectionAction(item, keepOpen)
This method is triggered on the item selection action
- Parameters:
- {SuggestItem} item
- the item to switch
- {boolean} keepOpen
- if the suggest popup should be kept opened after the selection/unselection
- See:
- switchItemSelection
onSwitchViewModeAction(event)
This method is triggered on the view mode switch action ( suggestions <-> selections )
- Parameters:
- event
- See:
- getHeaderSelectionLink
{String}
onUnSelect()
This method is called when unselecting a node.
To be overiden !!
{SuggestData}
preprocess(items)
Creates a new Value from the input values
To be overriden !!!
- Parameters:
- {inputValue} items
- The original value that the user has input
- Returns:
- the new value
<private>
processData(suggestData, autoShowItems)
Process some new data in the suggest, and optionnally show the suggest popup
- Parameters:
- {SuggestData} suggestData
- The data to process
- {boolean} autoShowItems
- Indicates if we must show the items or not.
processInputValue(newInputValue, pageNumber)
Process the input value, for an optional page.
This method first look up the combo inputValue/pageNumber into the buffer,
then try to refine some buffered data, and finally execute a server request.
- Parameters:
- {String} newInputValue
- The input value to process
- {int} pageNumber
- the number of the page to process. Default is set to 1.
<private>
{SuggestData}
refineBufferedData(bufferedData, value)
Refine the items contained in the bufferedData, according to the value given in parameter
Clean up all the old items which no longer fits the actual value.
- Parameters:
- {SuggestData} bufferedData
- The old data in buffer to refine
- {String} value
- The value to refine from.
- Returns:
- the new SuggestData created from the old one
<private>
removeButtonClassName(className)
Remove a class for the button.
- Parameters:
- {String} className
- the name of the class to remove.
<private>
removeIdFromSelection(item)
Remove a SuggestItem from the selection, in the Suggest reference
- Parameters:
- {SuggestItem} item
- the item to remove
<private>
removeInputFromSelection(item)
Remove an item from the selection, in HTML code
- Parameters:
- {SuggestItem} item
- the item to remove in HTML
- See:
- removeItemFromSelection
<private>
removeItemFromSelection(item)
Remove a SuggestItem from the selection, both in the Suggest reference and in the HTML code
- Parameters:
- {SuggestItem} item
- the item to remove
renderButton()
Update the button rendering, according to the current class
<private>
resizePopupHeight()
This method resize the suggest popup (height dimension)
<private>
resizePopupWidth()
This method resize the suggest popup (width dimension)
restoreInputValue()
Restore the input search value, on refocusing
This mean that in multiSelect mode, the input field switch to the previous searched value
retrieveValues(value, pageNumber)
Retrieve the values from the server, for the input value and page number given in parameter
Process the Ajax Call.
Execute the server model update in the same time than the retrieving.
- Parameters:
- {String} value
- the value we are requesting
- {int} pageNumber
- the page number to get. 1 if no specified.
<private>
setButtonClassName(className)
Set a class for the button. Manages the class order (loading > open > over > out)
- Parameters:
- {String} className
- the name of the class to add.
setEnable(enable, init)
Allow to change the suggest state
- Parameters:
- {Boolean} enable
- If true, you can use the suggest normally, else all the suggest (input and button) is disabled
- {Boolean} init
- If the call is the initialization of the suggest
<private>
setHTMLItems(items)
This method set a list of items into the suggestion list.
- Parameters:
- {Array} items
- A list of SuggestItem to set into the suggestion list
setInputEnable(enable)
Allow to change the input state
- Parameters:
- {Boolean} enable
- If true, the input is enable, else disabled
setInputValue(value)
Set the input element's value
- Parameters:
- value
setItemEnable(itemId, enable)
Allow to disable or enable an suggest item with an item id
- Parameters:
- {String} itemId
- the item identifiant to disable
- {Boolean} enable
- If true, the item is enable, else disabled
setItemEnableByIndex(itemIndex, enable)
Allow to disable or enable an suggest item with an item index
- Parameters:
- {Integer} itemIndex
- the item index to disable
- {Boolean} enable
- If true, the item is enable, else disabled
setItemSelected(item)
Set a SuggestItem selected, both in the Suggest reference and in the HTML code
Does nothing if the item is already selected
- Parameters:
- {SuggestItem} item
- the item to set selected
setItemUnselected(item)
Set a SuggestItem unselected, both in the Suggest reference and in the HTML code
Does nothing if the item is already unselected
- Parameters:
- {SuggestItem} item
- the item to set unselected
setItemVisible(itemId, visible)
Allow to change an item visibility
- Parameters:
- {String} itemId
- the item identifiant to show or hide
- {Boolean} visible
- the new visibility value
setItemVisibleByIndex(itemIndex, visible)
Allow to change an item visibility
- Parameters:
- {Integer} itemIndex
- the item index to show or hide
- {Boolean} visible
- the new visibility value
<private>
setPopupPosition()
This method position the suggest popup
setValue(item)
Set the input element's value
- Parameters:
- item
setVisible(visible, init)
Allow to change the suggets visibility
- Parameters:
- {Boolean} visible
- the new visibility value
- {Boolean} init
- if this is the initialization call
<private>
showPageBar(actualPage, totalPageNumber)
Show the pageBar
- Parameters:
- {int} actualPage
- The page to display
- {int} totalPageNumber
- The total number of pages
showSuggestPopup()
This method shows the suggest popup
<private>
startTimer(timerInterval)
This method start a new timer
- Parameters:
- {int} timerInterval
- the interval between 2 AJAX call (in milliseconds)
<private>
startTimout()
This method Process the input value if their is no AJAX call or set a new
shorter timer if the previous value is not again returned by the server
switchItemSelection(item, keepOpen, keepFocus)
Switch a SuggestItem state.
This method manages everything about the SuggestItem to switch and the current selection.
It finally updates the input render, redraw the header and the footer of the suggest popup.
- Parameters:
- {SuggestItem} item
- the item to switch
- {boolean} keepOpen
- if the suggest popup should be kept opened after the selection/unselection
- keepFocus
switchSuggestPopupVisibility(event, suggest)
This method switchs the popup visibility
- Parameters:
- event
- suggest
switchViewMode(viewMode)
This method switchs the view mode into the popup ( suggestions <-> selections )
- Parameters:
- {int} viewMode
- the mode to switch to
<private>
{boolean}
testEquality(str1, str2)
Test the equality of two strings, according to the current caseSensitive property
- Parameters:
- {String} str1
- The first string
- {String} str2
- The second string
- Returns:
- true if the two strings are equals.
<private>
{boolean}
testRefinement(suggestData, value)
Test if a SuggestData could be refined for a specific value
Return null if none could be created.
- Parameters:
- {SuggestData} suggestData
- The data to test for a refinement
- {String} value
- The value to test the refine from.
- Returns:
- true if a refinement can be executed between the suggestData and the value
unhighlightItem(item)
This method unhighlight an item in the list.
- Parameters:
- {SuggestItem} item
- the item to unhighlight
unselectAll()
Unselect all the items selected
Does nothing if no items are selected
updateClass(item)
Updates the class of the HTML render of an item.
If the item has no render, does nothing.
This class is in charge of computing which class should be applied to the item given in parameter.
- Parameters:
- {SuggestItem} item
- the item to update the HTML class render
- See:
- SuggestItemViewManager
updateInputRender()
This method updates the input render depending of the current selection
<private>
updateItemsSpecificities(items)
Updates the items specificities, regarding their inner data
- Parameters:
- items
updateSelection(newInputValue)
Updates the selection, according to the current input value and the previous selected items.
Clean up all the selected item which no longer fit the input value.
Does nothing if stackSelection is set to true.
- Parameters:
- {String} newInputValue
- The new input value
updateSelectionOnBlur()
Updates the selection on input blur
This mean that in singleSelect mode, if the forceSelection is disabled, the selection switch to the user's value entered in the input.