enhancements to the swing popup notification, new behavior for the trayicon, minors code tweak

cusax-fix
Symphorien Wanko 17 years ago
parent 41da838ce2
commit fecc1bc966

@ -912,6 +912,7 @@
<zipfileset dir="${dest}/net/java/sip/communicator/util" <zipfileset dir="${dest}/net/java/sip/communicator/util"
prefix="net/java/sip/communicator/util"/> prefix="net/java/sip/communicator/util"/>
<zipfileset src="${lib.noinst}/dnsjava-2.0.3.jar" prefix=""/> <zipfileset src="${lib.noinst}/dnsjava-2.0.3.jar" prefix=""/>
<zipfileset src="lib/installer-exclude/laf-widget.jar" prefix=""/>
</jar> </jar>
</target> </target>
@ -1311,7 +1312,6 @@ javax.swing.event, javax.swing.border"/>
<zipfileset src="lib/installer-exclude/jna.jar" prefix=""/> <zipfileset src="lib/installer-exclude/jna.jar" prefix=""/>
<zipfileset src="lib/installer-exclude/transparency.jar" prefix=""/> <zipfileset src="lib/installer-exclude/transparency.jar" prefix=""/>
<zipfileset src="lib/installer-exclude/swing-worker-1.2.jar" prefix=""/> <zipfileset src="lib/installer-exclude/swing-worker-1.2.jar" prefix=""/>
<zipfileset src="lib/installer-exclude/laf-widget.jar" prefix=""/>
</jar> </jar>
</target> </target>

@ -1,5 +1,6 @@
# service gui # service gui
service.gui.SIP_COMMUNICATOR_LOGO=resources/images/logo/sc_logo16x16.png service.gui.SIP_COMMUNICATOR_LOGO=resources/images/logo/sc_logo16x16.png
service.gui.SIP_COMMUNICATOR_LOGO_39x58=resources/images/logo/sc_logo_39x58.png
service.gui.MAIN_WINDOW_BACKGROUND= service.gui.MAIN_WINDOW_BACKGROUND=
service.gui.AUTH_WINDOW_BACKGROUND=resources/images/impl/gui/common/passWindowBackground.png service.gui.AUTH_WINDOW_BACKGROUND=resources/images/impl/gui/common/passWindowBackground.png
service.gui.ABOUT_WINDOW_BACKGROUND=resources/images/impl/gui/common/aboutWindowBackground.png service.gui.ABOUT_WINDOW_BACKGROUND=resources/images/impl/gui/common/aboutWindowBackground.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

@ -339,8 +339,8 @@ impl.systray.SET_STATUS=Set Status
impl.systray.ONLINE_STATUS=Online impl.systray.ONLINE_STATUS=Online
impl.systray.OFFLINE_STATUS=Offline impl.systray.OFFLINE_STATUS=Offline
impl.systray.FAILED_TO_OPEN_ADD_CONTACT_DIALOG=Failed to open the "Add Contact" dialog. impl.systray.FAILED_TO_OPEN_ADD_CONTACT_DIALOG=Failed to open the "Add Contact" dialog.
impl.systray.POPUP_MESSAGE_HANDLER=Systray balloon message impl.systray.POPUP_MESSAGE_HANDLER=Systray balloon messages
impl.swingnotification.POPUP_MESSAGE_HANDLER=SC likes popup impl.swingnotification.POPUP_MESSAGE_HANDLER=SIP Communicator popups
impl.growlnotification.POPUP_MESSAGE_HANDLER=Growl notifications impl.growlnotification.POPUP_MESSAGE_HANDLER=Growl notifications
# account info # account info
@ -669,7 +669,7 @@ plugin.notificationconfig.RESTORE=Restore Defaults
plugin.notificationconfig.PLAY_SOUND=Play a sound : plugin.notificationconfig.PLAY_SOUND=Play a sound :
plugin.notificationconfig.EXEC_PROG=Execute a program : plugin.notificationconfig.EXEC_PROG=Execute a program :
plugin.notificationconfig.DISPLAY_POPUP=Show a message in a pop-up window plugin.notificationconfig.DISPLAY_POPUP=Show a message in a pop-up window
plugin.notificationconfig.POPUP_NOTIF_HANDLER=Popup notifications type plugin.notificationconfig.POPUP_NOTIF_HANDLER=Popup notifications type :
# ZRTP Securing # ZRTP Securing
impl.media.security.INFO=ZRTP Security information impl.media.security.INFO=ZRTP Security information

