aboutsummaryrefslogtreecommitdiffstats
path: root/src/net/java/sip/communicator/service/gui/event
diff options
context:
space:
mode:
Diffstat (limited to 'src/net/java/sip/communicator/service/gui/event')
-rw-r--r--src/net/java/sip/communicator/service/gui/event/ContactListEvent.java110
-rw-r--r--src/net/java/sip/communicator/service/gui/event/ContactListListener.java50
-rw-r--r--src/net/java/sip/communicator/service/gui/event/FilterQueryListener.java31
3 files changed, 191 insertions, 0 deletions
diff --git a/src/net/java/sip/communicator/service/gui/event/ContactListEvent.java b/src/net/java/sip/communicator/service/gui/event/ContactListEvent.java
new file mode 100644
index 0000000..623788c
--- /dev/null
+++ b/src/net/java/sip/communicator/service/gui/event/ContactListEvent.java
@@ -0,0 +1,110 @@
+/*
+ * Jitsi, the OpenSource Java VoIP and Instant Messaging client.
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package net.java.sip.communicator.service.gui.event;
+
+import java.util.*;
+
+import net.java.sip.communicator.service.gui.*;
+
+/**
+ * The <tt>ContactListEvent</tt> is triggered when a contact or a group is
+ * clicked in the contact list.
+ * @author Yana Stamcheva
+ */
+public class ContactListEvent
+ extends EventObject
+{
+ private int eventID = -1;
+
+ /**
+ * Indicates that the ContactListEvent instance was triggered by
+ * selecting a contact in the contact list.
+ */
+ public static final int CONTACT_CLICKED = 1;
+
+ /**
+ * Indicates that the ContactListEvent instance was triggered by selecting
+ * a group in the contact list.
+ */
+ public static final int GROUP_CLICKED = 2;
+
+ /**
+ * Indicates that the ContactListEvent instance was triggered by
+ * selecting a contact in the contact list.
+ */
+ public static final int CONTACT_SELECTED = 3;
+
+ /**
+ * Indicates that the ContactListEvent instance was triggered by selecting
+ * a group in the contact list.
+ */
+ public static final int GROUP_SELECTED = 4;
+
+ /**
+ * Indicated the number of click accompanying the event
+ */
+ private int clickCount;
+
+ /**
+ * Creates a new ContactListEvent according to the specified parameters.
+ * @param source the MetaContact which was selected
+ * @param eventID one of the XXX_SELECTED static fields indicating the
+ * nature of the event.
+ * @param clickCount the number of clicks that was produced when clicking
+ * over the contact list
+ */
+ public ContactListEvent(Object source, int eventID, int clickCount)
+ {
+ super(source);
+
+ this.eventID = eventID;
+ this.clickCount = clickCount;
+ }
+
+ /**
+ * Returns an event id specifying whether the type of this event
+ * (CONTACT_SELECTED or PROTOCOL_CONTACT_SELECTED)
+ * @return one of the XXX_SELECTED int fields of this class.
+ */
+ public int getEventID()
+ {
+ return eventID;
+ }
+
+ /**
+ * Returns the <tt>UIContactDescriptor</tt> for which this event occured.
+ * @return the </tt>UIContactDescriptor</tt> for which this event occured
+ */
+ public UIContact getSourceContact()
+ {
+ if(getSource() instanceof UIContact)
+ return (UIContact) getSource();
+
+ return null;
+ }
+
+ /**
+ * Returns the <tt>UIGroupDescriptor</tt> for which this event occured.
+ * @return the <tt>UIGroupDescriptor</tt> for which this event occured
+ */
+ public UIGroup getSourceGroup()
+ {
+ if(getSource() instanceof UIGroup)
+ return (UIGroup) getSource();
+
+ return null;
+ }
+
+ /**
+ * Returns the number of click of this event.
+ * @return the number of click of this event.
+ */
+ public int getClickCount()
+ {
+ return clickCount;
+ }
+}
diff --git a/src/net/java/sip/communicator/service/gui/event/ContactListListener.java b/src/net/java/sip/communicator/service/gui/event/ContactListListener.java
new file mode 100644
index 0000000..f6fa602
--- /dev/null
+++ b/src/net/java/sip/communicator/service/gui/event/ContactListListener.java
@@ -0,0 +1,50 @@
+/*
+ * Jitsi, the OpenSource Java VoIP and Instant Messaging client.
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package net.java.sip.communicator.service.gui.event;
+
+import java.util.*;
+
+/**
+ * Listens for events coming from mouse events over the contact list. For
+ * example a contact been clicked or a group been selected.
+ *
+ * @author Yana Stamcheva
+ */
+public interface ContactListListener extends EventListener
+{
+ /**
+ * Indicates that a group has been selected.
+ *
+ * @param evt the <tt>ContactListEvent</tt> that has been triggered from
+ * the user selection
+ */
+ public void groupClicked(ContactListEvent evt);
+
+ /**
+ * Indicates that a group has been selected.
+ *
+ * @param evt the <tt>ContactListEvent</tt> that has been triggered from
+ * the user selection
+ */
+ public void groupSelected(ContactListEvent evt);
+
+ /**
+ * Indicates that a contact has been clicked.
+ *
+ * @param evt the <tt>ContactListEvent</tt> that has been triggered from
+ * the user click
+ */
+ public void contactClicked(ContactListEvent evt);
+
+ /**
+ * Indicates that a contact has been selected.
+ *
+ * @param evt the <tt>ContactListEvent</tt> that has been triggered from
+ * the user selection
+ */
+ public void contactSelected(ContactListEvent evt);
+}
diff --git a/src/net/java/sip/communicator/service/gui/event/FilterQueryListener.java b/src/net/java/sip/communicator/service/gui/event/FilterQueryListener.java
new file mode 100644
index 0000000..1f7747f
--- /dev/null
+++ b/src/net/java/sip/communicator/service/gui/event/FilterQueryListener.java
@@ -0,0 +1,31 @@
+/*
+ * Jitsi, the OpenSource Java VoIP and Instant Messaging client.
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package net.java.sip.communicator.service.gui.event;
+
+import net.java.sip.communicator.service.gui.*;
+
+/**
+ * The <tt>FilterQueryListener</tt> is notified when a filter query finishes.
+ *
+ * @author Yana Stamcheva
+ */
+public interface FilterQueryListener
+{
+ /**
+ * Indicates that the given <tt>query</tt> has finished with success, i.e.
+ * the filter has returned results.
+ * @param query the <tt>FilterQuery</tt>, where this listener is registered
+ */
+ public void filterQuerySucceeded(FilterQuery query);
+
+ /**
+ * Indicates that the given <tt>query</tt> has finished with failure, i.e.
+ * no results for the filter were found.
+ * @param query the <tt>FilterQuery</tt>, where this listener is registered
+ */
+ public void filterQueryFailed(FilterQuery query);
+}