diff options
Diffstat (limited to 'src/net/java/sip/communicator/service/gui')
14 files changed, 1084 insertions, 1 deletions
diff --git a/src/net/java/sip/communicator/service/gui/ContactList.java b/src/net/java/sip/communicator/service/gui/ContactList.java new file mode 100644 index 0000000..1a448ba --- /dev/null +++ b/src/net/java/sip/communicator/service/gui/ContactList.java @@ -0,0 +1,172 @@ +/* + * 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; + +import java.awt.*; +import java.util.*; + +import net.java.sip.communicator.service.contactsource.*; +import net.java.sip.communicator.service.gui.event.*; + +/** + * The <tt>ContactList</tt> interface represents a contact list. All contact + * list components that need to be available as a service could implement + * this interface. + * + * @author Yana Stamcheva + */ +public interface ContactList +{ + /** + * Returns the actual component corresponding to the contact list. + * + * @return the actual component corresponding to the contact list + */ + public Component getComponent(); + + /** + * Returns the list of registered contact sources to search in. + * @return the list of registered contact sources to search in + */ + public Collection<UIContactSource> getContactSources(); + + /** + * Returns the <tt>ExternalContactSource</tt> corresponding to the given + * <tt>ContactSourceService</tt>. + * @param contactSource the <tt>ContactSourceService</tt>, which + * corresponding external source implementation we're looking for + * @return the <tt>ExternalContactSource</tt> corresponding to the given + * <tt>ContactSourceService</tt> + */ + public UIContactSource getContactSource(ContactSourceService contactSource); + + /** + * Adds the given group to this list. + * @param group the <tt>UIGroup</tt> to add + * @param isSorted indicates if the contact should be sorted regarding to + * the <tt>GroupNode</tt> policy + */ + public void addGroup(final UIGroup group, final boolean isSorted); + + /** + * Removes the given group and its children from the list. + * @param group the <tt>UIGroup</tt> to remove + */ + public void removeGroup(final UIGroup group); + + /** + * Adds the given <tt>contact</tt> to this list. + * @param contact the <tt>UIContact</tt> to add + * @param group the <tt>UIGroup</tt> to add to + * @param isContactSorted indicates if the contact should be sorted + * regarding to the <tt>GroupNode</tt> policy + * @param isGroupSorted indicates if the group should be sorted regarding to + * the <tt>GroupNode</tt> policy in case it doesn't exist and should be + * added + */ + public void addContact( final UIContact contact, + final UIGroup group, + final boolean isContactSorted, + final boolean isGroupSorted); + + /** + * Adds the given <tt>contact</tt> to this list. + * @param query the <tt>ContactQuery</tt> that adds the given contact + * @param contact the <tt>UIContact</tt> to add + * @param group the <tt>UIGroup</tt> to add to + * @param isSorted indicates if the contact should be sorted regarding to + * the <tt>GroupNode</tt> policy + */ + public void addContact(final ContactQuery query, + final UIContact contact, + final UIGroup group, + final boolean isSorted); + + /** + * Removes the node corresponding to the given <tt>MetaContact</tt> from + * this list. + * @param contact the <tt>UIContact</tt> to remove + * @param removeEmptyGroup whether we should delete the group if is empty + */ + public void removeContact( final UIContact contact, + final boolean removeEmptyGroup); + + /** + * Removes the node corresponding to the given <tt>MetaContact</tt> from + * this list. + * @param contact the <tt>UIContact</tt> to remove + */ + public void removeContact(UIContact contact); + + /** + * Returns the currently applied filter. + * @return the currently applied filter + */ + public ContactListFilter getCurrentFilter(); + + /** + * Applies the given <tt>filter</tt>. + * @param filter the <tt>ContactListFilter</tt> to apply. + * @return the filter query + */ + public FilterQuery applyFilter(ContactListFilter filter); + + /** + * Applies the default filter. + * @return the filter query that keeps track of the filtering results + */ + public FilterQuery applyDefaultFilter(); + + /** + * Returns the currently selected <tt>UIContact</tt> if there's one. + * + * @return the currently selected <tt>UIContact</tt> if there's one. + */ + public UIContact getSelectedContact(); + + /** + * Returns the currently selected <tt>UIGroup</tt> if there's one. + * + * @return the currently selected <tt>UIGroup</tt> if there's one. + */ + public UIGroup getSelectedGroup(); + + /** + * Selects the given <tt>UIContact</tt> in the contact list. + * + * @param uiContact the contact to select + */ + public void setSelectedContact(UIContact uiContact); + + /** + * Selects the given <tt>UIGroup</tt> in the contact list. + * + * @param uiGroup the group to select + */ + public void setSelectedGroup(UIGroup uiGroup); + + /** + * Adds a listener for <tt>ContactListEvent</tt>s. + * + * @param listener the listener to add + */ + public void addContactListListener(ContactListListener listener); + + /** + * Removes a listener previously added with <tt>addContactListListener</tt>. + * + * @param listener the listener to remove + */ + public void removeContactListListener(ContactListListener listener); + + /** + * Refreshes the given <tt>UIContact</tt>. + * + * @param uiContact the contact to refresh + */ + public void refreshContact(UIContact uiContact); +} diff --git a/src/net/java/sip/communicator/service/gui/ContactListFilter.java b/src/net/java/sip/communicator/service/gui/ContactListFilter.java new file mode 100644 index 0000000..328415f --- /dev/null +++ b/src/net/java/sip/communicator/service/gui/ContactListFilter.java @@ -0,0 +1,41 @@ +/* + * 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; + +/** + * The <tt>ContactListFilter</tt> is an interface meant to be implemented by + * modules interested in filtering the contact list. An implementation of this + * interface should be able to answer if an <tt>UIContact</tt> or an + * <tt>UIGroup</tt> is matching the corresponding filter. + * + * @author Yana Stamcheva + */ +public interface ContactListFilter +{ + /** + * Indicates if the given <tt>uiGroup</tt> is matching the current filter. + * @param uiContact the <tt>UIContact</tt> to check + * @return <tt>true</tt> to indicate that the given <tt>uiContact</tt> + * matches this filter, <tt>false</tt> - otherwise + */ + public boolean isMatching(UIContact uiContact); + + /** + * Indicates if the given <tt>uiGroup</tt> is matching the current filter. + * @param uiGroup the <tt>UIGroup</tt> to check + * @return <tt>true</tt> to indicate that the given <tt>uiGroup</tt> + * matches this filter, <tt>false</tt> - otherwise + */ + public boolean isMatching(UIGroup uiGroup); + + /** + * Applies this filter to any interested sources + * @param filterQuery the <tt>FilterQuery</tt> that tracks the results of + * this filtering + */ + public void applyFilter(FilterQuery filterQuery); +} diff --git a/src/net/java/sip/communicator/service/gui/ContactListNode.java b/src/net/java/sip/communicator/service/gui/ContactListNode.java new file mode 100644 index 0000000..8d9ddaa --- /dev/null +++ b/src/net/java/sip/communicator/service/gui/ContactListNode.java @@ -0,0 +1,23 @@ +/* + * 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; + +/** + * The <tt>ContactListNode</tt> represents a node in the contact list data + * model. An implementation of this interface should be able to determine the + * index of this node in its contact source. + * + * @author Yana Stamcheva + */ +public interface ContactListNode +{ + /** + * Returns the index of this node in the <tt>MetaContactListService</tt>. + * @return the index of this node in the <tt>MetaContactListService</tt> + */ + public int getSourceIndex(); +} diff --git a/src/net/java/sip/communicator/service/gui/FilterQuery.java b/src/net/java/sip/communicator/service/gui/FilterQuery.java new file mode 100644 index 0000000..7b2cda9 --- /dev/null +++ b/src/net/java/sip/communicator/service/gui/FilterQuery.java @@ -0,0 +1,84 @@ +/* + * 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; + +import net.java.sip.communicator.service.contactsource.*; +import net.java.sip.communicator.service.gui.event.*; + +/** + * The <tt>FilterQuery</tt> gives information about a current filtering. + * + * @author Yana Stamcheva + */ +public abstract class FilterQuery +{ + /** + * A listener, which is notified when this query finishes. + */ + private FilterQueryListener filterQueryListener; + + /** + * Adds the given <tt>contactQuery</tt> to the list of filterQueries. + * @param contactQuery the <tt>ContactQuery</tt> to add + */ + public abstract void addContactQuery(Object contactQuery); + + /** + * Sets the <tt>isSucceeded</tt> property. + * @param isSucceeded indicates if this query has succeeded + */ + public abstract void setSucceeded(boolean isSucceeded); + + /** + * Indicates if this query has succeeded. + * @return <tt>true</tt> if this query has succeeded, <tt>false</tt> - + * otherwise + */ + public abstract boolean isSucceeded(); + + /** + * Indicates if this query is canceled. + * @return <tt>true</tt> if this query is canceled, <tt>false</tt> otherwise + */ + public abstract boolean isCanceled(); + + /** + * Cancels this filter query. + */ + public abstract void cancel(); + + /** + * Closes this query to indicate that no more contact sub-queries would be + * added to it. + */ + public abstract void close(); + + /** + * Sets the given <tt>FilterQueryListener</tt>. + * @param l the <tt>FilterQueryListener</tt> to set + */ + public void setQueryListener(FilterQueryListener l) + { + filterQueryListener = l; + } + + /** + * Removes the given query from this filter query, updates the related data + * and notifies interested parties if this was the last query to process. + * @param query the <tt>ContactQuery</tt> to remove. + */ + public abstract void removeQuery(ContactQuery query); + + /** + * Verifies if the given query is contained in this filter query. + * + * @param query the query we're looking for + * @return <tt>true</tt> if the given <tt>query</tt> is contained in this + * filter query, <tt>false</tt> - otherwise + */ + public abstract boolean containsQuery(Object query); +} diff --git a/src/net/java/sip/communicator/service/gui/UIContact.java b/src/net/java/sip/communicator/service/gui/UIContact.java new file mode 100644 index 0000000..774d65e --- /dev/null +++ b/src/net/java/sip/communicator/service/gui/UIContact.java @@ -0,0 +1,139 @@ +/* + * 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; + +import java.awt.*; +import java.util.*; +import java.util.List; + +import net.java.sip.communicator.service.protocol.*; +import net.java.sip.communicator.util.swing.*; + +/** + * The <tt>UIContact</tt> represents the user interface contact contained in the + * contact list component. + * + * @author Yana Stamcheva + */ +public abstract class UIContact +{ + /** + * Returns the descriptor of this contact. + * + * @return the descriptor of this contact + */ + public abstract Object getDescriptor(); + + /** + * Returns the display name of this contact. + * + * @return the display name of this contact + */ + public abstract String getDisplayName(); + + /** + * Returns the display details of this contact. These would be shown + * whenever the contact is selected. + * + * @return the display details of this contact + */ + public abstract String getDisplayDetails(); + + /** + * Returns the index of this contact in its source. + * + * @return the source index + */ + public abstract int getSourceIndex(); + + /** + * Creates a tool tip for this contact. If such tooltip is + * provided it would be shown on mouse over over this <tt>UIContact</tt>. + * + * @return the tool tip for this contact descriptor + */ + public abstract ExtendedTooltip getToolTip(); + + /** + * Returns the right button menu component. + * + * @return the right button menu component + */ + public abstract Component getRightButtonMenu(); + + /** + * Returns the parent group. + * + * @return the parent group + */ + public abstract UIGroup getParentGroup(); + + /** + * Sets the given <tt>UIGroup</tt> to be the parent group of this + * <tt>UIContact</tt>. + * + * @param parentGroup the parent <tt>UIGroup</tt> of this contact + */ + public abstract void setParentGroup(UIGroup parentGroup); + + /** + * Returns an <tt>Iterator</tt> over a list of the search strings of this + * contact. + * + * @return an <tt>Iterator</tt> over a list of the search strings of this + * contact + */ + public abstract Iterator<String> getSearchStrings(); + + /** + * Returns the default <tt>ContactDetail</tt> to use for any operations + * depending to the given <tt>OperationSet</tt> class. + * + * @param opSetClass the <tt>OperationSet</tt> class we're interested in + * @return the default <tt>ContactDetail</tt> to use for any operations + * depending to the given <tt>OperationSet</tt> class + */ + public abstract UIContactDetail getDefaultContactDetail( + Class<? extends OperationSet> opSetClass); + + /** + * Returns a list of all <tt>UIContactDetail</tt>s corresponding to the + * given <tt>OperationSet</tt> class. + * + * @param opSetClass the <tt>OperationSet</tt> class we're looking for + * @return a list of all <tt>UIContactDetail</tt>s corresponding to the + * given <tt>OperationSet</tt> class + */ + public abstract List<UIContactDetail> getContactDetailsForOperationSet( + Class<? extends OperationSet> opSetClass); + + /** + * Returns a list of all <tt>UIContactDetail</tt>s within this + * <tt>UIContact</tt>. + * + * @return a list of all <tt>UIContactDetail</tt>s within this + * <tt>UIContact</tt> + */ + public abstract List<UIContactDetail> getContactDetails(); + + /** + * Returns all custom action buttons for this notification contact. + * + * @return a list of all custom action buttons for this notification contact + */ + public abstract Collection<SIPCommButton> getContactCustomActionButtons(); + + /** + * Returns the preferred height of this group in the contact list. + * + * @return the preferred height of this group in the contact list + */ + public int getPreferredHeight() + { + return -1; + } +} diff --git a/src/net/java/sip/communicator/service/gui/UIContactDetail.java b/src/net/java/sip/communicator/service/gui/UIContactDetail.java new file mode 100644 index 0000000..88f8a8e --- /dev/null +++ b/src/net/java/sip/communicator/service/gui/UIContactDetail.java @@ -0,0 +1,203 @@ +/* + * 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; + +import java.util.*; + +import net.java.sip.communicator.service.protocol.*; + +/** + * The <tt>UIContactDetail</tt> corresponds to a particular contact detail, + * phone number, IM identifier, email, etc. which has it's preferred mode of + * transport <tt>ProtocolProviderService</tt>. + * + * @author Yana Stamcheva + */ +public abstract class UIContactDetail +{ + /** + * The prefix to be used when calling this contact detail. + */ + private String prefix; + + /** + * The address of this detail. + */ + private final String address; + + /** + * The display name of this detail. + */ + private final String displayName; + + /** + * The <tt>ProtocolProviderService</tt> corresponding to this detail. + */ + private final ProtocolProviderService protocolProvider; + + /** + * The protocol to be used for this contact detail if no protocol provider + * is set. + */ + private final String preferredProtocol; + + /** + * The collection of labels associated with this detail. + */ + private final Collection<String> labels; + + /** + * The category of the underlying contact detail. + */ + private final String category; + + /** + * The underlying object that this class is wrapping + */ + private final Object descriptor; + + /** + * Creates a <tt>UIContactDetail</tt> by specifying the contact + * <tt>address</tt>, the <tt>displayName</tt> and <tt>preferredProvider</tt>. + * @param address the contact address + * @param displayName the contact display name + * @param category the category of the underlying contact detail + * @param labels the collection of labels associated with this detail + * @param statusIcon the status icon of this contact detail + * @param preferredProvider the preferred protocol provider + * @param preferredProtocol the preferred protocol if no protocol provider + * is set + * @param descriptor the underlying object that this class is wrapping + */ + public UIContactDetail( + String address, + String displayName, + String category, + Collection<String> labels, + ProtocolProviderService preferredProvider, + String preferredProtocol, + Object descriptor) + { + this.address = address; + this.displayName = displayName; + this.category = category; + this.labels = labels; + this.protocolProvider = preferredProvider; + this.preferredProtocol = preferredProtocol; + this.descriptor = descriptor; + } + + /** + * Returns the display name of this detail. + * @return the display name of this detail + */ + public String getDisplayName() + { + return displayName; + } + + /** + * Returns the address of this detail. + * @return the address of this detail + */ + public String getAddress() + { + if (prefix != null && prefix.trim().length() >= 0) + return prefix + address; + + return address; + } + + /** + * Returns the category of the underlying detail. + * + * @return the category of the underlying detail + */ + public String getCategory() + { + return category; + } + + /** + * Returns an iterator over the collection of labels associated with this + * detail. + * + * @return an iterator over the collection of labels associated with this + * detail + */ + public Iterator<String> getLabels() + { + if (labels != null) + return labels.iterator(); + + return null; + } + + /** + * Returns the protocol provider preferred for contacting this detail for + * the given <tt>OperationSet</tt> class. + * @param opSetClass the <tt>OperationSet</tt> class for which we're looking + * for provider + * @return the protocol provider preferred for contacting this detail + */ + public ProtocolProviderService getPreferredProtocolProvider( + Class<? extends OperationSet> opSetClass) + { + return protocolProvider; + } + + /** + * Returns the name of the protocol preferred for contacting this detail for + * the given <tt>OperationSet</tt> class if no preferred protocol provider + * is set. + * @param opSetClass the <tt>OperationSet</tt> class for which we're looking + * for protocol + * @return the name of the protocol preferred for contacting this detail + */ + public String getPreferredProtocol(Class<? extends OperationSet> opSetClass) + { + return preferredProtocol; + } + + /** + * Returns the prefix to be used when calling this contact detail. + * + * @return the prefix to be used when calling this contact detail + */ + public String getPrefix() + { + return prefix; + } + + /** + * Sets the prefix to be used when calling this contact detail. + * + * @param prefix the prefix to be used when calling this contact detail + */ + public void setPrefix(String prefix) + { + this.prefix = prefix; + } + + /** + * Returns the underlying object that this class is wrapping + * + * @return the underlying object that this class is wrapping + */ + public Object getDescriptor() + { + return descriptor; + } + + /** + * Returns the <tt>PresenceStatus</tt> of this <tt>ContactDetail</tt> or + * null if the detail doesn't support presence. + * @return the <tt>PresenceStatus</tt> of this <tt>ContactDetail</tt> or + * null if the detail doesn't support presence + */ + public abstract PresenceStatus getPresenceStatus(); +} diff --git a/src/net/java/sip/communicator/service/gui/UIContactDetailAction.java b/src/net/java/sip/communicator/service/gui/UIContactDetailAction.java new file mode 100644 index 0000000..1286ee0 --- /dev/null +++ b/src/net/java/sip/communicator/service/gui/UIContactDetailAction.java @@ -0,0 +1,25 @@ +/* + * 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; + +/** + * Defines an action for an <tt>UIContactDetail</tt>. + * + * @author Yana Stamcheva + */ +public interface UIContactDetailAction +{ + /** + * Indicates this action is executed for the given <tt>UIContactDetail</tt>. + * + * @param contactDetail the <tt>UIContactDetail</tt> for which this action + * is performed + * @param x the x coordinate of the action + * @param y the y coordinate of the action + */ + public void actionPerformed (UIContactDetail contactDetail, int x, int y); +} diff --git a/src/net/java/sip/communicator/service/gui/UIContactSource.java b/src/net/java/sip/communicator/service/gui/UIContactSource.java new file mode 100644 index 0000000..f2b6028 --- /dev/null +++ b/src/net/java/sip/communicator/service/gui/UIContactSource.java @@ -0,0 +1,60 @@ +/* + * 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; + +import net.java.sip.communicator.service.contactsource.*; + +/** + * The user interface representation of a contact source. + * + * @author Yana Stamcheva + */ +public interface UIContactSource +{ + /** + * Returns the UI group for this contact source. There's only one group + * descriptor per external source. + * + * @return the group descriptor + */ + public UIGroup getUIGroup(); + + /** + * Returns the <tt>UIContact</tt> corresponding to the given + * <tt>sourceContact</tt>. + * + * @param sourceContact the <tt>SourceContact</tt>, for which we search a + * corresponding <tt>UIContact</tt> + * @return the <tt>UIContact</tt> corresponding to the given + * <tt>sourceContact</tt> + */ + public UIContact createUIContact(SourceContact sourceContact); + + /** + * Removes the <tt>UIContact</tt> from the given <tt>sourceContact</tt>. + * @param sourceContact the <tt>SourceContact</tt>, which corresponding UI + * contact we would like to remove + */ + public void removeUIContact(SourceContact sourceContact); + + /** + * Returns the <tt>UIContact</tt> corresponding to the given + * <tt>SourceContact</tt>. + * @param sourceContact the <tt>SourceContact</tt>, which corresponding UI + * contact we're looking for + * @return the <tt>UIContact</tt> corresponding to the given + * <tt>MetaContact</tt> + */ + public UIContact getUIContact(SourceContact sourceContact); + + /** + * Returns the corresponding <tt>ContactSourceService</tt>. + * + * @return the corresponding <tt>ContactSourceService</tt> + */ + public ContactSourceService getContactSourceService(); +} diff --git a/src/net/java/sip/communicator/service/gui/UIGroup.java b/src/net/java/sip/communicator/service/gui/UIGroup.java new file mode 100644 index 0000000..9bdfa07 --- /dev/null +++ b/src/net/java/sip/communicator/service/gui/UIGroup.java @@ -0,0 +1,137 @@ +/* + * 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; + +import java.awt.*; + +/** + * The <tt>UIGroup</tt> represents the user interface contact list group. + * + * @author Yana Stamcheva + */ +public abstract class UIGroup +{ + /** + * The preferred height of this group in the contact list. + */ + private int preferredGroupHeight = -1; + + /** + * The display details of this group. + */ + private String displayDetails = ""; + + /** + * Returns the descriptor of the group. This would be the underlying object + * that should provide all other necessary information for the group. + * + * @return the descriptor of the group + */ + public abstract Object getDescriptor(); + + /** + * The display name of the group. The display name is the name to be shown + * in the contact list group row. + * + * @return the display name of the group + */ + public abstract String getDisplayName(); + + /** + * Returns the display details of this contact. These would be shown + * whenever the contact is selected. The display details aren't obligatory, + * so we return an empty string. + * + * @return the display details of this contact + */ + public String getDisplayDetails() + { + return displayDetails; + } + + /** + * Sets the display details of this group. + * + * @return the display details of this group + */ + public void setDisplayDetails(String displayDetails) + { + this.displayDetails = displayDetails; + } + + /** + * Returns the index of this group in its source. In other words this is + * the descriptor index. + * + * @return the index of this group in its source + */ + public abstract int getSourceIndex(); + + /** + * Returns the parent group. + * + * @return the parent group + */ + public abstract UIGroup getParentGroup(); + + /** + * Indicates if the group is collapsed or expanded. + * + * @return <tt>true</tt> to indicate that the group is collapsed, + * <tt>false</tt> to indicate that it's expanded + */ + public abstract boolean isGroupCollapsed(); + + /** + * Returns the count of online child contacts. + * + * @return the count of online child contacts + */ + public abstract int countOnlineChildContacts(); + + /** + * Returns the child contacts count. + * + * @return child contacts count + */ + public abstract int countChildContacts(); + + /** + * Returns the identifier of this group. + * + * @return the identifier of this group + */ + public abstract String getId(); + + /** + * Returns the right button menu for this group. + * + * @return the right button menu component for this group + */ + public abstract Component getRightButtonMenu(); + + /** + * Returns the preferred height of this group in the contact list. + * + * @return the preferred height of this group in the contact list + */ + public int getPreferredHeight() + { + return preferredGroupHeight; + } + + /** + * Sets the preferred height of this group in the contact list. + * + * @param preferredHeight the preferred height of this group in the contact + * list + */ + public void setPreferredHeight(int preferredHeight) + { + this.preferredGroupHeight = preferredHeight; + } +} diff --git a/src/net/java/sip/communicator/service/gui/UIService.java b/src/net/java/sip/communicator/service/gui/UIService.java index 45f4dfd..add11c0 100644 --- a/src/net/java/sip/communicator/service/gui/UIService.java +++ b/src/net/java/sip/communicator/service/gui/UIService.java @@ -455,4 +455,11 @@ public interface UIService * participants to be included into the newly created <tt>Chat</tt> */ public void startChat(String[] participants); + + /** + * Creates a contact list component. + * + * @return the created <tt>ContactList</tt> + */ + public ContactList createContactListComponent(); } 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); +} diff --git a/src/net/java/sip/communicator/service/gui/gui.manifest.mf b/src/net/java/sip/communicator/service/gui/gui.manifest.mf index ea63780..0708371 100644 --- a/src/net/java/sip/communicator/service/gui/gui.manifest.mf +++ b/src/net/java/sip/communicator/service/gui/gui.manifest.mf @@ -5,7 +5,8 @@ Bundle-Vendor: jitsi.org Bundle-Version: 0.0.1 System-Bundle: yes Import-Package: org.osgi.framework, - org.jitsi.service.resources, net.java.sip.communicator.service.resources, + org.jitsi.service.resources, + net.java.sip.communicator.service.resources, net.java.sip.communicator.util Export-Package: net.java.sip.communicator.service.gui, net.java.sip.communicator.service.gui.event, |