@ -7,6 +7,7 @@
package net.java.sip.communicator.impl.gui.customcontrols; package net.java.sip.communicator.impl.gui.customcontrols;
import java.awt.*; import java.awt.*;
import net.java.sip.communicator.util.swing.*;
/** /**
* The <tt>MsgToolbarButton</tt> is a <tt>SIPCommButton</tt> that has * The <tt>MsgToolbarButton</tt> is a <tt>SIPCommButton</tt> that has

@ -9,8 +9,7 @@
import javax.swing.*; import javax.swing.*;
import javax.swing.plaf.*; import javax.swing.plaf.*;
import javax.swing.plaf.metal.*; import javax.swing.plaf.metal.*;
import net.java.sip.communicator.util.swing.*;
import net.java.sip.communicator.impl.gui.utils.*;
/** /**
* The default SIP-Communicator look&feel. * The default SIP-Communicator look&feel.

@ -13,7 +13,6 @@
import javax.swing.plaf.metal.*; import javax.swing.plaf.metal.*;
import javax.swing.text.*; import javax.swing.text.*;
import net.java.sip.communicator.impl.gui.customcontrols.*;
import net.java.sip.communicator.impl.gui.utils.*; import net.java.sip.communicator.impl.gui.utils.*;
import net.java.sip.communicator.util.swing.*; import net.java.sip.communicator.util.swing.*;

@ -14,7 +14,6 @@
import javax.swing.border.*; import javax.swing.border.*;
import net.java.sip.communicator.impl.gui.*; import net.java.sip.communicator.impl.gui.*;
import net.java.sip.communicator.impl.gui.customcontrols.*;
import net.java.sip.communicator.impl.gui.utils.*; import net.java.sip.communicator.impl.gui.utils.*;
import net.java.sip.communicator.service.protocol.*; import net.java.sip.communicator.service.protocol.*;
import net.java.sip.communicator.util.swing.*; import net.java.sip.communicator.util.swing.*;

@ -57,8 +57,7 @@ public void incomingCallReceived(CallEvent event)
// FIXME: I18N // FIXME: I18N
NotificationManager.fireNotification( NotificationManager.fireNotification(
NotificationManager.INCOMING_CALL, NotificationManager.INCOMING_CALL,
GuiActivator.getResources().getSettingsString( "",
"service.gui.APPLICATION_NAME"),
"Incoming call received from: " "Incoming call received from: "
+ sourceCall.getCallParticipants().next()); + sourceCall.getCallParticipants().next());
} }

@ -14,7 +14,6 @@
import javax.swing.Timer; import javax.swing.Timer;
import net.java.sip.communicator.impl.gui.*; import net.java.sip.communicator.impl.gui.*;
import net.java.sip.communicator.impl.gui.customcontrols.*;
import net.java.sip.communicator.impl.gui.utils.*; import net.java.sip.communicator.impl.gui.utils.*;
import net.java.sip.communicator.service.protocol.*; import net.java.sip.communicator.service.protocol.*;
import net.java.sip.communicator.service.protocol.event.*; import net.java.sip.communicator.service.protocol.event.*;

@ -15,12 +15,12 @@
import javax.swing.Timer; import javax.swing.Timer;
import net.java.sip.communicator.impl.gui.*; import net.java.sip.communicator.impl.gui.*;
import net.java.sip.communicator.impl.gui.customcontrols.*;
import net.java.sip.communicator.impl.gui.utils.*; import net.java.sip.communicator.impl.gui.utils.*;
import net.java.sip.communicator.service.audionotifier.*; import net.java.sip.communicator.service.audionotifier.*;
import net.java.sip.communicator.service.protocol.*; import net.java.sip.communicator.service.protocol.*;
import net.java.sip.communicator.service.resources.*; import net.java.sip.communicator.service.resources.*;
import net.java.sip.communicator.util.*; import net.java.sip.communicator.util.*;
import net.java.sip.communicator.util.swing.*;
/** /**
* The <tt>DialPanel</tt> is the panel that contains the buttons to dial a * The <tt>DialPanel</tt> is the panel that contains the buttons to dial a

@ -10,9 +10,9 @@
import java.util.*; import java.util.*;
import net.java.sip.communicator.impl.gui.*; import net.java.sip.communicator.impl.gui.*;
import net.java.sip.communicator.impl.gui.customcontrols.*;
import net.java.sip.communicator.impl.gui.utils.*; import net.java.sip.communicator.impl.gui.utils.*;
import net.java.sip.communicator.service.protocol.*; import net.java.sip.communicator.service.protocol.*;
import net.java.sip.communicator.util.swing.*;
/** /**
* Represents an UI means to put an associated <tt>CallPariticant</tt> on/off * Represents an UI means to put an associated <tt>CallPariticant</tt> on/off

@ -10,9 +10,9 @@
import java.util.*; import java.util.*;
import net.java.sip.communicator.impl.gui.*; import net.java.sip.communicator.impl.gui.*;
import net.java.sip.communicator.impl.gui.customcontrols.*;
import net.java.sip.communicator.impl.gui.utils.*; import net.java.sip.communicator.impl.gui.utils.*;
import net.java.sip.communicator.service.protocol.*; import net.java.sip.communicator.service.protocol.*;
import net.java.sip.communicator.util.swing.*;
/** /**
* Represents an UI means to mute the audio stream sent to an associated * Represents an UI means to mute the audio stream sent to an associated

@ -13,7 +13,6 @@
import javax.swing.*; import javax.swing.*;
import net.java.sip.communicator.impl.gui.*; import net.java.sip.communicator.impl.gui.*;
import net.java.sip.communicator.impl.gui.customcontrols.*;
import net.java.sip.communicator.impl.gui.utils.*; import net.java.sip.communicator.impl.gui.utils.*;
import net.java.sip.communicator.service.contactlist.*; import net.java.sip.communicator.service.contactlist.*;
import net.java.sip.communicator.service.protocol.*; import net.java.sip.communicator.service.protocol.*;

@ -12,7 +12,6 @@
import javax.swing.*; import javax.swing.*;
import net.java.sip.communicator.impl.gui.*; import net.java.sip.communicator.impl.gui.*;
import net.java.sip.communicator.impl.gui.customcontrols.*;
import net.java.sip.communicator.impl.gui.utils.*; import net.java.sip.communicator.impl.gui.utils.*;
import net.java.sip.communicator.service.notification.*; import net.java.sip.communicator.service.notification.*;
import net.java.sip.communicator.service.protocol.*; import net.java.sip.communicator.service.protocol.*;

@ -13,11 +13,11 @@
import org.osgi.framework.*; import org.osgi.framework.*;
import net.java.sip.communicator.impl.gui.*; import net.java.sip.communicator.impl.gui.*;
import net.java.sip.communicator.impl.gui.customcontrols.*;
import net.java.sip.communicator.impl.gui.utils.*; import net.java.sip.communicator.impl.gui.utils.*;
import net.java.sip.communicator.service.protocol.*; import net.java.sip.communicator.service.protocol.*;
import net.java.sip.communicator.service.protocol.event.*; import net.java.sip.communicator.service.protocol.event.*;
import net.java.sip.communicator.util.*; import net.java.sip.communicator.util.*;
import net.java.sip.communicator.util.swing.*;
/** /**
* Represents an UI means to transfer (the <code>Call</code> of) an associated * Represents an UI means to transfer (the <code>Call</code> of) an associated

@ -107,6 +107,8 @@ public ChatConversationPanel(ChatConversationContainer chatContainer)
this.chatEditorPane.addHyperlinkListener(this); this.chatEditorPane.addHyperlinkListener(this);
this.chatEditorPane.addMouseListener(this); this.chatEditorPane.addMouseListener(this);
this.chatEditorPane.setCursor(
Cursor.getPredefinedCursor(Cursor.TEXT_CURSOR));
this.setWheelScrollingEnabled(true); this.setWheelScrollingEnabled(true);

@ -77,6 +77,8 @@ public ChatWritePanel(ChatPanel panel)
this.editorPane.getDocument().addUndoableEditListener(this); this.editorPane.getDocument().addUndoableEditListener(this);
this.editorPane.addKeyListener(this); this.editorPane.addKeyListener(this);
this.editorPane.addMouseListener(this); this.editorPane.addMouseListener(this);
this.editorPane.setCursor(
Cursor.getPredefinedCursor(Cursor.TEXT_CURSOR));
//set our own transfer (i.e. copy/paste) handler //set our own transfer (i.e. copy/paste) handler
this.editorPane.setTransferHandler(new ChatWritePanelTransferHandler()); this.editorPane.setTransferHandler(new ChatWritePanelTransferHandler());

@ -14,7 +14,6 @@
import javax.swing.text.html.*; import javax.swing.text.html.*;
import net.java.sip.communicator.impl.gui.*; import net.java.sip.communicator.impl.gui.*;
import net.java.sip.communicator.impl.gui.customcontrols.*;
import net.java.sip.communicator.impl.gui.main.chat.*; import net.java.sip.communicator.impl.gui.main.chat.*;
import net.java.sip.communicator.impl.gui.utils.*; import net.java.sip.communicator.impl.gui.utils.*;
import net.java.sip.communicator.util.*; import net.java.sip.communicator.util.*;

@ -12,7 +12,6 @@
import javax.swing.*; import javax.swing.*;
import net.java.sip.communicator.impl.gui.*; import net.java.sip.communicator.impl.gui.*;
import net.java.sip.communicator.impl.gui.customcontrols.*;
import net.java.sip.communicator.impl.gui.main.chatroomslist.*; import net.java.sip.communicator.impl.gui.main.chatroomslist.*;
import net.java.sip.communicator.impl.gui.main.contactlist.addcontact.*; import net.java.sip.communicator.impl.gui.main.contactlist.addcontact.*;
import net.java.sip.communicator.impl.gui.utils.*; import net.java.sip.communicator.impl.gui.utils.*;

@ -2,8 +2,8 @@
import java.awt.*; import java.awt.*;
import net.java.sip.communicator.impl.gui.customcontrols.*;
import net.java.sip.communicator.service.protocol.*; import net.java.sip.communicator.service.protocol.*;
import net.java.sip.communicator.util.swing.*;
/** /**
* The ContactProtocolButton is a button behind a "meta contact" in the * The ContactProtocolButton is a button behind a "meta contact" in the

@ -31,7 +31,7 @@ public class ConfigurationManager
private static boolean isShowOffline = true; private static boolean isShowOffline = true;
private static boolean isApplicationVisible = true; private static boolean isApplicationVisible = true;
private static boolean isQuitWarningShown = true; private static boolean isQuitWarningShown = true;
private static boolean isSendTypingNotifications; private static boolean isSendTypingNotifications;
@ -96,7 +96,7 @@ public static void loadGuiConfigurations()
if(callPanelShown != null && callPanelShown.length() > 0) if(callPanelShown != null && callPanelShown.length() > 0)
{ {
isCallPanelShown = new Boolean(callPanelShown).booleanValue(); isCallPanelShown = Boolean.parseBoolean(callPanelShown);
} }
// Load the "showOffline" property. // Load the "showOffline" property.
@ -105,7 +105,7 @@ public static void loadGuiConfigurations()
if(showOffline != null && showOffline.length() > 0) if(showOffline != null && showOffline.length() > 0)
{ {
isShowOffline = new Boolean(showOffline).booleanValue(); isShowOffline = Boolean.parseBoolean(showOffline);
} }
// Load the "showApplication" property. // Load the "showApplication" property.
@ -124,7 +124,7 @@ public static void loadGuiConfigurations()
if(quitWarningShown != null && quitWarningShown.length() > 0) if(quitWarningShown != null && quitWarningShown.length() > 0)
{ {
isQuitWarningShown isQuitWarningShown
= new Boolean(quitWarningShown).booleanValue(); = Boolean.parseBoolean(quitWarningShown);
} }
// Load the "sendTypingNotifications" property. // Load the "sendTypingNotifications" property.
@ -141,7 +141,7 @@ public static void loadGuiConfigurations()
if(isSendTypingNotif != null && isSendTypingNotif.length() > 0) if(isSendTypingNotif != null && isSendTypingNotif.length() > 0)
{ {
isSendTypingNotifications isSendTypingNotifications
= new Boolean(isSendTypingNotif).booleanValue(); = Boolean.parseBoolean(isSendTypingNotif);
} }
// Load the "isMoveContactConfirmationRequested" property. // Load the "isMoveContactConfirmationRequested" property.
@ -153,8 +153,8 @@ public static void loadGuiConfigurations()
&& isMoveContactConfirmationRequestedString.length() > 0) && isMoveContactConfirmationRequestedString.length() > 0)
{ {
isMoveContactConfirmationRequested isMoveContactConfirmationRequested
= new Boolean(isMoveContactConfirmationRequestedString) = Boolean.parseBoolean(isMoveContactConfirmationRequestedString)
.booleanValue(); ;
} }
// Load the "isMultiChatWindowEnabled" property. // Load the "isMultiChatWindowEnabled" property.
@ -173,8 +173,8 @@ public static void loadGuiConfigurations()
&& isMultiChatWindowEnabledString.length() > 0) && isMultiChatWindowEnabledString.length() > 0)
{ {
isMultiChatWindowEnabled isMultiChatWindowEnabled
= new Boolean(isMultiChatWindowEnabledString) = Boolean.parseBoolean(isMultiChatWindowEnabledString)
.booleanValue(); ;
} }
// Load the "isHistoryLoggingEnabled" property. // Load the "isHistoryLoggingEnabled" property.
@ -186,8 +186,8 @@ public static void loadGuiConfigurations()
&& isHistoryLoggingEnabledString.length() > 0) && isHistoryLoggingEnabledString.length() > 0)
{ {
isHistoryLoggingEnabled isHistoryLoggingEnabled
= new Boolean(isHistoryLoggingEnabledString) = Boolean.parseBoolean(isHistoryLoggingEnabledString)
.booleanValue(); ;
} }
// Load the "isHistoryShown" property. // Load the "isHistoryShown" property.
@ -206,8 +206,8 @@ public static void loadGuiConfigurations()
&& isHistoryShownString.length() > 0) && isHistoryShownString.length() > 0)
{ {
isHistoryShown isHistoryShown
= new Boolean(isHistoryShownString) = Boolean.parseBoolean(isHistoryShownString)
.booleanValue(); ;
} }
// Load the "chatHistorySize" property. // Load the "chatHistorySize" property.
@ -245,7 +245,7 @@ public static void loadGuiConfigurations()
&& isTransparentWindowEnabledString.length() > 0) && isTransparentWindowEnabledString.length() > 0)
{ {
isTransparentWindowEnabled isTransparentWindowEnabled
= new Boolean(isTransparentWindowEnabledString).booleanValue(); = Boolean.parseBoolean(isTransparentWindowEnabledString);
} }
// Load the "windowTransparency" property. // Load the "windowTransparency" property.
@ -283,7 +283,7 @@ public static void loadGuiConfigurations()
&& isWindowDecoratedString.length() > 0) && isWindowDecoratedString.length() > 0)
{ {
isWindowDecorated isWindowDecorated
= new Boolean(isWindowDecoratedString).booleanValue(); = Boolean.parseBoolean(isWindowDecoratedString);
} }
// Load the "lastContactParent" property. // Load the "lastContactParent" property.
@ -524,14 +524,14 @@ public static void setShowCallPanel(boolean isCallPanelShown)
/** /**
* Updates the "showApplication" property through the * Updates the "showApplication" property through the
* <tt>ConfigurationService</tt>. * <tt>ConfigurationService</tt>.
* *
* @param isVisible <code>true</code> to indicate that the * @param isVisible <code>true</code> to indicate that the
* application should be shown, <code>false</code> otherwise. * application should be shown, <code>false</code> otherwise.
*/ */
public static void setApplicationVisible(boolean isVisible) public static void setApplicationVisible(boolean isVisible)
{ {
isApplicationVisible = isVisible; isApplicationVisible = isVisible;
configService.setProperty( configService.setProperty(
"net.java.sip.communicator.impl.systray.showApplication", "net.java.sip.communicator.impl.systray.showApplication",
Boolean.toString(isVisible)); Boolean.toString(isVisible));
@ -824,7 +824,7 @@ public static boolean getContactListGroupStatus(String groupID)
String status = (String) configService String status = (String) configService
.getProperty( groupRootPropName + ".isClosed"); .getProperty( groupRootPropName + ".isClosed");
return new Boolean(status).booleanValue(); return Boolean.parseBoolean(status);
} }
} }
@ -845,7 +845,7 @@ else if (evt.getPropertyName().equals(
String autoPopupString = (String) evt.getNewValue(); String autoPopupString = (String) evt.getNewValue();
autoPopupNewMessage autoPopupNewMessage
= new Boolean(autoPopupString).booleanValue(); = Boolean.parseBoolean(autoPopupString);
} }
else if (evt.getPropertyName().equals( else if (evt.getPropertyName().equals(
"service.gui.SEND_MESSAGE_COMMAND")) "service.gui.SEND_MESSAGE_COMMAND"))
@ -859,7 +859,7 @@ else if (evt.getPropertyName().equals(
String showCallPanelString = (String) evt.getNewValue(); String showCallPanelString = (String) evt.getNewValue();
isCallPanelShown isCallPanelShown
= new Boolean(showCallPanelString).booleanValue(); = Boolean.parseBoolean(showCallPanelString);
} }
else if (evt.getPropertyName().equals( else if (evt.getPropertyName().equals(
"net.java.sip.communicator.impl.gui.showOffline")) "net.java.sip.communicator.impl.gui.showOffline"))
@ -867,13 +867,13 @@ else if (evt.getPropertyName().equals(
String showOfflineString = (String) evt.getNewValue(); String showOfflineString = (String) evt.getNewValue();
isShowOffline isShowOffline
= new Boolean(showOfflineString).booleanValue(); = Boolean.parseBoolean(showOfflineString);
} }
else if (evt.getPropertyName().equals( else if (evt.getPropertyName().equals(
"net.java.sip.communicator.impl.systray.showApplication")) "net.java.sip.communicator.impl.systray.showApplication"))
{ {
String showApplicationString = (String) evt.getNewValue(); String showApplicationString = (String) evt.getNewValue();
isApplicationVisible isApplicationVisible
= new Boolean(showApplicationString).booleanValue(); = new Boolean(showApplicationString).booleanValue();
} }
@ -883,7 +883,7 @@ else if (evt.getPropertyName().equals(
String showQuitWarningString = (String) evt.getNewValue(); String showQuitWarningString = (String) evt.getNewValue();
isQuitWarningShown isQuitWarningShown
= new Boolean(showQuitWarningString).booleanValue(); = Boolean.parseBoolean(showQuitWarningString);
} }
else if (evt.getPropertyName().equals( else if (evt.getPropertyName().equals(
"service.gui.SEND_TYPING_NOTIFICATIONS_ENABLED")) "service.gui.SEND_TYPING_NOTIFICATIONS_ENABLED"))
@ -891,7 +891,7 @@ else if (evt.getPropertyName().equals(
String sendTypingNorifString = (String) evt.getNewValue(); String sendTypingNorifString = (String) evt.getNewValue();
isSendTypingNotifications isSendTypingNotifications
= new Boolean(sendTypingNorifString).booleanValue(); = Boolean.parseBoolean(sendTypingNorifString);
} }
else if (evt.getPropertyName().equals( else if (evt.getPropertyName().equals(
"net.java.sip.communicator.impl.gui.isMoveContactConfirmationRequested")) "net.java.sip.communicator.impl.gui.isMoveContactConfirmationRequested"))
@ -899,7 +899,7 @@ else if (evt.getPropertyName().equals(
String moveContactConfirmString = (String) evt.getNewValue(); String moveContactConfirmString = (String) evt.getNewValue();
isMoveContactConfirmationRequested isMoveContactConfirmationRequested
= new Boolean(moveContactConfirmString).booleanValue(); = Boolean.parseBoolean(moveContactConfirmString);
} }
else if (evt.getPropertyName().equals( else if (evt.getPropertyName().equals(
"service.gui.IS_MULTI_CHAT_WINDOW_ENABLED")) "service.gui.IS_MULTI_CHAT_WINDOW_ENABLED"))
@ -907,7 +907,7 @@ else if (evt.getPropertyName().equals(
String multiChatWindowString = (String) evt.getNewValue(); String multiChatWindowString = (String) evt.getNewValue();
isMultiChatWindowEnabled isMultiChatWindowEnabled
= new Boolean(multiChatWindowString).booleanValue(); = Boolean.parseBoolean(multiChatWindowString);
} }
else if (evt.getPropertyName().equals( else if (evt.getPropertyName().equals(
"net.java.sip.communicator.impl.gui.isHistoryLoggingEnabled")) "net.java.sip.communicator.impl.gui.isHistoryLoggingEnabled"))
@ -915,7 +915,7 @@ else if (evt.getPropertyName().equals(
String historyLoggingString = (String) evt.getNewValue(); String historyLoggingString = (String) evt.getNewValue();
isHistoryLoggingEnabled isHistoryLoggingEnabled
= new Boolean(historyLoggingString).booleanValue(); = Boolean.parseBoolean(historyLoggingString);
} }
else if (evt.getPropertyName().equals( else if (evt.getPropertyName().equals(
"service.gui.IS_MESSAGE_HISTORY_SHOWN")) "service.gui.IS_MESSAGE_HISTORY_SHOWN"))
@ -923,7 +923,7 @@ else if (evt.getPropertyName().equals(
String historyShownString = (String) evt.getNewValue(); String historyShownString = (String) evt.getNewValue();
isHistoryShown isHistoryShown
= new Boolean(historyShownString).booleanValue(); = Boolean.parseBoolean(historyShownString);
} }
else if (evt.getPropertyName().equals( else if (evt.getPropertyName().equals(
"service.gui.MESSAGE_HISTORY_SIZE")) "service.gui.MESSAGE_HISTORY_SIZE"))
@ -939,7 +939,7 @@ else if (evt.getPropertyName().equals(
String isTransparentString = (String) evt.getNewValue(); String isTransparentString = (String) evt.getNewValue();
isTransparentWindowEnabled isTransparentWindowEnabled
= new Boolean(isTransparentString).booleanValue(); = Boolean.parseBoolean(isTransparentString);
} }
else if (evt.getPropertyName().equals( else if (evt.getPropertyName().equals(
"impl.gui.WINDOW_TRANSPARENCY")) "impl.gui.WINDOW_TRANSPARENCY"))

