Jitsi: the OpenSource Java VoIP and Instant Messaging client.

net.java.sip.communicator.impl.gui.main.contactlist
Class SearchFilter

java.lang.Object
  extended by net.java.sip.communicator.impl.gui.main.contactlist.SearchFilter
All Implemented Interfaces:
ContactListFilter

public class SearchFilter
extends Object
implements ContactListFilter

The SearchFilter is a ContactListFilter that filters the contact list content by a filter string.

Author:
Yana Stamcheva

Field Summary
static int DEFAULT_SOURCE
          The default contact source search type.
static int HISTORY_SOURCE
          The history contact source search type.
 
Constructor Summary
SearchFilter(MetaContactListSource contactListSource)
          Creates an instance of SearchFilter.
 
Method Summary
 ContactQuery applyFilter(ExternalContactSource contactSource)
          Applies this filter to the given contactSource.
 void applyFilter(FilterQuery filterQuery)
          Applies this filter to the default contact source.
 Collection<ExternalContactSource> getContactSources()
          Returns the list of ExternalContactSource this filter searches in.
 boolean hasDefaultSource()
          Indicates if this filter contains a default source.
 boolean isMatching(UIContact uiContact)
          Indicates if the given uiGroup matches this filter.
 boolean isMatching(UIGroup uiGroup)
          For all groups we return false.
 void setFilterString(String filter)
          Creates the SearchFilter by specifying the string used for filtering.
 void setSearchSourceType(int searchSourceType)
          Sets the search source type: DEFAULT_SOURCE or HISTORY_SOURCE.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_SOURCE

public static final int DEFAULT_SOURCE
The default contact source search type.

See Also:
Constant Field Values

HISTORY_SOURCE

public static final int HISTORY_SOURCE
The history contact source search type.

See Also:
Constant Field Values
Constructor Detail

SearchFilter

public SearchFilter(MetaContactListSource contactListSource)
Creates an instance of SearchFilter.

Method Detail

applyFilter

public void applyFilter(FilterQuery filterQuery)
Applies this filter to the default contact source.

Specified by:
applyFilter in interface ContactListFilter
Parameters:
filterQuery - the query that tracks this filter.

applyFilter

public ContactQuery applyFilter(ExternalContactSource contactSource)
Applies this filter to the given contactSource.

Parameters:
contactSource - the ExternalContactSource to apply the filter to
Returns:
the ContactQuery that tracks this filter

isMatching

public boolean isMatching(UIContact uiContact)
Indicates if the given uiGroup matches this filter.

Specified by:
isMatching in interface ContactListFilter
Parameters:
uiContact - the UIGroup to check
Returns:
true if the given uiGroup matches the current filter, false - otherwise

isMatching

public boolean isMatching(UIGroup uiGroup)
For all groups we return false. If some of the child contacts of this group matches this filter the group would be automatically added when the contact is added in the list.

Specified by:
isMatching in interface ContactListFilter
Parameters:
uiGroup - the UIGroup to check
Returns:
false

setFilterString

public void setFilterString(String filter)
Creates the SearchFilter by specifying the string used for filtering.

Parameters:
filter - the String used for filtering

setSearchSourceType

public void setSearchSourceType(int searchSourceType)
Sets the search source type: DEFAULT_SOURCE or HISTORY_SOURCE.

Parameters:
searchSourceType - the type of the search source to set

getContactSources

public Collection<ExternalContactSource> getContactSources()
Returns the list of ExternalContactSource this filter searches in.

Returns:
the list of ExternalContactSource this filter searches in

hasDefaultSource

public boolean hasDefaultSource()
Indicates if this filter contains a default source.

Returns:
true if this filter contains a default source, false otherwise

Jitsi: the OpenSource Java VoIP and Instant Messaging client.

Jitsi, the OpenSource Java VoIP and Instant Messaging client.
Distributable under LGPL license.