Jitsi: the OpenSource Java VoIP and Instant Messaging client.

net.java.sip.communicator.impl.gui.main.contactlist.contactsource
Class MetaContactQuery

java.lang.Object
  extended by net.java.sip.communicator.impl.gui.main.contactlist.contactsource.MetaContactQuery

public class MetaContactQuery
extends Object

The MetaContactQuery corresponds to a particular query made through the MetaContactListSource. Each query once started could be canceled. One could also register a listener in order to be notified for changes in query status and query contact results.

Author:
Yana Stamcheva

Constructor Summary
MetaContactQuery()
           
 
Method Summary
 void addContactQueryListener(MetaContactQueryListener l)
          Adds the given MetaContactQueryListener to the list of registered listeners.
 void cancel()
          Cancels this query.
 void fireQueryEvent(int queryStatus)
          Notifies the MetaContactQueryListener that this query has changed its status.
 void fireQueryEvent(MetaContact metaContact)
          Notifies the MetaContactQueryListener that a new MetaContact has been received as a result of a search.
 void fireQueryEvent(MetaContactGroup metaGroup)
          Notifies the MetaContactQueryListener that a new MetaGroup has been received as a result of a search.
 int getResultCount()
          Returns the current number of results received for this query.
 boolean isCanceled()
          Returns true if this query has been canceled, otherwise returns false.
 void removeContactQueryListener(MetaContactQueryListener l)
          Removes the given MetaContactQueryListener to the list of registered listeners.
 void setInitialResultCount(int resultCount)
          Sets the result count of this query.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MetaContactQuery

public MetaContactQuery()
Method Detail

cancel

public void cancel()
Cancels this query.


isCanceled

public boolean isCanceled()
Returns true if this query has been canceled, otherwise returns false.

Returns:
true if this query has been canceled, otherwise returns false.

getResultCount

public int getResultCount()
Returns the current number of results received for this query.

Returns:
the current number of results received for this query

setInitialResultCount

public void setInitialResultCount(int resultCount)
Sets the result count of this query. This method is meant to be used to set the initial result count which is before firing any events. The result count would be then augmented each time the fireQueryEvent is called.

Parameters:
resultCount - the initial result count to set

addContactQueryListener

public void addContactQueryListener(MetaContactQueryListener l)
Adds the given MetaContactQueryListener to the list of registered listeners. The MetaContactQueryListener would be notified each time a new MetaContactQuery result has been received or if the query has been completed or has been canceled by user or for any other reason.

Parameters:
l - the MetaContactQueryListener to add

removeContactQueryListener

public void removeContactQueryListener(MetaContactQueryListener l)
Removes the given MetaContactQueryListener to the list of registered listeners. The MetaContactQueryListener would be notified each time a new MetaContactQuery result has been received or if the query has been completed or has been canceled by user or for any other reason.

Parameters:
l - the MetaContactQueryListener to remove

fireQueryEvent

public void fireQueryEvent(MetaContact metaContact)
Notifies the MetaContactQueryListener that a new MetaContact has been received as a result of a search.

Parameters:
metaContact - the received MetaContact

fireQueryEvent

public void fireQueryEvent(MetaContactGroup metaGroup)
Notifies the MetaContactQueryListener that a new MetaGroup has been received as a result of a search.

Parameters:
metaGroup - the received MetaGroup

fireQueryEvent

public void fireQueryEvent(int queryStatus)
Notifies the MetaContactQueryListener that this query has changed its status.

Parameters:
queryStatus - the new query status

Jitsi: the OpenSource Java VoIP and Instant Messaging client.

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