@ -115,7 +115,7 @@ public static void fireNotification(String eventType,
if(notificationService == null) if(notificationService == null)
return; return;
notificationService.fireNotification(eventType, messageTitle, message); notificationService.fireNotification(eventType, messageTitle, message, null);
} }
/** /**
@ -148,8 +148,7 @@ public static void fireChatNotification(Object contact,
else if (contact instanceof ChatRoom) else if (contact instanceof ChatRoom)
{ {
// For system rooms we don't want to send notification events. // For system rooms we don't want to send notification events.
if ((contact instanceof ChatRoom) if (((ChatRoom) contact).isSystem())
&& ((ChatRoom) contact).isSystem())
return; return;
chatPanel = GuiActivator.getUIService().getChat((ChatRoom) contact); chatPanel = GuiActivator.getUIService().getChat((ChatRoom) contact);
@ -166,7 +165,8 @@ else if (contact instanceof ChatRoom)
popupActionHandler.setEnabled(false); popupActionHandler.setEnabled(false);
} }
notificationService.fireNotification(eventType, messageTitle, message); notificationService.fireNotification(
eventType, messageTitle, message, contact);
if(popupActionHandler != null) if(popupActionHandler != null)
popupActionHandler.setEnabled(true); popupActionHandler.setEnabled(true);

@ -376,8 +376,13 @@ public void removeNotificationChangeListener(
* @param title the title of the given message * @param title the title of the given message
* @param message the message to use if and where appropriate (e.g. with * @param message the message to use if and where appropriate (e.g. with
* systray or log notification.) * systray or log notification.)
* @param tag additional info to be used by the notification handler
*/ */
public void fireNotification(String eventType, String title, String message) public void fireNotification(
String eventType,
String title,
String message,
Object tag)
{ {
EventNotification notification EventNotification notification
= (EventNotification) notificationsTable.get(eventType); = (EventNotification) notificationsTable.get(eventType);
@ -401,7 +406,7 @@ public void fireNotification(String eventType, String title, String message)
if (actionType.equals(NotificationService.ACTION_POPUP_MESSAGE)) if (actionType.equals(NotificationService.ACTION_POPUP_MESSAGE))
{ {
((PopupMessageNotificationHandler) handler) ((PopupMessageNotificationHandler) handler)
.popupMessage(new PopupMessage(title, message)); .popupMessage(new PopupMessage(title, message, tag));
} }
else if (actionType.equals(NotificationService.ACTION_LOG_MESSAGE)) else if (actionType.equals(NotificationService.ACTION_LOG_MESSAGE))
{ {
@ -431,7 +436,7 @@ else if (actionType.equals(NotificationService.ACTION_COMMAND))
*/ */
public void fireNotification(String eventType) public void fireNotification(String eventType)
{ {
this.fireNotification(eventType, null, null); this.fireNotification(eventType, null, null, null);
} }
/** /**

@ -13,6 +13,7 @@
import javax.swing.*; import javax.swing.*;
import javax.swing.Timer; import javax.swing.Timer;
import net.java.sip.communicator.service.protocol.*;
import net.java.sip.communicator.service.systray.*; import net.java.sip.communicator.service.systray.*;
import net.java.sip.communicator.service.systray.event.*; import net.java.sip.communicator.service.systray.event.*;
import net.java.sip.communicator.util.*; import net.java.sip.communicator.util.*;
@ -36,7 +37,7 @@ public class PopupMessageHandlerSwingImpl implements PopupMessageHandler
/** An icon representing the contact from which the notification comes */ /** An icon representing the contact from which the notification comes */
private ImageIcon defaultIcon = private ImageIcon defaultIcon =
SwingNotificationActivator.getResources().getImage( SwingNotificationActivator.getResources().getImage(
"service.gui.DEFAULT_USER_PHOTO");; "service.gui.SIP_COMMUNICATOR_LOGO_39x58");;
/** /**
* Adds a listerner to receive popup events * Adds a listerner to receive popup events
@ -76,11 +77,9 @@ public void showPopupMessage(PopupMessage popupMessage)
getDefaultConfiguration(); getDefaultConfiguration();
final JWindow notificationWindow = new JWindow(graphicsConf); final JWindow notificationWindow = new JWindow(graphicsConf);
notificationWindow.setPreferredSize(new Dimension(225, 125));
final Timer popupTimer = new Timer(10000, new ActionListener() final Timer popupTimer = new Timer(10000, new ActionListener()
{ {
public void actionPerformed(ActionEvent e) public void actionPerformed(ActionEvent e)
{ {
if (notificationWindow.isVisible()) if (notificationWindow.isVisible())
@ -108,18 +107,27 @@ public void mouseExited(MouseEvent e)
@Override @Override
public void mouseClicked(MouseEvent e) public void mouseClicked(MouseEvent e)
{ {
firePopupMessageClicked(new SystrayPopupMessageEvent(e)); Container container = notificationWindow.getContentPane();
PopupNotificationPanel notif =
(PopupNotificationPanel) container.getComponent(0);
firePopupMessageClicked(
new SystrayPopupMessageEvent(e, notif.getTag()));
notificationWindow.dispose(); notificationWindow.dispose();
} }
}); });
if (popupMessage.getComponent() != null) if (popupMessage.getComponent() != null)
{
notificationWindow.add(popupMessage.getComponent()); notificationWindow.add(popupMessage.getComponent());
}
else else
{
notificationWindow.add(createPopup( notificationWindow.add(createPopup(
popupMessage.getMessageTitle(), popupMessage.getMessageTitle(),
popupMessage.getMessage(), popupMessage.getMessage(),
popupMessage.getIcon())); popupMessage.getTag()));
notificationWindow.setPreferredSize(new Dimension(225, 120));
}
notificationWindow.setAlwaysOnTop(true); notificationWindow.setAlwaysOnTop(true);
notificationWindow.pack(); notificationWindow.pack();
@ -136,38 +144,46 @@ public void mouseClicked(MouseEvent e)
* @return * @return
*/ */
private JComponent createPopup(String title, String message, private JComponent createPopup(String title, String message,
ImageIcon icon) Object tag)
{ {
String msg; String ttle = title;
if (title.length() > 50)
if (message.length() > 70) ttle = title.substring(0, 47) + "...";
msg = "<html><b>" + message.substring(0, 77) + "..."; JLabel msgTitle = new JLabel("<html>" + ttle);
else msgTitle.setForeground(Color.DARK_GRAY);
msg = "<html><b>" + message;
String msg = message;
JLabel msgContent = new JLabel(msg); if (message.length() > 90)
msg = message.substring(0, 87) + "...";
if (title.length() > 40) JLabel msgContent = new JLabel("<html><b>" + msg);
title = title.substring(0, 28) + "...";
JLabel msgFrom = new JLabel(title); JPanel notificationBody = new JPanel(new BorderLayout());
msgFrom.setForeground(Color.DARK_GRAY); notificationBody.setOpaque(false);
notificationBody.add(msgTitle, BorderLayout.NORTH);
JLabel msgIcon = (icon == null) ? notificationBody.add(msgContent, BorderLayout.CENTER);
new JLabel(defaultIcon) :
new JLabel(icon); JLabel msgIcon = new JLabel(defaultIcon);
msgIcon.setOpaque(false); if (tag instanceof Contact)
{
byte[] b = ((Contact) tag).getImage();
if (b != null)
msgIcon = new JLabel(new ImageIcon(b));
}
else if (tag instanceof ImageIcon)
{
msgIcon = new JLabel((ImageIcon) tag);
}
msgIcon.setPreferredSize(new Dimension(45, 45)); msgIcon.setPreferredSize(new Dimension(45, 45));
JPanel notificationContent = new JPanel(new BorderLayout(5, 1)); JPanel notificationContent = new JPanel(new BorderLayout(5, 0));
notificationContent.setBorder( notificationContent.setBorder(
BorderFactory.createEmptyBorder(10, 10, 10, 10)); BorderFactory.createEmptyBorder(0, 3, 3, 3));
notificationContent.setOpaque(false); notificationContent.setOpaque(false);
notificationContent.add(msgFrom, BorderLayout.NORTH);
notificationContent.add(msgContent, BorderLayout.CENTER);
notificationContent.add(msgIcon, BorderLayout.WEST); notificationContent.add(msgIcon, BorderLayout.WEST);
notificationContent.add(notificationBody, BorderLayout.CENTER);
return new PopupNotificationPanel(notificationContent); return new PopupNotificationPanel(notificationContent, tag);
} }
/** /**

@ -6,6 +6,7 @@ Bundle-Version: 0.0.1
System-Bundle: yes System-Bundle: yes
Import-Package: org.osgi.framework, Import-Package: org.osgi.framework,
net.java.sip.communicator.service.configuration, net.java.sip.communicator.service.configuration,
net.java.sip.communicator.service.protocol,
net.java.sip.communicator.service.resources, net.java.sip.communicator.service.resources,
net.java.sip.communicator.service.systray, net.java.sip.communicator.service.systray,
net.java.sip.communicator.service.systray.event, net.java.sip.communicator.service.systray.event,

@ -1,46 +0,0 @@
/*
* SIP Communicator, the OpenSource Java VoIP and Instant Messaging client.
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
*/
package net.java.sip.communicator.impl.systray.jdic;
import java.awt.*;
import java.awt.image.*;
import javax.swing.*;
/**
* An image filter that "disables" an image by turning
* it into a grayscale image, and brightening the pixels
* in the image. Used by buttons to create an image for
* a disabled button. Creates a more brighter image than
* the javax.swing.GrayFilter.
*
* @author Yana Stamcheva
*/
public class LightGrayFilter extends GrayFilter {
/**
* Creates an instance of a LightGrayFilter.
* @param b a boolean -- true if the pixels should be brightened
* @param p an int in the range 0..100 that determines the percentage
* of gray, where 100 is the darkest gray, and 0 is the lightest
*/
public LightGrayFilter(boolean b, int p) {
super(b, p);
}
/**
* Creates a disabled image.
* @param i The source image.
* @return A disabled image based on the source image.
*/
public static Image createDisabledImage(Image i) {
LightGrayFilter filter = new LightGrayFilter(true, 65);
ImageProducer prod = new FilteredImageSource(i.getSource(), filter);
Image grayImage = Toolkit.getDefaultToolkit().createImage(prod);
return grayImage;
}
}

@ -14,6 +14,7 @@
import net.java.sip.communicator.impl.systray.*; import net.java.sip.communicator.impl.systray.*;
import net.java.sip.communicator.service.protocol.*; import net.java.sip.communicator.service.protocol.*;
import net.java.sip.communicator.util.*; import net.java.sip.communicator.util.*;
import net.java.sip.communicator.util.swing.*;
/** /**
* The <tt>StatusSimpleSelector</tt> is a submenu which allow to select a status * The <tt>StatusSimpleSelector</tt> is a submenu which allow to select a status

@ -8,7 +8,6 @@
import org.osgi.framework.*; import org.osgi.framework.*;
import java.awt.Toolkit;
import java.awt.event.*; import java.awt.event.*;
import java.net.*; import java.net.*;
import java.util.*; import java.util.*;
@ -64,11 +63,6 @@ public class SystrayServiceJdicImpl
private final Hashtable<String, PopupMessageHandler> popupHandlerSet = private final Hashtable<String, PopupMessageHandler> popupHandlerSet =
new Hashtable<String, PopupMessageHandler>(); new Hashtable<String, PopupMessageHandler>();
/**
* Stores the system time, when the main window was restored the last time
*/
private long setVisibleTime = 0;
/** /**
* A reference of the <tt>ConfigurationService</tt> obtained from the * A reference of the <tt>ConfigurationService</tt> obtained from the
* <tt>SystrayServiceActivator</tt> * <tt>SystrayServiceActivator</tt>
@ -137,9 +131,7 @@ public SystrayServiceJdicImpl()
UIService ui = SystrayActivator.getUIService(); UIService ui = SystrayActivator.getUIService();
if (ui != null) if (ui != null)
{
ui.setExitOnMainWindowClose(false); ui.setExitOnMainWindowClose(false);
}
} }
} }
@ -148,13 +140,6 @@ public SystrayServiceJdicImpl()
*/ */
private void initSystray() private void initSystray()
{ {
// Get the system's double click speed
Object o = Toolkit.getDefaultToolkit().getDesktopProperty(
"awt.multiClickInterval");
final int doubleClickSpeed = (o instanceof Integer ? ((Integer) o).
intValue() : 500);
menu = TrayMenuFactory.createTrayMenu(this, systray.isSwing()); menu = TrayMenuFactory.createTrayMenu(this, systray.isSwing());
String osName = System.getProperty("os.name"); String osName = System.getProperty("os.name");
@ -222,29 +207,19 @@ else if (osName.startsWith("Mac OS X"))
//Show/hide the contact list when user clicks on the systray. //Show/hide the contact list when user clicks on the systray.
trayIcon.addActionListener(new ActionListener() trayIcon.addActionListener(new ActionListener()
{ {
public void actionPerformed(ActionEvent e) public void actionPerformed(ActionEvent e)
{ {
long currentTime = System.currentTimeMillis();
UIService uiService = SystrayActivator.getUIService(); UIService uiService = SystrayActivator.getUIService();
boolean isVisible = !uiService.isVisible(); ExportedWindow win =
uiService.getExportedWindow(ExportedWindow.MAIN_WINDOW);
if (isVisible) if (!win.isVisible())
{ {
setVisibleTime = currentTime; win.setVisible(true);
} else if (currentTime < (setVisibleTime + doubleClickSpeed)) configService.setProperty(
{ "net.java.sip.communicator.impl.systray.showApplication",
// Do nothing. the last restore is less than 2 seconds, so it is very Boolean.toString(true));
// likely, that the user made a double click. prevent the main window
// from opening and immediately closing again.
return;
} }
win.bringToFront();
uiService.setVisible(isVisible);
configService.setProperty(
"net.java.sip.communicator.impl.systray.showApplication",
Boolean.toString(isVisible));
} }
}); });
@ -288,12 +263,15 @@ public void popupMenuCanceled(PopupMenuEvent e)
}); });
} }
PopupMessageHandler pph = new PopupMessageHandlerTrayIconImpl(trayIcon); PopupMessageHandler pph = null;
popupHandlerSet.put(pph.getClass().getName(), pph); if (!osName.startsWith("Mac OS X"))
SystrayActivator.bundleContext.registerService( {
PopupMessageHandler.class.getName(), pph = new PopupMessageHandlerTrayIconImpl(trayIcon);
pph, null); popupHandlerSet.put(pph.getClass().getName(), pph);
SystrayActivator.bundleContext.registerService(
PopupMessageHandler.class.getName(),
pph, null);
}
try try
{ {
SystrayActivator.bundleContext.addServiceListener( SystrayActivator.bundleContext.addServiceListener(
@ -611,9 +589,12 @@ public void popupMessageClicked(SystrayPopupMessageEvent evt)
UIService uiService = SystrayActivator.getUIService(); UIService uiService = SystrayActivator.getUIService();
ExportedWindow chatWindow = uiService.getExportedWindow( ExportedWindow chatWindow = uiService.getExportedWindow(
ExportedWindow.CHAT_WINDOW); ExportedWindow.CHAT_WINDOW);
if (chatWindow != null && chatWindow.isVisible()) if (chatWindow != null)
{
chatWindow.bringToFront(); chatWindow.bringToFront();
Object o = evt.getTag();
if (o instanceof Contact)
{
// TODO: bring the chat with that contact to front
} }
} }
} }

@ -65,8 +65,7 @@ private void initGUI()
this.setOpaque(false); this.setOpaque(false);
this.mainPanel.setOpaque(false); this.mainPanel.setOpaque(false);
BoxLayout boxLayout = new BoxLayout( BoxLayout boxLayout = new BoxLayout(mainPanel, BoxLayout.Y_AXIS);
mainPanel, javax.swing.BoxLayout.Y_AXIS);
mainPanel.setLayout(boxLayout); mainPanel.setLayout(boxLayout);
this.add(mainPanel, BorderLayout.NORTH); this.add(mainPanel, BorderLayout.NORTH);
@ -101,8 +100,7 @@ private void initGUI()
mainPanel.add(logHistoryPanel); mainPanel.add(logHistoryPanel);
mainPanel.add(Box.createVerticalStrut(10)); mainPanel.add(Box.createVerticalStrut(10));
logHistoryPanel.setLayout(null); logHistoryPanel.setLayout(null);
logHistoryPanel.setPreferredSize( logHistoryPanel.setPreferredSize(new Dimension(380, 57));
new java.awt.Dimension(380, 57));
logHistoryPanel.setAlignmentX(0.0f); logHistoryPanel.setAlignmentX(0.0f);
{ {
logHistoryCheckBox = new SIPCommCheckBox(); logHistoryCheckBox = new SIPCommCheckBox();
@ -174,8 +172,7 @@ public void stateChanged(ChangeEvent e)
mainPanel.add(sendMessagePanel); mainPanel.add(sendMessagePanel);
mainPanel.add(Box.createVerticalStrut(10)); mainPanel.add(Box.createVerticalStrut(10));
sendMessagePanel.setAlignmentX(0.0f); sendMessagePanel.setAlignmentX(0.0f);
sendMessagePanel.setPreferredSize( sendMessagePanel.setPreferredSize(new Dimension(380, 22));
new java.awt.Dimension(380, 22));
{ {
sendMessageLabel = new JLabel(); sendMessageLabel = new JLabel();
sendMessagePanel.add( sendMessagePanel.add(
@ -211,7 +208,7 @@ public void itemStateChanged(ItemEvent arg0)
enableTypingNotifiCheckBox.setText( enableTypingNotifiCheckBox.setText(
Resources.getString("service.gui.ENABLE_TYPING_NOTIFICATIONS")); Resources.getString("service.gui.ENABLE_TYPING_NOTIFICATIONS"));
enableTypingNotifiCheckBox.setPreferredSize( enableTypingNotifiCheckBox.setPreferredSize(
new java.awt.Dimension(253, 20)); new Dimension(253, 20));
enableTypingNotifiCheckBox.setAlignmentY(0.0f); enableTypingNotifiCheckBox.setAlignmentY(0.0f);
enableTypingNotifiCheckBox.addActionListener(this); enableTypingNotifiCheckBox.addActionListener(this);
} }
@ -236,15 +233,13 @@ public void itemStateChanged(ItemEvent arg0)
{ {
logger.warn("Error while retrieving service refs", ex); logger.warn("Error while retrieving service refs", ex);
} }
// user has choice only if there is more than one handler if (handlerRefs != null)
if ((handlerRefs != null) && (handlerRefs.length > 1))
{ {
notifConfigPanel = new JPanel(); notifConfigPanel = new JPanel();
notifConfigPanel.setOpaque(false); notifConfigPanel.setOpaque(false);
notifConfigPanel.setLayout(new BorderLayout(10, 10)); notifConfigPanel.setLayout(new BorderLayout(10, 10));
notifConfigPanel.setAlignmentX(0.0f); notifConfigPanel.setAlignmentX(0.0f);
notifConfigPanel.setPreferredSize( notifConfigPanel.setPreferredSize(new Dimension(380, 22));
new java.awt.Dimension(380, 22));
mainPanel.add(notifConfigPanel); mainPanel.add(notifConfigPanel);
mainPanel.add(Box.createVerticalStrut(10)); mainPanel.add(Box.createVerticalStrut(10));

@ -333,10 +333,12 @@ public void removeNotificationChangeListener(
* (e.g. with systray) * (e.g. with systray)
* @param message the message to use if and where appropriate (e.g. with * @param message the message to use if and where appropriate (e.g. with
* systray or log notification.) * systray or log notification.)
* @param tag additional info to be used by the notification handler
*/ */
public void fireNotification( String eventType, public void fireNotification( String eventType,
String messageTitle, String messageTitle,
String message); String message,
Object tag);
/** /**
* Fires all notifications registered for the specified <tt>eventType</tt> * Fires all notifications registered for the specified <tt>eventType</tt>

@ -35,8 +35,8 @@ public class PopupMessage
/** type of the message */ /** type of the message */
private int messageType; private int messageType;
/** the contact which is the cause of this popup message */ /** additional info to be used by the <tt>PopupMessageHandler</tt> */
private Contact contact; private Object tag;
/** /**
* Creates a <tt>PopupMessage</tt> with the given title and message inside * Creates a <tt>PopupMessage</tt> with the given title and message inside
@ -94,6 +94,21 @@ public PopupMessage(JComponent component, String title, String message)
this.component = component; this.component = component;
} }
/**
* Creates a new <tt>PopupMessage</tt> with the given
* <tt>JComponent</tt> 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 <tt>PopupMessage</tt>
* @param title of the message
* @param tag additional info to be used by the <tt>PopupMessageHandler</tt>
*/
public PopupMessage(String title, String message, Object tag)
{
this(title, message);
this.tag = tag;
}
/** /**
* @return the message * @return the message
*/ */
@ -175,18 +190,18 @@ public void setMessageType(int messageType)
} }
/** /**
* @return the contact * @return the object used to tag this <tt>PopupMessage</tt>
*/ */
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;
} }
} }

@ -17,8 +17,40 @@
public class SystrayPopupMessageEvent public class SystrayPopupMessageEvent
extends EventObject extends EventObject
{ {
/** an object to distinguish this <tt>SystrayPopupMessageEvent</tt> */
private Object tag;
public SystrayPopupMessageEvent(Object source) public SystrayPopupMessageEvent(Object source)
{ {
super(source); super(source);
} }
/**
* Creates a new <tt>SystrayPopupMessageEvent</tt> 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;
}
} }

@ -4,7 +4,7 @@
* Distributable under LGPL license. * Distributable under LGPL license.
* See terms of license at gnu.org. * See terms of license at gnu.org.
*/ */
package net.java.sip.communicator.impl.gui.utils; package net.java.sip.communicator.util.swing;
import java.awt.*; import java.awt.*;
import java.awt.image.*; import java.awt.image.*;
@ -14,9 +14,9 @@
* An image filter that "disables" an image by turning * An image filter that "disables" an image by turning
* it into a grayscale image, and brightening the pixels * it into a grayscale image, and brightening the pixels
* in the image. Used by buttons to create an image for * in the image. Used by buttons to create an image for
* a disabled button. Creates a more brighter image than * a disabled button. Creates a more brighter image than
* the javax.swing.GrayFilter. * the javax.swing.GrayFilter.
* *
* @author Yana Stamcheva * @author Yana Stamcheva
*/ */
public class LightGrayFilter extends GrayFilter { public class LightGrayFilter extends GrayFilter {

@ -23,6 +23,9 @@ public class PopupNotificationPanel extends SIPCommFrame.MainContentPane
/** logger for this class */ /** logger for this class */
private final Logger logger = Logger.getLogger(SIPCommFrame.class); private final Logger logger = Logger.getLogger(SIPCommFrame.class);
/** an object to distinguish this <tt>PopupNotificationPanel</tt> */
private Object tag;
/** /**
* Creates a new <tt>PopupNotificationPanel</tt> with a customized panel title * Creates a new <tt>PopupNotificationPanel</tt> with a customized panel title
*/ */
@ -35,15 +38,20 @@ private PopupNotificationPanel()
"service.gui.SIP_COMMUNICATOR_LOGO"), "service.gui.SIP_COMMUNICATOR_LOGO"),
SwingConstants.LEFT); SwingConstants.LEFT);
final JLabel notifClose = new JLabel( // JLabel notifClose = new JLabel(
// UtilActivator.getResources()
// .getImage("service.gui.lookandfeel.CLOSE_TAB_ICON"));
final SIPCommButton notifClose = new SIPCommButton(
UtilActivator.getResources() UtilActivator.getResources()
.getImage("service.gui.lookandfeel.CLOSE_TAB_ICON")); .getImage("service.gui.lookandfeel.CLOSE_TAB_ICON").getImage());
notifClose.setToolTipText(UtilActivator.getResources() notifClose.setToolTipText(UtilActivator.getResources()
.getI18NString("service.gui.CLOSE")); .getI18NString("service.gui.CLOSE"));
//notifClose.
notifClose.addMouseListener(new MouseAdapter() notifClose.addActionListener(new ActionListener()
{ {
@Override //@Override
public void mouseClicked(MouseEvent e) public void mouseClicked(MouseEvent e)
{ {
try try
@ -63,22 +71,40 @@ public void mouseClicked(MouseEvent e)
, ex); , ex);
} }
} }
});
BorderLayout borderLayout = new BorderLayout(); public void actionPerformed(ActionEvent e)
borderLayout.setVgap(5); {
try
{
// TODO : that is pretty ugly. It will be nice if
// it is possible to reach the top window in a better way
JWindow jw = (JWindow) notifClose
.getParent().getParent().getParent()
.getParent().getParent().getParent();
jw.dispose();
}
catch (Exception ex)
{
// should never happens : if the user clicks on the close
// icon, it means that the popup window were visible
logger.warn("error while getting the popup window :"
, ex);
}
}
});
JPanel notificationWindowTitle = new JPanel(borderLayout); JPanel notificationWindowTitle =
new JPanel(new BorderLayout(0, 2));
notificationWindowTitle notificationWindowTitle
.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); .setBorder(BorderFactory.createEmptyBorder(3, 3, 3, 3));
notificationWindowTitle.setOpaque(false); notificationWindowTitle.setOpaque(false);
notificationWindowTitle.add(notifTitle, BorderLayout.WEST); notificationWindowTitle.add(notifTitle, BorderLayout.WEST);
notificationWindowTitle.add(notifClose, BorderLayout.EAST); notificationWindowTitle.add(notifClose, BorderLayout.EAST);
JSeparator jSep = new JSeparator(); JSeparator jSep = new JSeparator();
notificationWindowTitle.add(jSep, BorderLayout.SOUTH); notificationWindowTitle.add(jSep, BorderLayout.SOUTH);
add(notificationWindowTitle, BorderLayout.NORTH); add(notificationWindowTitle, BorderLayout.NORTH);
setBorder(BorderFactory.createLineBorder(Color.GRAY)); setBorder(BorderFactory.createLineBorder(Color.GRAY));
} }
@ -89,10 +115,28 @@ public void mouseClicked(MouseEvent e)
* *
* @param notificationContent content to add in the new created * @param notificationContent content to add in the new created
* <tt>PopupNotificationPanel</tt> * <tt>PopupNotificationPanel</tt>
* @param tag an object to distinguish this <tt>PopupNotificationPanel</tt>
*/ */
public PopupNotificationPanel(JPanel notificationContent) public PopupNotificationPanel(JPanel notificationContent, Object tag)
{ {
this(); this();
add(notificationContent, BorderLayout.CENTER); add(notificationContent, BorderLayout.CENTER);
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;
} }
} }

