From 53320e1bd09b4b91a478b04790e51093bfd9124d Mon Sep 17 00:00:00 2001 From: Damian Minkov Date: Fri, 11 Jul 2014 17:19:02 +0300 Subject: Displays global status message when available. --- .../impl/gui/main/presence/AccountStatusPanel.java | 43 ++++++++++++++++++++-- .../gui/main/presence/GlobalStatusSelectorBox.java | 11 +++++- .../plugin/desktoputil/FramedImageWithMenu.java | 1 - 3 files changed, 49 insertions(+), 6 deletions(-) (limited to 'src/net/java') diff --git a/src/net/java/sip/communicator/impl/gui/main/presence/AccountStatusPanel.java b/src/net/java/sip/communicator/impl/gui/main/presence/AccountStatusPanel.java index 6e80b2f..dc7a5dd 100644 --- a/src/net/java/sip/communicator/impl/gui/main/presence/AccountStatusPanel.java +++ b/src/net/java/sip/communicator/impl/gui/main/presence/AccountStatusPanel.java @@ -60,12 +60,12 @@ public class AccountStatusPanel /** * The desired height of the avatar. */ - private static final int AVATAR_ICON_HEIGHT = 40; + private static final int AVATAR_ICON_HEIGHT = 50; /** * The desired width of the avatar. */ - private static final int AVATAR_ICON_WIDTH = 40; + private static final int AVATAR_ICON_WIDTH = 50; /** * The image object storing the avatar. @@ -123,6 +123,18 @@ public class AccountStatusPanel private final PluginContainer mainToolbarPluginContainer; /** + * When setting global status message, the message will be displayed in this + * label. + */ + private final JLabel statusMessageLabel = new JLabel(); + + /** + * This is the panel that contains display name, status message, status + * selector box and plugins. + */ + private final TransparentPanel rightPanel = new TransparentPanel(); + + /** * Creates an instance of AccountStatusPanel by specifying the * main window, where this panel is added. */ @@ -144,7 +156,7 @@ public class AccountStatusPanel accountNameLabel.getFont().deriveFont(12f)); accountNameLabel.setOpaque(false); - statusComboBox = new GlobalStatusSelectorBox(); + statusComboBox = new GlobalStatusSelectorBox(this); // Align status combo box with account name field. statusComboBox.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); @@ -163,9 +175,14 @@ public class AccountStatusPanel statusToolsPanel.add(toolbarPluginPanel, BorderLayout.EAST); - TransparentPanel rightPanel = new TransparentPanel(); + statusMessageLabel.setFont( + statusMessageLabel.getFont().deriveFont(9f)); + statusMessageLabel.setForeground(Color.GRAY); + + rightPanel.setLayout(new BorderLayout(0, 0)); rightPanel.add(accountNameLabel, BorderLayout.NORTH); + rightPanel.add(statusMessageLabel, BorderLayout.CENTER); rightPanel.add(statusToolsPanel, BorderLayout.SOUTH); this.add(accountImageLabel, BorderLayout.WEST); @@ -197,6 +214,24 @@ public class AccountStatusPanel } /** + * Updates status message. + * @param text + */ + void setStatusMessage(String text) + { + if(text == null) + { + statusMessageLabel.setText(""); + rightPanel.setBorder(BorderFactory.createEmptyBorder(5, 0, 5, 0)); + } + else + { + rightPanel.setBorder(null); + statusMessageLabel.setText(text); + } + } + + /** * Adds the account given by protocolProvider in the contained * status combo box. * @param protocolProvider the ProtocolProviderService diff --git a/src/net/java/sip/communicator/impl/gui/main/presence/GlobalStatusSelectorBox.java b/src/net/java/sip/communicator/impl/gui/main/presence/GlobalStatusSelectorBox.java index 8b8d889..ee6e029 100644 --- a/src/net/java/sip/communicator/impl/gui/main/presence/GlobalStatusSelectorBox.java +++ b/src/net/java/sip/communicator/impl/gui/main/presence/GlobalStatusSelectorBox.java @@ -87,12 +87,19 @@ public class GlobalStatusSelectorBox private final GlobalStatusMessageMenu globalStatusMessageMenu; /** + * The parent panel that creates us. + */ + private final AccountStatusPanel accountStatusPanel; + + /** * Creates an instance of SimpleStatusSelectorBox. */ - public GlobalStatusSelectorBox() + public GlobalStatusSelectorBox(AccountStatusPanel accountStatusPanel) { super(); + this.accountStatusPanel = accountStatusPanel; + JLabel titleLabel = new JLabel(GuiActivator.getResources() .getI18NString("service.gui.SET_GLOBAL_STATUS")); titleLabel.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0)); @@ -156,10 +163,12 @@ public class GlobalStatusSelectorBox this.setToolTipText("" + GuiActivator.getResources() .getI18NString("service.gui.SET_GLOBAL_STATUS") + ""); + accountStatusPanel.setStatusMessage(null); } else { this.setToolTipText("" + message + ""); + accountStatusPanel.setStatusMessage(message); } } diff --git a/src/net/java/sip/communicator/plugin/desktoputil/FramedImageWithMenu.java b/src/net/java/sip/communicator/plugin/desktoputil/FramedImageWithMenu.java index 4262e3b..683d8bd 100644 --- a/src/net/java/sip/communicator/plugin/desktoputil/FramedImageWithMenu.java +++ b/src/net/java/sip/communicator/plugin/desktoputil/FramedImageWithMenu.java @@ -51,7 +51,6 @@ public class FramedImageWithMenu /** * Creates the component. - * @param mainFrame the parent frame. * @param imageIcon the image icon to show as default one. * @param width width of component. * @param height height of component. -- cgit v1.1