T - represents the type of Searchable element.public interface EditorSearchIndex<T extends Searchable>
EditorSearchIndex holds the search logic.
---
The EditorSearchIndex can have many sub-indexes that index different kinds of elements. Each sub-index, or
HasSearchableElements, is naive and will load its searchable elements for every call.
Thus, implementations of this interface control lazy approaches, cached approaches, or even the use of a third party
library.
---| Modifier and Type | Method and Description |
|---|---|
void |
close()
Resets the index state.
|
Integer |
getCurrentAssetHashcode()
This method is used by the
isDirty logic. |
Optional<T> |
getCurrentResult()
Returns the current result.
|
int |
getCurrentResultNumber()
Returns the number of the current result.
|
List<HasSearchableElements<T>> |
getSubIndexes()
Returns the list of sub-indexes.
|
int |
getTotalOfResultsNumber()
Returns the number of results.
|
boolean |
isDirty()
Check if the index is dirty.
|
void |
nextResult()
Triggers the
onFound callback for the next result. |
void |
previousResult()
Triggers the
onFound callback for the previous result. |
void |
registerSubIndex(HasSearchableElements<T> hasSearchableElements)
Registers a new sub-index into
EditorSearchIndex. |
void |
search(String term)
Searches for any
Searchable that satisfies the parameter, and triggers the onFound
callback for the first result. |
void |
setClearCurrentResultsCallback(org.uberfire.mvp.Command callback)
Sets the callback that will be triggered when the current search results needs to be cleared.
|
void |
setNoResultsFoundCallback(org.uberfire.mvp.Command callback)
Sets the callback that will be triggered when no result is found.
|
void |
setSearchClosedCallback(org.uberfire.mvp.Command callback) |
void |
setSearchPerformedCallback(org.uberfire.mvp.Command callback)
Sets the callback that will be triggered when search is performed.
|
Optional<T> getCurrentResult()
List<HasSearchableElements<T>> getSubIndexes()
HasSearchableElements.void registerSubIndex(HasSearchableElements<T> hasSearchableElements)
EditorSearchIndex.hasSearchableElements - represents a new index.void search(String term)
Searchable that satisfies the parameter, and triggers the onFound
callback for the first result.term - the string that will trigger the searchvoid setNoResultsFoundCallback(org.uberfire.mvp.Command callback)
callback - the callback that will be triggeredvoid setSearchClosedCallback(org.uberfire.mvp.Command callback)
void setSearchPerformedCallback(org.uberfire.mvp.Command callback)
callback - the callback that will be triggeredvoid setClearCurrentResultsCallback(org.uberfire.mvp.Command callback)
callback - the callback that will be triggeredInteger getCurrentAssetHashcode()
isDirty logic.boolean isDirty()
void nextResult()
onFound callback for the next result.void previousResult()
onFound callback for the previous result.int getCurrentResultNumber()
int getTotalOfResultsNumber()
void close()
isDirty, the nextResult, the previousResult,
the getCurrentResultNumber, and the getTotalOfResultsNumber method.Copyright © 2001–2021 JBoss by Red Hat. All rights reserved.