|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.icepdf.ri.common.search.DocumentSearchModelImpl
public class DocumentSearchModelImpl
Document search model is used by the DocumentSearchController as a way to cache search results. PDF document in general can be to big to keep all data in memory at once. ICEpdf uses a dispose/initialization on Page data as memory is needed. When this happens the selected text data will be lost and we have to research the page in question the next time it is viewed.
This model can be used in two ways; the first is to store search terms and the second is to keep a record of page indexes that have search results. The later uses weak references to make sure we don't leak any memory. If the page has no data available in its weak reference then we can get it. If a there is no value for a given page index then we know the page had no search hits and we can ignore it.
| Constructor Summary | |
|---|---|
DocumentSearchModelImpl()
Creates a new instance with empty search terms and search result caches. |
|
| Method Summary | |
|---|---|
void |
addPageSearchHit(int pageIndex,
org.icepdf.core.pobjects.graphics.text.PageText pageText)
Add a search result hit for a given page. |
void |
addSearchTerm(org.icepdf.core.search.SearchTerm searchTerm)
Add a search term to the model. |
void |
clearSearchResults()
Clears all search results and highlight states found in the research results cache. |
void |
clearSearchResults(int page)
Clears cached search results for this page index and clears the highlighted state for this page. |
java.util.Set<java.lang.Integer> |
getPageSearchHits()
Gets a set of page hit page indexes. |
org.icepdf.core.pobjects.graphics.text.PageText |
getPageTextHit(int pageIndex)
|
java.util.ArrayList<org.icepdf.core.search.SearchTerm> |
getSearchTerms()
Gets a list of search terms that make up a given search. |
boolean |
isPageSearchHit(int pageIndex)
Check the page index to see if there is a search result. |
boolean |
isPageTextMatch(int pageIndex,
org.icepdf.core.pobjects.graphics.text.PageText pageText)
When we know a page has a hit but aren't sure if pageText is still in a highlighted state we can use this method to check. |
void |
removeSearchTerm(org.icepdf.core.search.SearchTerm searchTerm)
Remove the specified search term from the model. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public DocumentSearchModelImpl()
| Method Detail |
|---|
public java.util.ArrayList<org.icepdf.core.search.SearchTerm> getSearchTerms()
public void addSearchTerm(org.icepdf.core.search.SearchTerm searchTerm)
searchTerm - search term, no checking is done for invalid data.public void removeSearchTerm(org.icepdf.core.search.SearchTerm searchTerm)
searchTerm - search term to remove.
public void addPageSearchHit(int pageIndex,
org.icepdf.core.pobjects.graphics.text.PageText pageText)
pageIndex - page index of search hit(s)pageText - PageText for the given page index.public java.util.Set<java.lang.Integer> getPageSearchHits()
public boolean isPageSearchHit(int pageIndex)
pageIndex - index of page to search
public org.icepdf.core.pobjects.graphics.text.PageText getPageTextHit(int pageIndex)
public boolean isPageTextMatch(int pageIndex,
org.icepdf.core.pobjects.graphics.text.PageText pageText)
pageIndex - page index to look at PageText resultspageText - current Page objects PageText object we want to check
against whats in the cache.
public void clearSearchResults(int page)
page - page index to clear search results from.public void clearSearchResults()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||