@ -4,7 +4,7 @@
* Distributable under LGPL license. * Distributable under LGPL license.
* See terms of license at gnu.org. * See terms of license at gnu.org.
*/ */
package net.java.sip.communicator.impl.gui.customcontrols; package net.java.sip.communicator.util.swing;
import java.awt.*; import java.awt.*;
import java.awt.event.*; import java.awt.event.*;
@ -13,13 +13,10 @@
import org.jvnet.lafwidget.animation.*; import org.jvnet.lafwidget.animation.*;
import net.java.sip.communicator.impl.gui.utils.*;
import net.java.sip.communicator.util.swing.*;
/** /**
* The <tt>SIPCommButton</tt> is a very flexible <tt>JButton</tt> that allows * The <tt>SIPCommButton</tt> is a very flexible <tt>JButton</tt> that allows
* to configure its background, its icon, the look when a mouse is over it, etc. * to configure its background, its icon, the look when a mouse is over it, etc.
* *
* @author Yana Stamcheva * @author Yana Stamcheva
*/ */
public class SIPCommButton public class SIPCommButton
@ -33,7 +30,7 @@ public class SIPCommButton
/** /**
* Creates a button with custom background image and icon image. * Creates a button with custom background image and icon image.
* *
* @param bgImage The background image. * @param bgImage The background image.
* @param pressedImage The pressed image. * @param pressedImage The pressed image.
* @param iconImage The icon. * @param iconImage The icon.
@ -69,7 +66,7 @@ public SIPCommButton( Image bgImage,
/** /**
* Creates a button with custom background image. * Creates a button with custom background image.
* *
* @param bgImage The background button image. * @param bgImage The background button image.
*/ */
public SIPCommButton( Image bgImage, public SIPCommButton( Image bgImage,
@ -80,7 +77,7 @@ public SIPCommButton( Image bgImage,
/** /**
* Creates a button with custom background image. * Creates a button with custom background image.
* *
* @param bgImage The background button image. * @param bgImage The background button image.
*/ */
public SIPCommButton(Image bgImage) public SIPCommButton(Image bgImage)
@ -90,7 +87,7 @@ public SIPCommButton(Image bgImage)
/** /**
* Resets the background image for this button. * Resets the background image for this button.
* *
* @param bgImage the new image to set. * @param bgImage the new image to set.
*/ */
public void setImage(Image bgImage) public void setImage(Image bgImage)
@ -104,7 +101,7 @@ public void setImage(Image bgImage)
* Overrides the <code>paintComponent</code> method of <tt>JButton</tt> to * Overrides the <code>paintComponent</code> method of <tt>JButton</tt> to
* paint the button background and icon, and all additional effects of this * paint the button background and icon, and all additional effects of this
* configurable button. * configurable button.
* *
* @param g The Graphics object. * @param g The Graphics object.
*/ */
protected void paintComponent(Graphics g) protected void paintComponent(Graphics g)
@ -219,7 +216,7 @@ else if (isContentAreaFilled() || (visibility != 0.0f))
/** /**
* Returns the background image of this button. * Returns the background image of this button.
* *
* @return the background image of this button. * @return the background image of this button.
*/ */
public Image getBackgroundImage() public Image getBackgroundImage()
@ -229,7 +226,7 @@ public Image getBackgroundImage()
/** /**
* Sets the background image of this button. * Sets the background image of this button.
* *
* @param bgImage the background image of this button. * @param bgImage the background image of this button.
*/ */
public void setBackgroundImage(Image bgImage) public void setBackgroundImage(Image bgImage)

@ -4,23 +4,20 @@
* Distributable under LGPL license. * Distributable under LGPL license.
* See terms of license at gnu.org. * See terms of license at gnu.org.
*/ */
package net.java.sip.communicator.impl.gui.customcontrols; package net.java.sip.communicator.util.swing;
import java.awt.*; import java.awt.*;
import java.awt.event.*; import java.awt.event.*;
import javax.swing.*; import javax.swing.*;
import net.java.sip.communicator.impl.gui.utils.*;
import net.java.sip.communicator.util.swing.*;
import org.jvnet.lafwidget.animation.*; import org.jvnet.lafwidget.animation.*;
/** /**
* The <tt>SIPCommToggleButton</tt> is a flexible <tt>JToggleButton</tt> that * The <tt>SIPCommToggleButton</tt> is a flexible <tt>JToggleButton</tt> that
* allows to configure its background, its icon, the look when a mouse is over * allows to configure its background, its icon, the look when a mouse is over
* it, etc. * it, etc.
* *
* @author Yana Stamcheva * @author Yana Stamcheva
*/ */
public class SIPCommToggleButton public class SIPCommToggleButton
@ -49,14 +46,14 @@ public SIPCommToggleButton()
/** /**
* Creates a button with custom background image, rollover image and * Creates a button with custom background image, rollover image and
* icon image. * icon image.
* *
* @param bgImage The background image. * @param bgImage The background image.
* @param rolloverImage The roll over image. * @param rolloverImage The roll over image.
* @param iconImage The icon. * @param iconImage The icon.
* @param pressedImage The image used to paint the pressed state. * @param pressedImage The image used to paint the pressed state.
*/ */
public SIPCommToggleButton( Image bgImage, public SIPCommToggleButton( Image bgImage,
Image rolloverImage, Image rolloverImage,
Image iconImage, Image iconImage,
Image pressedImage) Image pressedImage)
{ {
@ -77,7 +74,7 @@ public SIPCommToggleButton( Image bgImage,
/** /**
* Creates a button with custom background image and rollover image. * Creates a button with custom background image and rollover image.
* *
* @param bgImage The background button image. * @param bgImage The background button image.
* @param rolloverImage The rollover button image. * @param rolloverImage The rollover button image.
*/ */
@ -90,10 +87,10 @@ public SIPCommToggleButton(Image bgImage, Image rolloverImage)
* Overrides the <code>paintComponent</code> method of <tt>JButton</tt> * Overrides the <code>paintComponent</code> method of <tt>JButton</tt>
* to paint the button background and icon, and all additional effects * to paint the button background and icon, and all additional effects
* of this configurable button. * of this configurable button.
* *
* @param g The Graphics object. * @param g The Graphics object.
*/ */
public void paintComponent(Graphics g) public void paintComponent(Graphics g)
{ {
g = g.create(); g = g.create();
@ -109,7 +106,7 @@ public void paintComponent(Graphics g)
/** /**
* Paints this button. * Paints this button.
* *
* @param g The Graphics object. * @param g The Graphics object.
*/ */
private void internalPaintComponent(Graphics g) private void internalPaintComponent(Graphics g)
@ -249,10 +246,10 @@ public void setIconImage(Image iconImage)
this.iconImage = iconImage; this.iconImage = iconImage;
this.repaint(); this.repaint();
} }
/** /**
* Sets the image representing the pressed state of this button. * Sets the image representing the pressed state of this button.
* *
* @param pressedImage The image representing the pressed state of this * @param pressedImage The image representing the pressed state of this
* button. * button.
*/ */

@ -128,7 +128,8 @@ public void testNotificationHandling()
notificationService.fireNotification( notificationService.fireNotification(
NotificationService.ACTION_POPUP_MESSAGE, NotificationService.ACTION_POPUP_MESSAGE,
messageStart, messageStart,
messageStart); messageStart,
null);
} }
/** A trivial handler implementing <tt>PopupMessageHandler</tt> */ /** A trivial handler implementing <tt>PopupMessageHandler</tt> */

Loading…
Cancel
Save