|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.levigo.jadice.search.AbstractCharSequenceSearchRequest com.levigo.jadice.search.SearchRequest
public final class SearchRequest
provides a interaction interface for searching and retrieving results. The SearchRequest is the way to access the text searching functionality of the levigo jadice viewer. Working with this class has the following main aspects:
setSearchStrings(String[])
) and specifying the Page
s to
search in (AbstractCharSequenceSearchRequest.setPages(List)
). These settings are mandatory. As a addition there are two
optional settings: case sensitive (setCaseSensitive(boolean)
) and whole words only (
setWholeWordsOnly(boolean)
). To check if the SearchRequest
is valid, the
isValid()
method can be invoked witch will return true
in case of a valid
configuration.SearchStateChangeEvent
:
SearchStateChangeEvent.isRunning()
SearchStateChangeEvent.isRunning()
SearchStateChangeEvent.isCancelled()
SearchStateChangeEvent.isFinished()
AbstractCharSequenceSearchRequest.execute()
method.
Now the internal mechanism will be called and starts to process the request. All results and
status changes will be made available using the listener interfaces described above.SearchRequest
implements the VetoableChangeListener
-support. That means that
for all possible properties, a VetoableChangeListener
can be registered. Possible
properties are: PROPERTY_CASE_SENSITIVE
, AbstractCharSequenceSearchRequest.PROPERTY_PAGES
,
PROPERTY_SEARCHSTRINGS
and PROPERTY_WHOLE_WORDS_ONLY
. The methods used to set
those properties are shown at the property declaration.
Nested Class Summary | |
---|---|
static class |
SearchRequest.SearchState
|
Field Summary | |
---|---|
static String |
PROPERTY_CASE_SENSITIVE
case sensitive searching property. |
static String |
PROPERTY_SEARCHSTRINGS
search strings property |
static String |
PROPERTY_WHOLE_WORDS_ONLY
whole words only property |
Fields inherited from class com.levigo.jadice.search.AbstractCharSequenceSearchRequest |
---|
PROPERTY_PAGES |
Constructor Summary | |
---|---|
SearchRequest()
|
Method Summary | |
---|---|
protected CharSequenceMatcher |
createMatcher()
Creates a CharSequenceMatcher . |
String[] |
getSearchStrings()
the search strings that have been specified using the setSearchStrings(String[])
method. |
boolean |
isCaseSensitive()
|
boolean |
isValid()
Checks if the configuration of the SearchRequest is sufficient. |
boolean |
isWholeWordsOnly()
|
void |
setCaseSensitive(boolean enable)
Specifies whether it should be searched in a case sensitive manner or not. |
void |
setSearchStrings(String[] searchStrings)
specifies the strings for which the text search should search for. |
void |
setWholeWordsOnly(boolean enable)
Specifies wether it should be searched for whole words only or not. |
Methods inherited from class com.levigo.jadice.search.AbstractCharSequenceSearchRequest |
---|
addSearchStateListener, cancel, ensureModifiable, ensureNotRunning, ensureValid, execute, executeSync, getInternalHook, getPages, getResultList, getState, isModifiable, isRunning, reset, setPages |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String PROPERTY_CASE_SENSITIVE
setCaseSensitive(boolean)
,
Constant Field Valuespublic static final String PROPERTY_SEARCHSTRINGS
setSearchStrings(String[])
,
Constant Field Valuespublic static final String PROPERTY_WHOLE_WORDS_ONLY
setWholeWordsOnly(boolean)
,
Constant Field ValuesConstructor Detail |
---|
public SearchRequest()
Method Detail |
---|
public String[] getSearchStrings()
setSearchStrings(String[])
method.
setSearchStrings(String[])
setSearchStrings(String[])
public boolean isCaseSensitive()
true
if the SearchRequest
is configured for case sensitive
searchingsetCaseSensitive(boolean)
public boolean isValid()
SearchRequest
is sufficient. It will be sufficient
if the the searchStrings (using the setSearchStrings(String[])
method) and the pages
(using the AbstractCharSequenceSearchRequest.setPages(List)
method) have been set.
isValid
in class AbstractCharSequenceSearchRequest
true
if the configuration is sufficientAbstractCharSequenceSearchRequest.isValid()
public boolean isWholeWordsOnly()
true
if the SearchRequest
is configured for whole words only
searchingsetWholeWordsOnly(boolean)
public void setCaseSensitive(boolean enable)
String
s specified using setSearchStrings(String[])
.
Examples:
search string | text in page | matches (case sensitive) |
---|---|---|
Levigo |
levigo |
no |
MO:DCA |
MO:DCA |
yes |
MO:dca |
MO:DCA |
no |
NOTE:
Please keep in Mind that settings using this method will only be possible if the request is
modifiable. If the SearchRequest
is not modifiable this method will throw a
IllegalStateException
. For details about the modifiable state of the
SearchRequest
, please see AbstractCharSequenceSearchRequest.isModifiable()
enable
- set to true
if search should be case sensitive.
IllegalStateException
- if the search request is not modifiable (see
AbstractCharSequenceSearchRequest.isModifiable()
public void setSearchStrings(String[] searchStrings)
String
s beeing
specified will be interpreted as a logical or
. That means that the text search
will search for searchString[0] ... searchString[n]
independent from each other.
NOTE:
Please keep in Mind that settings using this method will only be possible if the request is
modifiable. If the SearchRequest
is not modifiable this method will throw a
IllegalStateException
. For details about the modifiable state of the
SearchRequest
, please see AbstractCharSequenceSearchRequest.isModifiable()
searchStrings
- an array of String
s to search for.
IllegalArgumentException
- if the searchStrings are null or an array with a size of zero
IllegalStateException
- if the search request is not modifiable (see
AbstractCharSequenceSearchRequest.isModifiable()
public void setWholeWordsOnly(boolean enable)
Examples: (spaces will be represented as underscore (_) characters)
search string | text in page | matches |
---|---|---|
ja |
_jadice_ |
no |
jadice |
_jadice_ |
yes |
MO:dca |
_MO:DCA_ |
yes |
NOTE:
Please keep in Mind that settings using this method will only be possible if the request is
modifiable. If the SearchRequest
is not modifiable this method will throw a
IllegalStateException
. For details about the modifiable state of the
SearchRequest
, please see AbstractCharSequenceSearchRequest.isModifiable()
enable
- set to true
if the text search should search for whole words only.
IllegalStateException
- if the search request is not modifiable (see
AbstractCharSequenceSearchRequest.isModifiable()
protected CharSequenceMatcher createMatcher()
AbstractCharSequenceSearchRequest
CharSequenceMatcher
. This method may never return null.
createMatcher
in class AbstractCharSequenceSearchRequest
CharSequenceMatcher
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |