diff options
Diffstat (limited to 'src/net/java/sip/communicator/impl')
28 files changed, 122 insertions, 897 deletions
diff --git a/src/net/java/sip/communicator/impl/gui/customcontrols/ChatToolbarButton.java b/src/net/java/sip/communicator/impl/gui/customcontrols/ChatToolbarButton.java index 319f800..0f3297b 100644 --- a/src/net/java/sip/communicator/impl/gui/customcontrols/ChatToolbarButton.java +++ b/src/net/java/sip/communicator/impl/gui/customcontrols/ChatToolbarButton.java @@ -7,6 +7,7 @@ package net.java.sip.communicator.impl.gui.customcontrols; import java.awt.*; +import net.java.sip.communicator.util.swing.*; /** * The <tt>MsgToolbarButton</tt> is a <tt>SIPCommButton</tt> that has diff --git a/src/net/java/sip/communicator/impl/gui/customcontrols/SIPCommButton.java b/src/net/java/sip/communicator/impl/gui/customcontrols/SIPCommButton.java deleted file mode 100755 index 6ec3199..0000000 --- a/src/net/java/sip/communicator/impl/gui/customcontrols/SIPCommButton.java +++ /dev/null @@ -1,329 +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.gui.customcontrols; - -import java.awt.*; -import java.awt.event.*; - -import javax.swing.*; - -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 - * to configure its background, its icon, the look when a mouse is over it, etc. - * - * @author Yana Stamcheva - */ -public class SIPCommButton - extends JButton -{ - private Image bgImage; - - private final Image pressedImage; - - private final Image iconImage; - - /** - * Creates a button with custom background image and icon image. - * - * @param bgImage The background image. - * @param pressedImage The pressed image. - * @param iconImage The icon. - */ - public SIPCommButton( Image bgImage, - Image pressedImage, - Image iconImage) - { - MouseRolloverHandler mouseHandler = new MouseRolloverHandler(); - - this.addMouseListener(mouseHandler); - this.addMouseMotionListener(mouseHandler); - - /* - * Explicitly remove all borders that may be set from the current look - * and feel. - */ - this.setBorder(null); - this.setContentAreaFilled(false); - - this.bgImage = bgImage; - this.pressedImage = pressedImage; - this.iconImage = iconImage; - - if (bgImage != null) - { - this.setPreferredSize(new Dimension(bgImage.getWidth(null), - bgImage.getHeight(null))); - - this.setIcon(new ImageIcon(this.bgImage)); - } - } - - /** - * Creates a button with custom background image. - * - * @param bgImage The background button image. - */ - public SIPCommButton( Image bgImage, - Image iconImage) - { - this(bgImage, null, iconImage); - } - - /** - * Creates a button with custom background image. - * - * @param bgImage The background button image. - */ - public SIPCommButton(Image bgImage) - { - this(bgImage, null); - } - - /** - * Resets the background image for this button. - * - * @param bgImage the new image to set. - */ - public void setImage(Image bgImage) - { - this.bgImage = bgImage; - - this.repaint(); - } - - /** - * Overrides the <code>paintComponent</code> method of <tt>JButton</tt> to - * paint the button background and icon, and all additional effects of this - * configurable button. - * - * @param g The Graphics object. - */ - protected void paintComponent(Graphics g) - { - g = g.create(); - try - { - internalPaintComponent(g); - } - finally - { - g.dispose(); - } - } - - private void internalPaintComponent(Graphics g) - { - AntialiasingManager.activateAntialiasing(g); - - /* - * As JComponent#paintComponent says, if you do not invoke super's - * implementation you must honor the opaque property, that is if this - * component is opaque, you must completely fill in the background in a - * non-opaque color. If you do not honor the opaque property you will - * likely see visual artifacts. - */ - if (isOpaque()) - { - g.setColor(getBackground()); - g.fillRect(0, 0, getWidth(), getHeight()); - } - - if (this.bgImage != null) - { - // If there's no icon, we make grey the backgroundImage - // when disabled. - Image paintBgImage; - if (this.iconImage == null && !isEnabled()) - { - paintBgImage = new ImageIcon(LightGrayFilter - .createDisabledImage(bgImage)).getImage(); - } - else - paintBgImage = bgImage; - - g.drawImage(paintBgImage, - this.getWidth()/2 - this.bgImage.getWidth(null)/2, - this.getHeight()/2 - this.bgImage.getHeight(null)/2, - this); - } - - // Paint pressed state. - if (this.getModel().isPressed()) - { - if (this.pressedImage != null) - { - g.drawImage(this.pressedImage, 0, 0, this); - } - else if (this.iconImage != null) - { - g.drawImage(this.iconImage, - this.getWidth()/2 - this.iconImage.getWidth(null)/2 + 1, - this.getHeight()/2 - this.iconImage.getHeight(null)/2 + 1, - this); - } - } - - // Paint a roll over fade out. - FadeTracker fadeTracker = FadeTracker.getInstance(); - - float visibility = this.getModel().isRollover() ? 1.0f : 0.0f; - if (fadeTracker.isTracked(this, FadeKind.ROLLOVER)) - { - visibility = fadeTracker.getFade(this, FadeKind.ROLLOVER); - } - - visibility /= 2; - - g.setColor(new Color(1.0f, 1.0f, 1.0f, visibility)); - - if (this.bgImage != null) - { - g.fillRoundRect( - this.getWidth() / 2 - this.bgImage.getWidth(null) / 2, - this.getHeight() / 2 - this.bgImage.getHeight(null) / 2, - bgImage.getWidth(null), - bgImage.getHeight(null), - 10, 10); - } - else if (isContentAreaFilled() || (visibility != 0.0f)) - { - g.fillRoundRect(0, 0, this.getWidth(), this.getHeight(), 10, 10); - } - - if (this.iconImage != null) - { - Image paintIconImage; - if (!isEnabled()) - { - paintIconImage = new ImageIcon(LightGrayFilter - .createDisabledImage(iconImage)).getImage(); - } - else - paintIconImage = iconImage; - - g.drawImage(paintIconImage, - this.getWidth()/2 - this.iconImage.getWidth(null)/2, - this.getHeight()/2 - this.iconImage.getHeight(null)/2, - this); - } - } - - /** - * Returns the background image of this button. - * - * @return the background image of this button. - */ - public Image getBackgroundImage() - { - return bgImage; - } - - /** - * Sets the background image of this button. - * - * @param bgImage the background image of this button. - */ - public void setBackgroundImage(Image bgImage) - { - this.bgImage = bgImage; - } - - /** - * The <tt>ButtonRepaintCallback</tt> is charged to repaint this button - * when the fade animation is performed. - */ - private class ButtonRepaintCallback implements FadeTrackerCallback - { - public void fadeEnded(FadeKind arg0) - { - repaintLater(); - } - - public void fadePerformed(FadeKind arg0, float arg1) - { - repaintLater(); - } - - private void repaintLater() - { - SwingUtilities.invokeLater(new Runnable() - { - public void run() - { - SIPCommButton.this.repaint(); - } - }); - } - - public void fadeReversed(FadeKind arg0, boolean arg1, float arg2) - { - } - } - - /** - * Perform a fade animation on mouse over. - */ - private class MouseRolloverHandler - implements MouseListener, - MouseMotionListener - { - public void mouseMoved(MouseEvent e) - { - } - - public void mouseExited(MouseEvent e) - { - if (isEnabled()) - { - getModel().setRollover(false); - - FadeTracker fadeTracker = FadeTracker.getInstance(); - - fadeTracker.trackFadeOut(FadeKind.ROLLOVER, - SIPCommButton.this, - true, - new ButtonRepaintCallback()); - } - } - - public void mouseClicked(MouseEvent e) - { - } - - public void mouseEntered(MouseEvent e) - { - if (isEnabled()) - { - getModel().setRollover(true); - - FadeTracker fadeTracker = FadeTracker.getInstance(); - - fadeTracker.trackFadeIn(FadeKind.ROLLOVER, - SIPCommButton.this, - true, - new ButtonRepaintCallback()); - } - } - - public void mousePressed(MouseEvent e) - { - } - - public void mouseReleased(MouseEvent e) - { - } - - public void mouseDragged(MouseEvent e) - { - } - } -} diff --git a/src/net/java/sip/communicator/impl/gui/customcontrols/SIPCommToggleButton.java b/src/net/java/sip/communicator/impl/gui/customcontrols/SIPCommToggleButton.java deleted file mode 100644 index 823822b..0000000 --- a/src/net/java/sip/communicator/impl/gui/customcontrols/SIPCommToggleButton.java +++ /dev/null @@ -1,354 +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.gui.customcontrols; - -import java.awt.*; -import java.awt.event.*; - -import javax.swing.*; - -import net.java.sip.communicator.impl.gui.utils.*; -import net.java.sip.communicator.util.swing.*; - -import org.jvnet.lafwidget.animation.*; - -/** - * 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 - * it, etc. - * - * @author Yana Stamcheva - */ -public class SIPCommToggleButton - extends JToggleButton -{ - private Image bgImage; - - private Image bgRolloverImage; - - private Image iconImage; - - private Image pressedImage; - - public SIPCommToggleButton() - { - // Explicitly remove all borders that may be set from the current - // look and feel. - this.setBorder(null); - - MouseRolloverHandler mouseHandler = new MouseRolloverHandler(); - - this.addMouseListener(mouseHandler); - this.addMouseMotionListener(mouseHandler); - } - - /** - * Creates a button with custom background image, rollover image and - * icon image. - * - * @param bgImage The background image. - * @param rolloverImage The roll over image. - * @param iconImage The icon. - * @param pressedImage The image used to paint the pressed state. - */ - public SIPCommToggleButton( Image bgImage, - Image rolloverImage, - Image iconImage, - Image pressedImage) - { - this(); - - this.bgImage = bgImage; - this.bgRolloverImage = rolloverImage; - this.iconImage = iconImage; - this.pressedImage = pressedImage; - - this.setPreferredSize( - new Dimension( this.bgImage.getWidth(null), - this.bgImage.getHeight(null))); - - if (iconImage != null) - this.setIcon(new ImageIcon(this.iconImage)); - } - - /** - * Creates a button with custom background image and rollover image. - * - * @param bgImage The background button image. - * @param rolloverImage The rollover button image. - */ - public SIPCommToggleButton(Image bgImage, Image rolloverImage) - { - this(bgImage, rolloverImage, null, null); - } - - /** - * Overrides the <code>paintComponent</code> method of <tt>JButton</tt> - * to paint the button background and icon, and all additional effects - * of this configurable button. - * - * @param g The Graphics object. - */ - - public void paintComponent(Graphics g) - { - g = g.create(); - try - { - internalPaintComponent(g); - } - finally - { - g.dispose(); - } - } - - /** - * Paints this button. - * - * @param g The Graphics object. - */ - private void internalPaintComponent(Graphics g) - { - AntialiasingManager.activateAntialiasing(g); - - if (this.bgImage != null) - { - // If there's no icon, we make grey the backgroundImage - // when disabled. - if (this.iconImage == null && !isEnabled()) - { - Image disabledImage = new ImageIcon(LightGrayFilter - .createDisabledImage(bgImage)).getImage(); - - g.drawImage(disabledImage, 0, 0, this); - } - else { - g.drawImage(this.bgImage, 0, 0, this); - } - } - - // Paint the roll over image. - if (this.getModel().isRollover() && this.bgRolloverImage != null) - { - g.drawImage(this.bgRolloverImage, 0, 0, this); - } - - // Paint the pressed image. - if (this.getModel().isSelected() && this.pressedImage != null) - { - g.drawImage(this.pressedImage, 0, 0, this); - } - - // Paint a roll over fade out. - FadeTracker fadeTracker = FadeTracker.getInstance(); - - float visibility = this.getModel().isRollover() ? 1.0f : 0.0f; - if (fadeTracker.isTracked(this, FadeKind.ROLLOVER)) - { - visibility = fadeTracker.getFade(this, FadeKind.ROLLOVER); - } - visibility /= 2; - - g.setColor(new Color(1.0f, 1.0f, 1.0f, visibility)); - - if (this.bgImage != null) - { - g.fillRoundRect(this.getWidth() / 2 - this.bgImage.getWidth(null) - / 2, this.getHeight() / 2 - this.bgImage.getHeight(null) / 2, - bgImage.getWidth(null), bgImage.getHeight(null), 10, 10); - } - else if (isContentAreaFilled() || (visibility != 0.0f)) - { - g.fillRoundRect(0, 0, this.getWidth(), this.getHeight(), 10, 10); - } - - // Paint the icon image. - if (this.iconImage != null) - { - if (!isEnabled()) - { - Image disabledImage = new ImageIcon(LightGrayFilter - .createDisabledImage(iconImage)).getImage(); - - g.drawImage(disabledImage, - (this.bgImage.getWidth(null) - disabledImage - .getWidth(null)) / 2, (this.bgImage - .getHeight(null) - disabledImage - .getHeight(null)) / 2, this); - } - else - { - g.drawImage(this.iconImage, - (this.bgImage.getWidth(null) - this.iconImage - .getWidth(null)) / 2, (this.bgImage - .getHeight(null) - this.iconImage - .getHeight(null)) / 2, this); - } - } - } - - /** - * Returns the background image of this button. - * @return the background image of this button. - */ - public Image getBgImage() - { - return bgImage; - } - - /** - * Sets the background image to this button. - * @param bgImage The background image to set. - */ - public void setBgImage(Image bgImage) - { - this.bgImage = bgImage; - - this.setPreferredSize(new Dimension(this.bgImage.getWidth(null), - this.bgImage.getHeight(null))); - } - - /** - * Returns the background rollover image of this button. - * @return the background rollover image of this button. - */ - public Image getBgRolloverImage() - { - return bgRolloverImage; - } - - /** - * Sets the background rollover image to this button. - * @param bgRolloverImage The background rollover image to set. - */ - public void setBgRolloverImage(Image bgRolloverImage) - { - this.bgRolloverImage = bgRolloverImage; - } - - /** - * Returns the icon image of this button. - * @return the icon image of this button. - */ - public Image getIconImage() - { - return iconImage; - } - - /** - * Sets the icon image to this button. - * @param iconImage The icon image to set. - */ - public void setIconImage(Image iconImage) - { - this.iconImage = iconImage; - this.repaint(); - } - - /** - * Sets the image representing the pressed state of this button. - * - * @param pressedImage The image representing the pressed state of this - * button. - */ - public void setPressedImage(Image pressedImage) - { - this.pressedImage = pressedImage; - this.repaint(); - } - - /** - * The <tt>ButtonRepaintCallback</tt> is charged to repaint this button - * when the fade animation is performed. - */ - private class ButtonRepaintCallback implements FadeTrackerCallback - { - public void fadeEnded(FadeKind arg0) - { - repaintLater(); - } - - public void fadePerformed(FadeKind arg0, float arg1) - { - repaintLater(); - } - - private void repaintLater() - { - SwingUtilities.invokeLater(new Runnable() - { - public void run() - { - SIPCommToggleButton.this.repaint(); - } - }); - } - - public void fadeReversed(FadeKind arg0, boolean arg1, float arg2) - { - } - } - - /** - * Perform a fade animation on mouse over. - */ - private class MouseRolloverHandler - implements MouseListener, - MouseMotionListener - { - public void mouseMoved(MouseEvent e) - { - } - - public void mouseExited(MouseEvent e) - { - if (isEnabled()) - { - getModel().setRollover(false); - - FadeTracker fadeTracker = FadeTracker.getInstance(); - - fadeTracker.trackFadeOut(FadeKind.ROLLOVER, - SIPCommToggleButton.this, - true, - new ButtonRepaintCallback()); - } - } - - public void mouseClicked(MouseEvent e) - { - } - - public void mouseEntered(MouseEvent e) - { - if (isEnabled()) - { - getModel().setRollover(true); - - FadeTracker fadeTracker = FadeTracker.getInstance(); - - fadeTracker.trackFadeIn(FadeKind.ROLLOVER, - SIPCommToggleButton.this, - true, - new ButtonRepaintCallback()); - } - } - - public void mousePressed(MouseEvent e) - { - } - - public void mouseReleased(MouseEvent e) - { - } - - public void mouseDragged(MouseEvent e) - { - } - } -} diff --git a/src/net/java/sip/communicator/impl/gui/lookandfeel/SIPCommLookAndFeel.java b/src/net/java/sip/communicator/impl/gui/lookandfeel/SIPCommLookAndFeel.java index 1d9cf3c..f2a453e 100644 --- a/src/net/java/sip/communicator/impl/gui/lookandfeel/SIPCommLookAndFeel.java +++ b/src/net/java/sip/communicator/impl/gui/lookandfeel/SIPCommLookAndFeel.java @@ -9,8 +9,7 @@ package net.java.sip.communicator.impl.gui.lookandfeel; import javax.swing.*; import javax.swing.plaf.*; import javax.swing.plaf.metal.*; - -import net.java.sip.communicator.impl.gui.utils.*; +import net.java.sip.communicator.util.swing.*; /** * The default SIP-Communicator look&feel. diff --git a/src/net/java/sip/communicator/impl/gui/lookandfeel/SIPCommTextFieldUI.java b/src/net/java/sip/communicator/impl/gui/lookandfeel/SIPCommTextFieldUI.java index 2fbf4b4..616689b 100644 --- a/src/net/java/sip/communicator/impl/gui/lookandfeel/SIPCommTextFieldUI.java +++ b/src/net/java/sip/communicator/impl/gui/lookandfeel/SIPCommTextFieldUI.java @@ -13,7 +13,6 @@ import javax.swing.plaf.*; import javax.swing.plaf.metal.*; 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.util.swing.*; diff --git a/src/net/java/sip/communicator/impl/gui/main/call/CallDialog.java b/src/net/java/sip/communicator/impl/gui/main/call/CallDialog.java index d23f56d..43bebab 100644 --- a/src/net/java/sip/communicator/impl/gui/main/call/CallDialog.java +++ b/src/net/java/sip/communicator/impl/gui/main/call/CallDialog.java @@ -14,7 +14,6 @@ import javax.swing.*; import javax.swing.border.*;
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.service.protocol.*;
import net.java.sip.communicator.util.swing.*;
diff --git a/src/net/java/sip/communicator/impl/gui/main/call/CallManager.java b/src/net/java/sip/communicator/impl/gui/main/call/CallManager.java index 2af9286..a042a37 100644 --- a/src/net/java/sip/communicator/impl/gui/main/call/CallManager.java +++ b/src/net/java/sip/communicator/impl/gui/main/call/CallManager.java @@ -57,8 +57,7 @@ public class CallManager // FIXME: I18N NotificationManager.fireNotification( NotificationManager.INCOMING_CALL, - GuiActivator.getResources().getSettingsString( - "service.gui.APPLICATION_NAME"), + "", "Incoming call received from: " + sourceCall.getCallParticipants().next()); } diff --git a/src/net/java/sip/communicator/impl/gui/main/call/CallParticipantPanel.java b/src/net/java/sip/communicator/impl/gui/main/call/CallParticipantPanel.java index 2e66bd0..36342e4 100644 --- a/src/net/java/sip/communicator/impl/gui/main/call/CallParticipantPanel.java +++ b/src/net/java/sip/communicator/impl/gui/main/call/CallParticipantPanel.java @@ -14,7 +14,6 @@ import javax.swing.*; import javax.swing.Timer; 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.service.protocol.*; import net.java.sip.communicator.service.protocol.event.*; diff --git a/src/net/java/sip/communicator/impl/gui/main/call/DialPanel.java b/src/net/java/sip/communicator/impl/gui/main/call/DialPanel.java index 2e3e151..d4ff3e1 100755 --- a/src/net/java/sip/communicator/impl/gui/main/call/DialPanel.java +++ b/src/net/java/sip/communicator/impl/gui/main/call/DialPanel.java @@ -15,12 +15,12 @@ import javax.swing.*; import javax.swing.Timer; 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.service.audionotifier.*; import net.java.sip.communicator.service.protocol.*; import net.java.sip.communicator.service.resources.*; 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 diff --git a/src/net/java/sip/communicator/impl/gui/main/call/HoldButton.java b/src/net/java/sip/communicator/impl/gui/main/call/HoldButton.java index fce4b8f..0402bef 100644 --- a/src/net/java/sip/communicator/impl/gui/main/call/HoldButton.java +++ b/src/net/java/sip/communicator/impl/gui/main/call/HoldButton.java @@ -10,9 +10,9 @@ import java.awt.event.*; import java.util.*; 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.service.protocol.*; +import net.java.sip.communicator.util.swing.*; /** * Represents an UI means to put an associated <tt>CallPariticant</tt> on/off diff --git a/src/net/java/sip/communicator/impl/gui/main/call/MuteButton.java b/src/net/java/sip/communicator/impl/gui/main/call/MuteButton.java index 88660c6..1d1fa53 100644 --- a/src/net/java/sip/communicator/impl/gui/main/call/MuteButton.java +++ b/src/net/java/sip/communicator/impl/gui/main/call/MuteButton.java @@ -10,9 +10,9 @@ import java.awt.event.*; import java.util.*; 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.service.protocol.*; +import net.java.sip.communicator.util.swing.*; /** * Represents an UI means to mute the audio stream sent to an associated diff --git a/src/net/java/sip/communicator/impl/gui/main/call/ReceivedCallDialog.java b/src/net/java/sip/communicator/impl/gui/main/call/ReceivedCallDialog.java index 2bfdd29..6177230 100644 --- a/src/net/java/sip/communicator/impl/gui/main/call/ReceivedCallDialog.java +++ b/src/net/java/sip/communicator/impl/gui/main/call/ReceivedCallDialog.java @@ -13,7 +13,6 @@ import java.util.*; import javax.swing.*; 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.service.contactlist.*; import net.java.sip.communicator.service.protocol.*; diff --git a/src/net/java/sip/communicator/impl/gui/main/call/SecurityPanel.java b/src/net/java/sip/communicator/impl/gui/main/call/SecurityPanel.java index e93c469..057976e 100755 --- a/src/net/java/sip/communicator/impl/gui/main/call/SecurityPanel.java +++ b/src/net/java/sip/communicator/impl/gui/main/call/SecurityPanel.java @@ -12,7 +12,6 @@ import java.awt.event.*; import javax.swing.*; 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.service.notification.*; import net.java.sip.communicator.service.protocol.*; diff --git a/src/net/java/sip/communicator/impl/gui/main/call/TransferCallButton.java b/src/net/java/sip/communicator/impl/gui/main/call/TransferCallButton.java index aea3805..932be47 100644 --- a/src/net/java/sip/communicator/impl/gui/main/call/TransferCallButton.java +++ b/src/net/java/sip/communicator/impl/gui/main/call/TransferCallButton.java @@ -13,11 +13,11 @@ import java.util.*; import org.osgi.framework.*; 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.service.protocol.*; import net.java.sip.communicator.service.protocol.event.*; 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 diff --git a/src/net/java/sip/communicator/impl/gui/main/chat/ChatConversationPanel.java b/src/net/java/sip/communicator/impl/gui/main/chat/ChatConversationPanel.java index 55c0eff..39fefc0 100755 --- a/src/net/java/sip/communicator/impl/gui/main/chat/ChatConversationPanel.java +++ b/src/net/java/sip/communicator/impl/gui/main/chat/ChatConversationPanel.java @@ -107,6 +107,8 @@ public class ChatConversationPanel this.chatEditorPane.addHyperlinkListener(this); this.chatEditorPane.addMouseListener(this); + this.chatEditorPane.setCursor( + Cursor.getPredefinedCursor(Cursor.TEXT_CURSOR)); this.setWheelScrollingEnabled(true); diff --git a/src/net/java/sip/communicator/impl/gui/main/chat/ChatWritePanel.java b/src/net/java/sip/communicator/impl/gui/main/chat/ChatWritePanel.java index 62e6279..5699402 100755 --- a/src/net/java/sip/communicator/impl/gui/main/chat/ChatWritePanel.java +++ b/src/net/java/sip/communicator/impl/gui/main/chat/ChatWritePanel.java @@ -77,6 +77,8 @@ public class ChatWritePanel this.editorPane.getDocument().addUndoableEditListener(this); this.editorPane.addKeyListener(this); this.editorPane.addMouseListener(this); + this.editorPane.setCursor( + Cursor.getPredefinedCursor(Cursor.TEXT_CURSOR)); //set our own transfer (i.e. copy/paste) handler this.editorPane.setTransferHandler(new ChatWritePanelTransferHandler()); diff --git a/src/net/java/sip/communicator/impl/gui/main/chat/toolBars/EditTextToolBar.java b/src/net/java/sip/communicator/impl/gui/main/chat/toolBars/EditTextToolBar.java index 9f3520e..e37789c 100644 --- a/src/net/java/sip/communicator/impl/gui/main/chat/toolBars/EditTextToolBar.java +++ b/src/net/java/sip/communicator/impl/gui/main/chat/toolBars/EditTextToolBar.java @@ -14,7 +14,6 @@ import javax.swing.text.*; import javax.swing.text.html.*; 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.utils.*; import net.java.sip.communicator.util.*; diff --git a/src/net/java/sip/communicator/impl/gui/main/contactlist/ActionMenuPanel.java b/src/net/java/sip/communicator/impl/gui/main/contactlist/ActionMenuPanel.java index 62b95a6..5186f85 100644 --- a/src/net/java/sip/communicator/impl/gui/main/contactlist/ActionMenuPanel.java +++ b/src/net/java/sip/communicator/impl/gui/main/contactlist/ActionMenuPanel.java @@ -12,7 +12,6 @@ import java.awt.event.*; import javax.swing.*; 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.contactlist.addcontact.*; import net.java.sip.communicator.impl.gui.utils.*; diff --git a/src/net/java/sip/communicator/impl/gui/main/contactlist/ContactProtocolButton.java b/src/net/java/sip/communicator/impl/gui/main/contactlist/ContactProtocolButton.java index fc4deef..743f4a2 100644 --- a/src/net/java/sip/communicator/impl/gui/main/contactlist/ContactProtocolButton.java +++ b/src/net/java/sip/communicator/impl/gui/main/contactlist/ContactProtocolButton.java @@ -2,8 +2,8 @@ package net.java.sip.communicator.impl.gui.main.contactlist; import java.awt.*; -import net.java.sip.communicator.impl.gui.customcontrols.*; 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 diff --git a/src/net/java/sip/communicator/impl/gui/utils/ConfigurationManager.java b/src/net/java/sip/communicator/impl/gui/utils/ConfigurationManager.java index 4c876c8..777152d 100644 --- a/src/net/java/sip/communicator/impl/gui/utils/ConfigurationManager.java +++ b/src/net/java/sip/communicator/impl/gui/utils/ConfigurationManager.java @@ -31,7 +31,7 @@ public class ConfigurationManager private static boolean isShowOffline = true; private static boolean isApplicationVisible = true; - + private static boolean isQuitWarningShown = true; private static boolean isSendTypingNotifications; @@ -96,7 +96,7 @@ public class ConfigurationManager if(callPanelShown != null && callPanelShown.length() > 0) { - isCallPanelShown = new Boolean(callPanelShown).booleanValue(); + isCallPanelShown = Boolean.parseBoolean(callPanelShown); } // Load the "showOffline" property. @@ -105,7 +105,7 @@ public class ConfigurationManager if(showOffline != null && showOffline.length() > 0) { - isShowOffline = new Boolean(showOffline).booleanValue(); + isShowOffline = Boolean.parseBoolean(showOffline); } // Load the "showApplication" property. @@ -124,7 +124,7 @@ public class ConfigurationManager if(quitWarningShown != null && quitWarningShown.length() > 0) { isQuitWarningShown - = new Boolean(quitWarningShown).booleanValue(); + = Boolean.parseBoolean(quitWarningShown); } // Load the "sendTypingNotifications" property. @@ -141,7 +141,7 @@ public class ConfigurationManager if(isSendTypingNotif != null && isSendTypingNotif.length() > 0) { isSendTypingNotifications - = new Boolean(isSendTypingNotif).booleanValue(); + = Boolean.parseBoolean(isSendTypingNotif); } // Load the "isMoveContactConfirmationRequested" property. @@ -153,8 +153,8 @@ public class ConfigurationManager && isMoveContactConfirmationRequestedString.length() > 0) { isMoveContactConfirmationRequested - = new Boolean(isMoveContactConfirmationRequestedString) - .booleanValue(); + = Boolean.parseBoolean(isMoveContactConfirmationRequestedString) + ; } // Load the "isMultiChatWindowEnabled" property. @@ -173,8 +173,8 @@ public class ConfigurationManager && isMultiChatWindowEnabledString.length() > 0) { isMultiChatWindowEnabled - = new Boolean(isMultiChatWindowEnabledString) - .booleanValue(); + = Boolean.parseBoolean(isMultiChatWindowEnabledString) + ; } // Load the "isHistoryLoggingEnabled" property. @@ -186,8 +186,8 @@ public class ConfigurationManager && isHistoryLoggingEnabledString.length() > 0) { isHistoryLoggingEnabled - = new Boolean(isHistoryLoggingEnabledString) - .booleanValue(); + = Boolean.parseBoolean(isHistoryLoggingEnabledString) + ; } // Load the "isHistoryShown" property. @@ -206,8 +206,8 @@ public class ConfigurationManager && isHistoryShownString.length() > 0) { isHistoryShown - = new Boolean(isHistoryShownString) - .booleanValue(); + = Boolean.parseBoolean(isHistoryShownString) + ; } // Load the "chatHistorySize" property. @@ -245,7 +245,7 @@ public class ConfigurationManager && isTransparentWindowEnabledString.length() > 0) { isTransparentWindowEnabled - = new Boolean(isTransparentWindowEnabledString).booleanValue(); + = Boolean.parseBoolean(isTransparentWindowEnabledString); } // Load the "windowTransparency" property. @@ -283,7 +283,7 @@ public class ConfigurationManager && isWindowDecoratedString.length() > 0) { isWindowDecorated - = new Boolean(isWindowDecoratedString).booleanValue(); + = Boolean.parseBoolean(isWindowDecoratedString); } // Load the "lastContactParent" property. @@ -524,14 +524,14 @@ public class ConfigurationManager /** * Updates the "showApplication" property through the * <tt>ConfigurationService</tt>. - * + * * @param isVisible <code>true</code> to indicate that the * application should be shown, <code>false</code> otherwise. */ public static void setApplicationVisible(boolean isVisible) { isApplicationVisible = isVisible; - + configService.setProperty( "net.java.sip.communicator.impl.systray.showApplication", Boolean.toString(isVisible)); @@ -824,7 +824,7 @@ public class ConfigurationManager String status = (String) configService .getProperty( groupRootPropName + ".isClosed"); - return new Boolean(status).booleanValue(); + return Boolean.parseBoolean(status); } } @@ -845,7 +845,7 @@ public class ConfigurationManager String autoPopupString = (String) evt.getNewValue(); autoPopupNewMessage - = new Boolean(autoPopupString).booleanValue(); + = Boolean.parseBoolean(autoPopupString); } else if (evt.getPropertyName().equals( "service.gui.SEND_MESSAGE_COMMAND")) @@ -859,7 +859,7 @@ public class ConfigurationManager String showCallPanelString = (String) evt.getNewValue(); isCallPanelShown - = new Boolean(showCallPanelString).booleanValue(); + = Boolean.parseBoolean(showCallPanelString); } else if (evt.getPropertyName().equals( "net.java.sip.communicator.impl.gui.showOffline")) @@ -867,13 +867,13 @@ public class ConfigurationManager String showOfflineString = (String) evt.getNewValue(); isShowOffline - = new Boolean(showOfflineString).booleanValue(); + = Boolean.parseBoolean(showOfflineString); } else if (evt.getPropertyName().equals( "net.java.sip.communicator.impl.systray.showApplication")) { String showApplicationString = (String) evt.getNewValue(); - + isApplicationVisible = new Boolean(showApplicationString).booleanValue(); } @@ -883,7 +883,7 @@ public class ConfigurationManager String showQuitWarningString = (String) evt.getNewValue(); isQuitWarningShown - = new Boolean(showQuitWarningString).booleanValue(); + = Boolean.parseBoolean(showQuitWarningString); } else if (evt.getPropertyName().equals( "service.gui.SEND_TYPING_NOTIFICATIONS_ENABLED")) @@ -891,7 +891,7 @@ public class ConfigurationManager String sendTypingNorifString = (String) evt.getNewValue(); isSendTypingNotifications - = new Boolean(sendTypingNorifString).booleanValue(); + = Boolean.parseBoolean(sendTypingNorifString); } else if (evt.getPropertyName().equals( "net.java.sip.communicator.impl.gui.isMoveContactConfirmationRequested")) @@ -899,7 +899,7 @@ public class ConfigurationManager String moveContactConfirmString = (String) evt.getNewValue(); isMoveContactConfirmationRequested - = new Boolean(moveContactConfirmString).booleanValue(); + = Boolean.parseBoolean(moveContactConfirmString); } else if (evt.getPropertyName().equals( "service.gui.IS_MULTI_CHAT_WINDOW_ENABLED")) @@ -907,7 +907,7 @@ public class ConfigurationManager String multiChatWindowString = (String) evt.getNewValue(); isMultiChatWindowEnabled - = new Boolean(multiChatWindowString).booleanValue(); + = Boolean.parseBoolean(multiChatWindowString); } else if (evt.getPropertyName().equals( "net.java.sip.communicator.impl.gui.isHistoryLoggingEnabled")) @@ -915,7 +915,7 @@ public class ConfigurationManager String historyLoggingString = (String) evt.getNewValue(); isHistoryLoggingEnabled - = new Boolean(historyLoggingString).booleanValue(); + = Boolean.parseBoolean(historyLoggingString); } else if (evt.getPropertyName().equals( "service.gui.IS_MESSAGE_HISTORY_SHOWN")) @@ -923,7 +923,7 @@ public class ConfigurationManager String historyShownString = (String) evt.getNewValue(); isHistoryShown - = new Boolean(historyShownString).booleanValue(); + = Boolean.parseBoolean(historyShownString); } else if (evt.getPropertyName().equals( "service.gui.MESSAGE_HISTORY_SIZE")) @@ -939,7 +939,7 @@ public class ConfigurationManager String isTransparentString = (String) evt.getNewValue(); isTransparentWindowEnabled - = new Boolean(isTransparentString).booleanValue(); + = Boolean.parseBoolean(isTransparentString); } else if (evt.getPropertyName().equals( "impl.gui.WINDOW_TRANSPARENCY")) diff --git a/src/net/java/sip/communicator/impl/gui/utils/LightGrayFilter.java b/src/net/java/sip/communicator/impl/gui/utils/LightGrayFilter.java deleted file mode 100644 index a0660dd..0000000 --- a/src/net/java/sip/communicator/impl/gui/utils/LightGrayFilter.java +++ /dev/null @@ -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.gui.utils; - -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, 30); - ImageProducer prod = new FilteredImageSource(i.getSource(), filter); - Image grayImage = Toolkit.getDefaultToolkit().createImage(prod); - - return grayImage; - } -} diff --git a/src/net/java/sip/communicator/impl/gui/utils/NotificationManager.java b/src/net/java/sip/communicator/impl/gui/utils/NotificationManager.java index 5dd3ed9..005d9ee 100644 --- a/src/net/java/sip/communicator/impl/gui/utils/NotificationManager.java +++ b/src/net/java/sip/communicator/impl/gui/utils/NotificationManager.java @@ -115,7 +115,7 @@ public class NotificationManager if(notificationService == null) return; - notificationService.fireNotification(eventType, messageTitle, message); + notificationService.fireNotification(eventType, messageTitle, message, null); } /** @@ -148,8 +148,7 @@ public class NotificationManager else if (contact instanceof ChatRoom) { // For system rooms we don't want to send notification events. - if ((contact instanceof ChatRoom) - && ((ChatRoom) contact).isSystem()) + if (((ChatRoom) contact).isSystem()) return; chatPanel = GuiActivator.getUIService().getChat((ChatRoom) contact); @@ -166,7 +165,8 @@ public class NotificationManager popupActionHandler.setEnabled(false); } - notificationService.fireNotification(eventType, messageTitle, message); + notificationService.fireNotification( + eventType, messageTitle, message, contact); if(popupActionHandler != null) popupActionHandler.setEnabled(true); diff --git a/src/net/java/sip/communicator/impl/notification/NotificationServiceImpl.java b/src/net/java/sip/communicator/impl/notification/NotificationServiceImpl.java index cd635fe..e7e6533 100644 --- a/src/net/java/sip/communicator/impl/notification/NotificationServiceImpl.java +++ b/src/net/java/sip/communicator/impl/notification/NotificationServiceImpl.java @@ -376,8 +376,13 @@ public class NotificationServiceImpl * @param title the title of the given message * @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 title, String message) + public void fireNotification( + String eventType, + String title, + String message, + Object tag) { EventNotification notification = (EventNotification) notificationsTable.get(eventType); @@ -401,7 +406,7 @@ public class NotificationServiceImpl if (actionType.equals(NotificationService.ACTION_POPUP_MESSAGE)) { ((PopupMessageNotificationHandler) handler) - .popupMessage(new PopupMessage(title, message)); + .popupMessage(new PopupMessage(title, message, tag)); } else if (actionType.equals(NotificationService.ACTION_LOG_MESSAGE)) { @@ -431,7 +436,7 @@ public class NotificationServiceImpl */ public void fireNotification(String eventType) { - this.fireNotification(eventType, null, null); + this.fireNotification(eventType, null, null, null); } /** diff --git a/src/net/java/sip/communicator/impl/swingnotification/PopupMessageHandlerSwingImpl.java b/src/net/java/sip/communicator/impl/swingnotification/PopupMessageHandlerSwingImpl.java index 79748e1..38c1d39 100644 --- a/src/net/java/sip/communicator/impl/swingnotification/PopupMessageHandlerSwingImpl.java +++ b/src/net/java/sip/communicator/impl/swingnotification/PopupMessageHandlerSwingImpl.java @@ -13,6 +13,7 @@ import java.util.List; import javax.swing.*; 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.event.*; 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 */ private ImageIcon defaultIcon = SwingNotificationActivator.getResources().getImage( - "service.gui.DEFAULT_USER_PHOTO");; + "service.gui.SIP_COMMUNICATOR_LOGO_39x58");; /** * Adds a listerner to receive popup events @@ -76,11 +77,9 @@ public class PopupMessageHandlerSwingImpl implements PopupMessageHandler getDefaultConfiguration(); final JWindow notificationWindow = new JWindow(graphicsConf); - notificationWindow.setPreferredSize(new Dimension(225, 125)); final Timer popupTimer = new Timer(10000, new ActionListener() { - public void actionPerformed(ActionEvent e) { if (notificationWindow.isVisible()) @@ -108,18 +107,27 @@ public class PopupMessageHandlerSwingImpl implements PopupMessageHandler @Override 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(); } }); if (popupMessage.getComponent() != null) + { notificationWindow.add(popupMessage.getComponent()); + } else + { notificationWindow.add(createPopup( popupMessage.getMessageTitle(), popupMessage.getMessage(), - popupMessage.getIcon())); + popupMessage.getTag())); + notificationWindow.setPreferredSize(new Dimension(225, 120)); + } notificationWindow.setAlwaysOnTop(true); notificationWindow.pack(); @@ -136,38 +144,46 @@ public class PopupMessageHandlerSwingImpl implements PopupMessageHandler * @return */ private JComponent createPopup(String title, String message, - ImageIcon icon) + Object tag) { - String msg; - - if (message.length() > 70) - msg = "<html><b>" + message.substring(0, 77) + "..."; - else - msg = "<html><b>" + message; - - JLabel msgContent = new JLabel(msg); - - if (title.length() > 40) - title = title.substring(0, 28) + "..."; - JLabel msgFrom = new JLabel(title); - msgFrom.setForeground(Color.DARK_GRAY); - - JLabel msgIcon = (icon == null) ? - new JLabel(defaultIcon) : - new JLabel(icon); - msgIcon.setOpaque(false); + String ttle = title; + if (title.length() > 50) + ttle = title.substring(0, 47) + "..."; + JLabel msgTitle = new JLabel("<html>" + ttle); + msgTitle.setForeground(Color.DARK_GRAY); + + String msg = message; + if (message.length() > 90) + msg = message.substring(0, 87) + "..."; + JLabel msgContent = new JLabel("<html><b>" + msg); + + JPanel notificationBody = new JPanel(new BorderLayout()); + notificationBody.setOpaque(false); + notificationBody.add(msgTitle, BorderLayout.NORTH); + notificationBody.add(msgContent, BorderLayout.CENTER); + + JLabel msgIcon = new JLabel(defaultIcon); + 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)); - JPanel notificationContent = new JPanel(new BorderLayout(5, 1)); + JPanel notificationContent = new JPanel(new BorderLayout(5, 0)); notificationContent.setBorder( - BorderFactory.createEmptyBorder(10, 10, 10, 10)); + BorderFactory.createEmptyBorder(0, 3, 3, 3)); notificationContent.setOpaque(false); - notificationContent.add(msgFrom, BorderLayout.NORTH); - notificationContent.add(msgContent, BorderLayout.CENTER); notificationContent.add(msgIcon, BorderLayout.WEST); + notificationContent.add(notificationBody, BorderLayout.CENTER); - return new PopupNotificationPanel(notificationContent); + return new PopupNotificationPanel(notificationContent, tag); } /** diff --git a/src/net/java/sip/communicator/impl/swingnotification/swingnotification.manifest.mf b/src/net/java/sip/communicator/impl/swingnotification/swingnotification.manifest.mf index edaf035..5dc5835 100644 --- a/src/net/java/sip/communicator/impl/swingnotification/swingnotification.manifest.mf +++ b/src/net/java/sip/communicator/impl/swingnotification/swingnotification.manifest.mf @@ -6,6 +6,7 @@ Bundle-Version: 0.0.1 System-Bundle: yes
Import-Package: org.osgi.framework,
net.java.sip.communicator.service.configuration,
+ net.java.sip.communicator.service.protocol,
net.java.sip.communicator.service.resources,
net.java.sip.communicator.service.systray,
net.java.sip.communicator.service.systray.event,
diff --git a/src/net/java/sip/communicator/impl/systray/jdic/LightGrayFilter.java b/src/net/java/sip/communicator/impl/systray/jdic/LightGrayFilter.java deleted file mode 100644 index 3c72127..0000000 --- a/src/net/java/sip/communicator/impl/systray/jdic/LightGrayFilter.java +++ /dev/null @@ -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; - } -} diff --git a/src/net/java/sip/communicator/impl/systray/jdic/StatusSimpleSelector.java b/src/net/java/sip/communicator/impl/systray/jdic/StatusSimpleSelector.java index 0d4cdbb..dfb71fb 100644 --- a/src/net/java/sip/communicator/impl/systray/jdic/StatusSimpleSelector.java +++ b/src/net/java/sip/communicator/impl/systray/jdic/StatusSimpleSelector.java @@ -14,6 +14,7 @@ import javax.swing.*; import net.java.sip.communicator.impl.systray.*; import net.java.sip.communicator.service.protocol.*; 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 diff --git a/src/net/java/sip/communicator/impl/systray/jdic/SystrayServiceJdicImpl.java b/src/net/java/sip/communicator/impl/systray/jdic/SystrayServiceJdicImpl.java index 9ccc8b0..b44ca19 100644 --- a/src/net/java/sip/communicator/impl/systray/jdic/SystrayServiceJdicImpl.java +++ b/src/net/java/sip/communicator/impl/systray/jdic/SystrayServiceJdicImpl.java @@ -8,7 +8,6 @@ package net.java.sip.communicator.impl.systray.jdic; import org.osgi.framework.*; -import java.awt.Toolkit; import java.awt.event.*; import java.net.*; import java.util.*; @@ -65,11 +64,6 @@ public class SystrayServiceJdicImpl 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 * <tt>SystrayServiceActivator</tt> */ @@ -137,9 +131,7 @@ public class SystrayServiceJdicImpl UIService ui = SystrayActivator.getUIService(); if (ui != null) - { ui.setExitOnMainWindowClose(false); - } } } @@ -148,13 +140,6 @@ public class SystrayServiceJdicImpl */ 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()); String osName = System.getProperty("os.name"); @@ -222,29 +207,19 @@ public class SystrayServiceJdicImpl //Show/hide the contact list when user clicks on the systray. trayIcon.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - long currentTime = System.currentTimeMillis(); UIService uiService = SystrayActivator.getUIService(); - boolean isVisible = !uiService.isVisible(); - - if (isVisible) + ExportedWindow win = + uiService.getExportedWindow(ExportedWindow.MAIN_WINDOW); + if (!win.isVisible()) { - setVisibleTime = currentTime; - } else if (currentTime < (setVisibleTime + doubleClickSpeed)) - { - // Do nothing. the last restore is less than 2 seconds, so it is very - // likely, that the user made a double click. prevent the main window - // from opening and immediately closing again. - return; + win.setVisible(true); + configService.setProperty( + "net.java.sip.communicator.impl.systray.showApplication", + Boolean.toString(true)); } - - uiService.setVisible(isVisible); - - configService.setProperty( - "net.java.sip.communicator.impl.systray.showApplication", - Boolean.toString(isVisible)); + win.bringToFront(); } }); @@ -288,12 +263,15 @@ public class SystrayServiceJdicImpl }); } - PopupMessageHandler pph = new PopupMessageHandlerTrayIconImpl(trayIcon); - popupHandlerSet.put(pph.getClass().getName(), pph); - SystrayActivator.bundleContext.registerService( - PopupMessageHandler.class.getName(), - pph, null); - + PopupMessageHandler pph = null; + if (!osName.startsWith("Mac OS X")) + { + pph = new PopupMessageHandlerTrayIconImpl(trayIcon); + popupHandlerSet.put(pph.getClass().getName(), pph); + SystrayActivator.bundleContext.registerService( + PopupMessageHandler.class.getName(), + pph, null); + } try { SystrayActivator.bundleContext.addServiceListener( @@ -611,9 +589,12 @@ public class SystrayServiceJdicImpl UIService uiService = SystrayActivator.getUIService(); ExportedWindow chatWindow = uiService.getExportedWindow( ExportedWindow.CHAT_WINDOW); - if (chatWindow != null && chatWindow.isVisible()) - { + if (chatWindow != null) chatWindow.bringToFront(); + Object o = evt.getTag(); + if (o instanceof Contact) + { +// TODO: bring the chat with that contact to front } } } |