aboutsummaryrefslogtreecommitdiffstats
path: root/src/net/java/sip/communicator/service
diff options
context:
space:
mode:
authorhristoterezov <hristo@jitsi.org>2013-11-20 18:05:23 +0200
committerhristoterezov <hristo@jitsi.org>2013-11-20 18:05:23 +0200
commite0aeee986a0a326e9b875555786826794a80d04f (patch)
tree8521c1190c2bbc0d397663d78ab5305d474c7465 /src/net/java/sip/communicator/service
parentdab2ada999d2ae4c681d30e9cb5352084bdf539b (diff)
downloadjitsi-e0aeee986a0a326e9b875555786826794a80d04f.zip
jitsi-e0aeee986a0a326e9b875555786826794a80d04f.tar.gz
jitsi-e0aeee986a0a326e9b875555786826794a80d04f.tar.bz2
Disables the show more label for chat room contact source.
Diffstat (limited to 'src/net/java/sip/communicator/service')
-rw-r--r--src/net/java/sip/communicator/service/contactsource/AbstractContactQuery.java24
-rw-r--r--src/net/java/sip/communicator/service/contactsource/AsyncContactQuery.java27
-rw-r--r--src/net/java/sip/communicator/service/contactsource/ContactReceivedEvent.java37
3 files changed, 86 insertions, 2 deletions
diff --git a/src/net/java/sip/communicator/service/contactsource/AbstractContactQuery.java b/src/net/java/sip/communicator/service/contactsource/AbstractContactQuery.java
index 523e350..716cd7e 100644
--- a/src/net/java/sip/communicator/service/contactsource/AbstractContactQuery.java
+++ b/src/net/java/sip/communicator/service/contactsource/AbstractContactQuery.java
@@ -98,8 +98,11 @@ public abstract class AbstractContactQuery<T extends ContactSourceService>
* @param contact the <tt>SourceContact</tt> which has been received and
* which the registered <tt>ContactQueryListener</tt>s are to be notified
* about
+ * @param showMoreEnabled indicates whether show more label should be shown
+ * or not.
*/
- protected void fireContactReceived(SourceContact contact)
+ protected void fireContactReceived(SourceContact contact,
+ boolean showMoreEnabled)
{
ContactQueryListener[] ls;
@@ -108,10 +111,27 @@ public abstract class AbstractContactQuery<T extends ContactSourceService>
ls = listeners.toArray(new ContactQueryListener[listeners.size()]);
}
- ContactReceivedEvent ev = new ContactReceivedEvent(this, contact);
+ ContactReceivedEvent ev
+ = new ContactReceivedEvent(this, contact, showMoreEnabled);
for (ContactQueryListener l : ls)
+ {
l.contactReceived(ev);
+ }
+ }
+
+ /**
+ * Notifies the <tt>ContactQueryListener</tt>s registered with this
+ * <tt>ContactQuery</tt> that a new <tt>SourceContact</tt> has been
+ * received.
+ *
+ * @param contact the <tt>SourceContact</tt> which has been received and
+ * which the registered <tt>ContactQueryListener</tt>s are to be notified
+ * about
+ */
+ protected void fireContactReceived(SourceContact contact)
+ {
+ fireContactReceived(contact, true);
}
/**
diff --git a/src/net/java/sip/communicator/service/contactsource/AsyncContactQuery.java b/src/net/java/sip/communicator/service/contactsource/AsyncContactQuery.java
index 3ce2506..21fa13c 100644
--- a/src/net/java/sip/communicator/service/contactsource/AsyncContactQuery.java
+++ b/src/net/java/sip/communicator/service/contactsource/AsyncContactQuery.java
@@ -99,6 +99,33 @@ public abstract class AsyncContactQuery<T extends ContactSourceService>
*
* @param sourceContact the <tt>SourceContact</tt> to be added to the
* <tt>queryResults</tt> of this <tt>ContactQuery</tt>
+ * @param showMoreEnabled indicates whether show more label should be shown
+ * or not.
+ * @return <tt>true</tt> if the <tt>queryResults</tt> of this
+ * <tt>ContactQuery</tt> has changed in response to the call
+ */
+ protected boolean addQueryResult(SourceContact sourceContact,
+ boolean showMoreEnabled)
+ {
+ boolean changed;
+
+ synchronized (queryResults)
+ {
+ changed = queryResults.add(sourceContact);
+ }
+ if (changed)
+ fireContactReceived(sourceContact, showMoreEnabled);
+
+ return changed;
+ }
+
+ /**
+ * Adds a specific <tt>SourceContact</tt> to the list of
+ * <tt>SourceContact</tt>s to be returned by this <tt>ContactQuery</tt> in
+ * response to {@link #getQueryResults()}.
+ *
+ * @param sourceContact the <tt>SourceContact</tt> to be added to the
+ * <tt>queryResults</tt> of this <tt>ContactQuery</tt>
* @return <tt>true</tt> if the <tt>queryResults</tt> of this
* <tt>ContactQuery</tt> has changed in response to the call
*/
diff --git a/src/net/java/sip/communicator/service/contactsource/ContactReceivedEvent.java b/src/net/java/sip/communicator/service/contactsource/ContactReceivedEvent.java
index 0adb9a9..37123ac 100644
--- a/src/net/java/sip/communicator/service/contactsource/ContactReceivedEvent.java
+++ b/src/net/java/sip/communicator/service/contactsource/ContactReceivedEvent.java
@@ -26,6 +26,11 @@ public class ContactReceivedEvent
* The contact that has been received.
*/
private final SourceContact contact;
+
+ /**
+ * Indicates whether show more label should be shown or not.
+ */
+ private final boolean showMoreEnabled;
/**
* Creates a <tt>ContactReceivedEvent</tt> by specifying the contact search
@@ -39,6 +44,27 @@ public class ContactReceivedEvent
super(source);
this.contact = contact;
+
+ showMoreEnabled = true;
+ }
+
+ /**
+ * Creates a <tt>ContactReceivedEvent</tt> by specifying the contact search
+ * source and the received <tt>searchContact</tt>.
+ * @param source the source that triggered this event
+ * @param contact the received contact
+ * @param showMoreEnabled indicates whether show more label should be shown
+ * or not.
+ */
+ public ContactReceivedEvent(ContactQuery source,
+ SourceContact contact,
+ boolean showMoreEnabled)
+ {
+ super(source);
+
+ this.contact = contact;
+
+ this.showMoreEnabled = showMoreEnabled;
}
/**
@@ -58,4 +84,15 @@ public class ContactReceivedEvent
{
return contact;
}
+
+ /**
+ * Returns <tt>true</tt> if show more label should be shown and
+ * <tt>false</tt> if not.
+ * @return <tt>true</tt> if show more label should be shown and
+ * <tt>false</tt> if not.
+ */
+ public boolean isShowMoreEnabled()
+ {
+ return showMoreEnabled;
+ }
}