From fecc1bc966159c745cd1b23e49dc4ef5e89e08a3 Mon Sep 17 00:00:00 2001 From: Symphorien Wanko Date: Fri, 20 Feb 2009 17:59:58 +0000 Subject: enhancements to the swing popup notification, new behavior for the trayicon, minors code tweak --- .../service/notification/NotificationService.java | 4 ++- .../communicator/service/systray/PopupMessage.java | 31 +++++++++++++++------ .../systray/event/SystrayPopupMessageEvent.java | 32 ++++++++++++++++++++++ 3 files changed, 58 insertions(+), 9 deletions(-) (limited to 'src/net/java/sip/communicator/service') diff --git a/src/net/java/sip/communicator/service/notification/NotificationService.java b/src/net/java/sip/communicator/service/notification/NotificationService.java index 6026354..1998426 100644 --- a/src/net/java/sip/communicator/service/notification/NotificationService.java +++ b/src/net/java/sip/communicator/service/notification/NotificationService.java @@ -333,10 +333,12 @@ public interface NotificationService * (e.g. with systray) * @param message the message to use if and where appropriate (e.g. with * systray or log notification.) + * @param tag additional info to be used by the notification handler */ public void fireNotification( String eventType, String messageTitle, - String message); + String message, + Object tag); /** * Fires all notifications registered for the specified eventType diff --git a/src/net/java/sip/communicator/service/systray/PopupMessage.java b/src/net/java/sip/communicator/service/systray/PopupMessage.java index 3f82324..60c97e0 100644 --- a/src/net/java/sip/communicator/service/systray/PopupMessage.java +++ b/src/net/java/sip/communicator/service/systray/PopupMessage.java @@ -35,8 +35,8 @@ public class PopupMessage /** type of the message */ private int messageType; - /** the contact which is the cause of this popup message */ - private Contact contact; + /** additional info to be used by the PopupMessageHandler */ + private Object tag; /** * Creates a PopupMessage with the given title and message inside @@ -95,6 +95,21 @@ public class PopupMessage } /** + * Creates a new PopupMessage with the given + * JComponent as its content. This constructor also takes a title + * and a message as replacements in cases the component is not usable. + * + * @param component the component to put in the PopupMessage + * @param title of the message + * @param tag additional info to be used by the PopupMessageHandler + */ + public PopupMessage(String title, String message, Object tag) + { + this(title, message); + this.tag = tag; + } + + /** * @return the message */ public String getMessage() @@ -175,18 +190,18 @@ public class PopupMessage } /** - * @return the contact + * @return the object used to tag this PopupMessage */ - public Contact getContact() + public Object getTag() { - return contact; + return tag; } /** - * @param contact the contact to set + * @param tag the object to set */ - public void setContact(Contact contact) + public void setTag(Object tag) { - this.contact = contact; + this.tag = tag; } } diff --git a/src/net/java/sip/communicator/service/systray/event/SystrayPopupMessageEvent.java b/src/net/java/sip/communicator/service/systray/event/SystrayPopupMessageEvent.java index ac0f7ef..bdc8318 100644 --- a/src/net/java/sip/communicator/service/systray/event/SystrayPopupMessageEvent.java +++ b/src/net/java/sip/communicator/service/systray/event/SystrayPopupMessageEvent.java @@ -17,8 +17,40 @@ import java.util.*; public class SystrayPopupMessageEvent extends EventObject { + /** an object to distinguish this SystrayPopupMessageEvent */ + private Object tag; + public SystrayPopupMessageEvent(Object source) { super(source); } + + /** + * Creates a new SystrayPopupMessageEvent with the source of the + * event and additional info provided by the popup handler. + * @param source the source of the event + * @param tag additional info for listeners + */ + public SystrayPopupMessageEvent(Object source, Object tag) + { + super(source); + this.tag = tag; + } + + /** + * @return the tag + */ + public Object getTag() + { + return tag; + } + + /** + * @param tag the tag to set + */ + public void setTag(Object tag) + { + this.tag = tag; + } + } -- cgit v1.1