public abstract class BaseEditorSearchIndex<T extends Searchable> extends Object implements EditorSearchIndex<T>
| Constructor and Description |
|---|
BaseEditorSearchIndex() |
| 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.
|
protected abstract List<T> |
getSearchableElements() |
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 |
setCurrentAssetHashcodeSupplier(Supplier<Integer> currentAssetHashcodeSupplier) |
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 searchClosedCallback) |
void |
setSearchPerformedCallback(org.uberfire.mvp.Command searchPerformedCallback)
Sets the callback that will be triggered when search is performed.
|
public void setSearchPerformedCallback(org.uberfire.mvp.Command searchPerformedCallback)
EditorSearchIndexsetSearchPerformedCallback in interface EditorSearchIndex<T extends Searchable>searchPerformedCallback - the callback that will be triggeredpublic List<HasSearchableElements<T>> getSubIndexes()
EditorSearchIndexgetSubIndexes in interface EditorSearchIndex<T extends Searchable>HasSearchableElements.public void registerSubIndex(HasSearchableElements<T> hasSearchableElements)
EditorSearchIndexEditorSearchIndex.registerSubIndex in interface EditorSearchIndex<T extends Searchable>hasSearchableElements - represents a new index.public void search(String term)
EditorSearchIndexSearchable that satisfies the parameter, and triggers the onFound
callback for the first result.search in interface EditorSearchIndex<T extends Searchable>term - the string that will trigger the searchpublic int getCurrentResultNumber()
EditorSearchIndexgetCurrentResultNumber in interface EditorSearchIndex<T extends Searchable>public int getTotalOfResultsNumber()
EditorSearchIndexgetTotalOfResultsNumber in interface EditorSearchIndex<T extends Searchable>public void close()
EditorSearchIndexisDirty, the nextResult, the previousResult,
the getCurrentResultNumber, and the getTotalOfResultsNumber method.close in interface EditorSearchIndex<T extends Searchable>public void setNoResultsFoundCallback(org.uberfire.mvp.Command callback)
EditorSearchIndexsetNoResultsFoundCallback in interface EditorSearchIndex<T extends Searchable>callback - the callback that will be triggeredpublic void setClearCurrentResultsCallback(org.uberfire.mvp.Command callback)
EditorSearchIndexsetClearCurrentResultsCallback in interface EditorSearchIndex<T extends Searchable>callback - the callback that will be triggeredpublic void setSearchClosedCallback(org.uberfire.mvp.Command searchClosedCallback)
setSearchClosedCallback in interface EditorSearchIndex<T extends Searchable>public boolean isDirty()
EditorSearchIndexisDirty in interface EditorSearchIndex<T extends Searchable>public void nextResult()
EditorSearchIndexonFound callback for the next result.nextResult in interface EditorSearchIndex<T extends Searchable>public void previousResult()
EditorSearchIndexonFound callback for the previous result.previousResult in interface EditorSearchIndex<T extends Searchable>public Integer getCurrentAssetHashcode()
EditorSearchIndexisDirty logic.getCurrentAssetHashcode in interface EditorSearchIndex<T extends Searchable>public void setCurrentAssetHashcodeSupplier(Supplier<Integer> currentAssetHashcodeSupplier)
public Optional<T> getCurrentResult()
EditorSearchIndexgetCurrentResult in interface EditorSearchIndex<T extends Searchable>Copyright © 2001–2021 JBoss by Red Hat. All rights reserved.