aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorYana Stamcheva <yana@jitsi.org>2010-12-21 08:37:07 +0000
committerYana Stamcheva <yana@jitsi.org>2010-12-21 08:37:07 +0000
commita1f0592d6c16d0b20c1a274ec03b04483b38788a (patch)
tree40b5c7226cf0715cf6ac4a5a45295d564c65e921 /src
parent0082a836f4473934aa6d051da90e29ed5c1710ea (diff)
downloadjitsi-a1f0592d6c16d0b20c1a274ec03b04483b38788a.zip
jitsi-a1f0592d6c16d0b20c1a274ec03b04483b38788a.tar.gz
jitsi-a1f0592d6c16d0b20c1a274ec03b04483b38788a.tar.bz2
More native MacOS interface for main components.
Diffstat (limited to 'src')
-rw-r--r--src/net/java/sip/communicator/impl/gui/main/MainFrame.java54
-rw-r--r--src/net/java/sip/communicator/impl/gui/main/call/CallDialog.java45
-rw-r--r--src/net/java/sip/communicator/impl/gui/main/call/OneToOneCallPanel.java65
-rw-r--r--src/net/java/sip/communicator/impl/gui/main/call/OneToOneCallPeerPanel.java37
-rw-r--r--src/net/java/sip/communicator/impl/gui/main/chat/ChatPanel.java8
-rw-r--r--src/net/java/sip/communicator/impl/gui/main/chat/ChatWindow.java111
-rw-r--r--src/net/java/sip/communicator/impl/gui/main/configforms/ConfigFormDescriptor.java12
-rw-r--r--src/net/java/sip/communicator/impl/gui/main/configforms/ConfigFormListCellRenderer.java6
-rw-r--r--src/net/java/sip/communicator/impl/gui/main/configforms/ConfigurationFrame.java50
-rw-r--r--src/net/java/sip/communicator/impl/gui/main/contactlist/ContactListTreeCellRenderer.java57
-rw-r--r--src/net/java/sip/communicator/impl/gui/main/contactlist/SearchFieldUI.java2
-rw-r--r--src/net/java/sip/communicator/impl/gui/main/presence/AccountStatusPanel.java10
-rw-r--r--src/net/java/sip/communicator/impl/gui/main/presence/GlobalStatusSelectorBox.java4
-rw-r--r--src/net/java/sip/communicator/util/swing/AuthenticationWindow.java4
-rw-r--r--src/net/java/sip/communicator/util/swing/EmphasizedLabel.java99
-rw-r--r--src/net/java/sip/communicator/util/swing/SIPCommDialog.java4
-rw-r--r--src/net/java/sip/communicator/util/swing/SIPCommFrame.java4
17 files changed, 449 insertions, 123 deletions
diff --git a/src/net/java/sip/communicator/impl/gui/main/MainFrame.java b/src/net/java/sip/communicator/impl/gui/main/MainFrame.java
index 57cc2f7..fecf355 100644
--- a/src/net/java/sip/communicator/impl/gui/main/MainFrame.java
+++ b/src/net/java/sip/communicator/impl/gui/main/MainFrame.java
@@ -39,6 +39,8 @@ import net.java.sip.communicator.util.swing.event.*;
import org.osgi.framework.*;
+import com.explodingpixels.macwidgets.*;
+
/**
* The main application window. This class is the core of this UI
* implementation. It stores all available protocol providers and their
@@ -237,20 +239,18 @@ public class MainFrame
registerKeyActions();
- TransparentPanel northPanel
- = new TransparentPanel(new BorderLayout(0, 0));
+ JComponent northPanel = createTopComponent();
this.setJMenuBar(menu);
- northPanel.add(accountStatusPanel, BorderLayout.CENTER);
-
TransparentPanel searchPanel
= new TransparentPanel(new BorderLayout(2, 0));
- searchPanel.setBorder(BorderFactory.createEmptyBorder(0, 5, 5, 5));
searchPanel.add(searchField);
searchPanel.add(new CallHistoryButton(), BorderLayout.EAST);
- centerPanel.add(searchPanel, BorderLayout.NORTH);
+ northPanel.add(accountStatusPanel, BorderLayout.CENTER);
+ northPanel.add(searchPanel, BorderLayout.SOUTH);
+
centerPanel.add(contactListPanel, BorderLayout.CENTER);
this.mainPanel.add(northPanel, BorderLayout.NORTH);
@@ -262,6 +262,48 @@ public class MainFrame
}
/**
+ * Creates the toolbar panel for this chat window, depending on the current
+ * operating system.
+ *
+ * @return the created toolbar
+ */
+ private JComponent createTopComponent()
+ {
+ JComponent topComponent = null;
+
+ if (OSUtils.IS_MAC)
+ {
+ UnifiedToolBar macToolbarPanel = new UnifiedToolBar();
+
+ MacUtils.makeWindowLeopardStyle(getRootPane());
+
+ macToolbarPanel.getComponent().setLayout(new BorderLayout(3, 3));
+ macToolbarPanel.getComponent()
+ .setBorder(BorderFactory.createEmptyBorder(3, 3, 3, 3));
+ macToolbarPanel.disableBackgroundPainter();
+ macToolbarPanel.installWindowDraggerOnWindow(this);
+
+ // Set the color of the center panel.
+ centerPanel.setOpaque(true);
+ centerPanel.setBackground(
+ new Color(GuiActivator.getResources()
+ .getColor("service.gui.MAC_PANEL_BACKGROUND")));
+
+ topComponent = macToolbarPanel.getComponent();
+ }
+ else
+ {
+ JPanel panel = new TransparentPanel(new BorderLayout());
+
+ panel.setBorder(BorderFactory.createEmptyBorder(3, 3, 3, 3));
+
+ topComponent = panel;
+ }
+
+ return topComponent;
+ }
+
+ /**
* Sets frame size and position.
*/
public void initBounds()
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 f3261c0..0d0512a 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
@@ -243,9 +243,6 @@ public class CallDialog
*/
private void init()
{
- TransparentPanel buttonsPanel
- = new TransparentPanel(new BorderLayout(5, 5));
-
hangupButton = new SIPCommButton(
ImageLoader.getImage(ImageLoader.HANGUP_BUTTON_BG));
@@ -269,9 +266,6 @@ public class CallDialog
"service.gui.CREATE_CONFERENCE_CALL"));
conferenceButton.addActionListener(this);
- contentPane.add(callPanel, BorderLayout.CENTER);
- contentPane.add(buttonsPanel, BorderLayout.SOUTH);
-
hangupButton.setName(HANGUP_BUTTON);
hangupButton.setToolTipText(
GuiActivator.getResources().getI18NString("service.gui.HANG_UP"));
@@ -307,13 +301,14 @@ public class CallDialog
addOneToOneSpecificComponents();
}
- buttonsPanel.add(settingsPanel, BorderLayout.WEST);
- buttonsPanel.add(hangupButton, BorderLayout.EAST);
-
- buttonsPanel.setBorder(
- new ExtendedEtchedBorder(EtchedBorder.LOWERED, 1, 0, 0, 0));
+ settingsPanel.add(volumeControlButton);
dtmfHandler = new DTMFHandler(this);
+
+ JComponent bottomBar = createBottomBar();
+
+ contentPane.add(callPanel, BorderLayout.CENTER);
+ contentPane.add(bottomBar, BorderLayout.SOUTH);
}
/**
@@ -1098,4 +1093,32 @@ public class CallDialog
{
return recordButton.isSelected();
}
+
+ /**
+ * Creates the bottom bar panel for this call dialog, depending on the
+ * current operating system.
+ *
+ * @return the created bottom bar
+ */
+ private JComponent createBottomBar()
+ {
+ JComponent bottomBar = new TransparentPanel();
+
+ bottomBar.setBorder(
+ new ExtendedEtchedBorder(EtchedBorder.LOWERED, 1, 0, 0, 0));
+
+ if (OSUtils.IS_MAC)
+ {
+ bottomBar.setOpaque(true);
+ bottomBar.setBackground(
+ new Color(GuiActivator.getResources()
+ .getColor("service.gui.MAC_PANEL_BACKGROUND")));
+ }
+
+ bottomBar.setLayout(new BorderLayout());
+ bottomBar.add(settingsPanel, BorderLayout.WEST);
+ bottomBar.add(hangupButton, BorderLayout.EAST);
+
+ return bottomBar;
+ }
}
diff --git a/src/net/java/sip/communicator/impl/gui/main/call/OneToOneCallPanel.java b/src/net/java/sip/communicator/impl/gui/main/call/OneToOneCallPanel.java
index 5ec36d4..eb33afd 100644
--- a/src/net/java/sip/communicator/impl/gui/main/call/OneToOneCallPanel.java
+++ b/src/net/java/sip/communicator/impl/gui/main/call/OneToOneCallPanel.java
@@ -10,6 +10,8 @@ import java.awt.event.*;
import javax.swing.*;
+import com.explodingpixels.macwidgets.*;
+
import net.java.sip.communicator.impl.gui.*;
import net.java.sip.communicator.service.protocol.*;
import net.java.sip.communicator.util.*;
@@ -40,6 +42,11 @@ public class OneToOneCallPanel
private static final long serialVersionUID = 0L;
/**
+ * The component showing the name of the underlying call peer.
+ */
+ private final JLabel nameLabel = new JLabel("", JLabel.CENTER);
+
+ /**
* The panel representing the underlying <tt>CallPeer</tt>.
*/
private OneToOneCallPeerPanel peerPanel;
@@ -96,9 +103,6 @@ public class OneToOneCallPanel
this.call = call;
this.callPeer = callPeer;
- this.setBorder(BorderFactory
- .createEmptyBorder(5, 0, 5, 0));
-
this.setTransferHandler(new CallTransferHandler(call));
this.addCallPeerPanel(callPeer);
@@ -117,6 +121,13 @@ public class OneToOneCallPanel
{
peerPanel = new OneToOneCallPeerPanel(this, peer);
+ /* Create the main Components of the UI. */
+ nameLabel.setText(peer.getDisplayName());
+
+ JComponent topBar = createTopComponent();
+ topBar.add(nameLabel);
+
+ this.add(topBar, BorderLayout.NORTH);
this.add(peerPanel);
// Create an adapter which would manage all common call peer
@@ -471,4 +482,52 @@ public class OneToOneCallPanel
{
return callDialog;
}
+
+ /**
+ * Sets the name of the peer.
+ * @param name the name of the peer
+ */
+ public void setPeerName(String name)
+ {
+ this.nameLabel.setText(name);
+ }
+
+ /**
+ * Creates the toolbar panel for this chat window, depending on the current
+ * operating system.
+ *
+ * @return the created toolbar
+ */
+ private JComponent createTopComponent()
+ {
+ JComponent topComponent = null;
+
+ if (OSUtils.IS_MAC)
+ {
+ UnifiedToolBar macToolbarPanel = new UnifiedToolBar();
+
+ MacUtils.makeWindowLeopardStyle(callDialog.getRootPane());
+
+ macToolbarPanel.getComponent().setLayout(new BorderLayout());
+ macToolbarPanel.disableBackgroundPainter();
+ macToolbarPanel.installWindowDraggerOnWindow(callDialog);
+
+ // Set the color of the center panel.
+ peerPanel.setOpaque(true);
+ peerPanel.setBackground(new Color(GuiActivator.getResources()
+ .getColor("service.gui.MAC_PANEL_BACKGROUND")));
+
+ topComponent = macToolbarPanel.getComponent();
+ }
+ else
+ {
+ JPanel panel = new TransparentPanel(new BorderLayout());
+
+ panel.setBorder(BorderFactory.createEmptyBorder(3, 3, 3, 3));
+
+ topComponent = panel;
+ }
+
+ return topComponent;
+ }
}
diff --git a/src/net/java/sip/communicator/impl/gui/main/call/OneToOneCallPeerPanel.java b/src/net/java/sip/communicator/impl/gui/main/call/OneToOneCallPeerPanel.java
index f93ae43..8f614e9 100644
--- a/src/net/java/sip/communicator/impl/gui/main/call/OneToOneCallPeerPanel.java
+++ b/src/net/java/sip/communicator/impl/gui/main/call/OneToOneCallPeerPanel.java
@@ -59,11 +59,6 @@ public class OneToOneCallPeerPanel
private CallPeerAdapter callPeerAdapter;
/**
- * The component showing the name of the underlying call peer.
- */
- private final JLabel nameLabel = new JLabel("", JLabel.CENTER);
-
- /**
* The component showing the status of the underlying call peer.
*/
private final JLabel callStatusLabel = new JLabel();
@@ -125,7 +120,7 @@ public class OneToOneCallPeerPanel
/**
* The name of the peer.
*/
- private final String peerName;
+ private String peerName;
/**
* The list containing all video containers.
@@ -181,6 +176,16 @@ public class OneToOneCallPeerPanel
private JLabel remoteLevelLabel;
/**
+ * The center component.
+ */
+ private final Component center;
+
+ /**
+ * The status bar component.
+ */
+ private final Component statusBar;
+
+ /**
* Creates a <tt>CallPeerPanel</tt> for the given call peer.
*
* @param callRenderer the renderer of the call
@@ -195,26 +200,14 @@ public class OneToOneCallPeerPanel
this.setPeerImage(CallManager.getPeerImage(callPeer));
- /* Create the main Components of the UI. */
- nameLabel.setText(peerName);
- nameLabel.setAlignmentX(JLabel.CENTER);
-
- Component center = createCenter();
- Component statusBar = createStatusBar();
+ center = createCenter();
+ statusBar = createStatusBar();
/* Lay out the main Components of the UI. */
setLayout(new GridBagLayout());
GridBagConstraints constraints = new GridBagConstraints();
- if (nameLabel != null)
- {
- constraints.fill = GridBagConstraints.NONE;
- constraints.gridx = 0;
- constraints.gridy = 0;
- constraints.weightx = 0;
- add(nameLabel, constraints);
- }
if (center != null)
{
/*
@@ -975,7 +968,9 @@ public class OneToOneCallPeerPanel
*/
public void setPeerName(String name)
{
- this.nameLabel.setText(name);
+ peerName = name;
+
+ ((OneToOneCallPanel) callRenderer).setPeerName(name);
}
/**
diff --git a/src/net/java/sip/communicator/impl/gui/main/chat/ChatPanel.java b/src/net/java/sip/communicator/impl/gui/main/chat/ChatPanel.java
index 3b20ab9..129c643 100644
--- a/src/net/java/sip/communicator/impl/gui/main/chat/ChatPanel.java
+++ b/src/net/java/sip/communicator/impl/gui/main/chat/ChatPanel.java
@@ -162,6 +162,14 @@ public class ChatPanel
this.add(messagePane, BorderLayout.CENTER);
this.add(sendPanel, BorderLayout.SOUTH);
+ if (OSUtils.IS_MAC)
+ {
+ setOpaque(true);
+ setBackground(
+ new Color(GuiActivator.getResources()
+ .getColor("service.gui.MAC_PANEL_BACKGROUND")));
+ }
+
this.addComponentListener(new TabSelectionComponentListener());
}
diff --git a/src/net/java/sip/communicator/impl/gui/main/chat/ChatWindow.java b/src/net/java/sip/communicator/impl/gui/main/chat/ChatWindow.java
index c89bd46..52100f1 100644
--- a/src/net/java/sip/communicator/impl/gui/main/chat/ChatWindow.java
+++ b/src/net/java/sip/communicator/impl/gui/main/chat/ChatWindow.java
@@ -33,6 +33,8 @@ import net.java.sip.communicator.util.swing.event.*;
import org.osgi.framework.*;
+import com.explodingpixels.macwidgets.*;
+
/**
* The chat window is the place, where users can write and send messages, view
* received messages. The ChatWindow supports two modes of use: "Group all
@@ -63,13 +65,12 @@ public class ChatWindow
private final java.util.List<ChatChangeListener> chatChangeListeners =
new Vector<ChatChangeListener>();
- private final JPanel mainPanel = new JPanel(new BorderLayout());
-
- private final NorthPanel northPanel = new NorthPanel(new BorderLayout());
+ private final JPanel mainPanel
+ = new TransparentPanel(new BorderLayout());
- private final JPanel statusBarPanel = new JPanel(new BorderLayout());
+ private final JPanel statusBarPanel
+ = new TransparentPanel(new BorderLayout());
- private final JPanel pluginPanelNorth = new JPanel();
private final JPanel pluginPanelSouth = new JPanel();
private final JPanel pluginPanelWest = new JPanel();
private final JPanel pluginPanelEast = new JPanel();
@@ -78,7 +79,9 @@ public class ChatWindow
private final MessageWindowMenuBar menuBar;
- private final MainToolBar mainToolBar;
+ private MainToolBar mainToolBar;
+
+ private final Component toolbarPanel;
/**
* Creates an instance of <tt>ChatWindow</tt> by passing to it an instance
@@ -93,8 +96,6 @@ public class ChatWindow
this.addWindowFocusListener(this);
- this.setHierarchicallyOpaque(false);
-
this.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
//If in mode TABBED_CHAT_WINDOW initialize the tabbed pane
@@ -129,17 +130,9 @@ public class ChatWindow
this.setJMenuBar(menuBar);
- mainToolBar = new MainToolBar(this);
-
- boolean chatToolbarVisible = ConfigurationManager.isChatToolbarVisible();
- northPanel.setVisible(chatToolbarVisible);
-
- northPanel.setBorder(BorderFactory.createEmptyBorder(3, 0, 3, 0));
- northPanel.add(mainToolBar, BorderLayout.CENTER);
- northPanel.add(contactPhotoPanel, BorderLayout.EAST);
-
- this.mainPanel.add(northPanel, BorderLayout.NORTH);
+ toolbarPanel = createToolBar();
+ this.getContentPane().add(toolbarPanel, BorderLayout.NORTH);
this.getContentPane().add(mainPanel, BorderLayout.CENTER);
this.getContentPane().add(statusBarPanel, BorderLayout.SOUTH);
@@ -172,20 +165,6 @@ public class ChatWindow
}
/**
- * Sets the given isOpaque property to this panel and all its contained
- * components.
- *
- * @param isOpaque <code>true</code> to set this panel paque and
- * <code>false</code> - otherwise.
- */
- public void setHierarchicallyOpaque(boolean isOpaque)
- {
- northPanel.setOpaque(isOpaque);
- mainPanel.setOpaque(isOpaque);
- statusBarPanel.setOpaque(isOpaque);
- }
-
- /**
* Shows or hides the Toolbar depending on the value of parameter b.
*
* @param b if true, makes the Toolbar visible, otherwise hides the Toolbar
@@ -193,9 +172,9 @@ public class ChatWindow
public void setToolbarVisible(boolean b)
{
// The north panel is the one containing the toolbar and contact photo.
- northPanel.setVisible(b);
+ toolbarPanel.setVisible(b);
}
-
+
/**
* Shows or hides the Stylebar depending on the value of parameter b.
*
@@ -264,6 +243,52 @@ public class ChatWindow
}
/**
+ * Creates the toolbar panel for this chat window, depending on the current
+ * operating system.
+ *
+ * @return the created toolbar
+ */
+ private Component createToolBar()
+ {
+ Component toolbarPanel = null;
+
+ mainToolBar = new MainToolBar(this);
+
+ boolean chatToolbarVisible
+ = ConfigurationManager.isChatToolbarVisible();
+
+ if (OSUtils.IS_MAC)
+ {
+ UnifiedToolBar macToolbarPanel = new UnifiedToolBar();
+
+ MacUtils.makeWindowLeopardStyle(getRootPane());
+
+ macToolbarPanel.addComponentToLeft(mainToolBar);
+ macToolbarPanel.addComponentToRight(contactPhotoPanel);
+ macToolbarPanel.disableBackgroundPainter();
+ macToolbarPanel.installWindowDraggerOnWindow(this);
+ macToolbarPanel.getComponent()
+ .setBorder(BorderFactory.createEmptyBorder(3, 3, 3, 3));
+ macToolbarPanel.getComponent().setVisible(chatToolbarVisible);
+
+ toolbarPanel = macToolbarPanel.getComponent();
+ }
+ else
+ {
+ ToolbarPanel panel = new ToolbarPanel(new BorderLayout());
+
+ panel.setBorder(BorderFactory.createEmptyBorder(3, 0, 3, 0));
+ panel.add(mainToolBar, BorderLayout.CENTER);
+ panel.add(contactPhotoPanel, BorderLayout.EAST);
+ panel.setVisible(chatToolbarVisible);
+
+ toolbarPanel = panel;
+ }
+
+ return toolbarPanel;
+ }
+
+ /**
* Adds a given <tt>ChatPanel</tt> to this chat window.
*
* @param chatPanel The <tt>ChatPanel</tt> to add.
@@ -783,8 +808,6 @@ public class ChatWindow
*/
private void initPluginComponents()
{
- pluginPanelNorth.setLayout(
- new BoxLayout(pluginPanelNorth, BoxLayout.Y_AXIS));
pluginPanelEast.setLayout(
new BoxLayout(pluginPanelEast, BoxLayout.Y_AXIS));
pluginPanelSouth.setLayout(
@@ -792,7 +815,6 @@ public class ChatWindow
pluginPanelWest.setLayout(
new BoxLayout(pluginPanelWest, BoxLayout.Y_AXIS));
- this.getContentPane().add(pluginPanelNorth, BorderLayout.NORTH);
this.getContentPane().add(pluginPanelEast, BorderLayout.EAST);
this.getContentPane().add(pluginPanelWest, BorderLayout.WEST);
this.mainPanel.add(pluginPanelSouth, BorderLayout.SOUTH);
@@ -940,12 +962,7 @@ public class ChatWindow
{
if (container.equals(Container.CONTAINER_CHAT_WINDOW))
{
- if (constraints.equals(BorderLayout.NORTH))
- {
- pluginPanelNorth.add(c);
- pluginPanelNorth.repaint();
- }
- else if (constraints.equals(BorderLayout.SOUTH))
+ if (constraints.equals(BorderLayout.SOUTH))
{
pluginPanelSouth.add(c);
pluginPanelSouth.repaint();
@@ -983,9 +1000,7 @@ public class ChatWindow
{
if (container.equals(Container.CONTAINER_CHAT_WINDOW))
{
- if (constraints.equals(BorderLayout.NORTH))
- pluginPanelNorth.remove(c);
- else if (constraints.equals(BorderLayout.SOUTH))
+ if (constraints.equals(BorderLayout.SOUTH))
pluginPanelSouth.remove(c);
else if (constraints.equals(BorderLayout.WEST))
pluginPanelWest.remove(c);
@@ -1239,13 +1254,13 @@ public class ChatWindow
}
}
- private static class NorthPanel
+ private static class ToolbarPanel
extends JPanel
implements Skinnable
{
private Image logoBgImage;
- public NorthPanel(LayoutManager layoutManager)
+ public ToolbarPanel(LayoutManager layoutManager)
{
super(layoutManager);
diff --git a/src/net/java/sip/communicator/impl/gui/main/configforms/ConfigFormDescriptor.java b/src/net/java/sip/communicator/impl/gui/main/configforms/ConfigFormDescriptor.java
index fba2b3c..838e439 100644
--- a/src/net/java/sip/communicator/impl/gui/main/configforms/ConfigFormDescriptor.java
+++ b/src/net/java/sip/communicator/impl/gui/main/configforms/ConfigFormDescriptor.java
@@ -24,9 +24,9 @@ import net.java.sip.communicator.util.*;
public class ConfigFormDescriptor
{
private final Logger logger = Logger.getLogger(ConfigFormDescriptor.class);
-
+
private final ConfigurationForm configForm;
-
+
private ImageIcon configFormIcon;
private Component configFormPanel;
@@ -41,20 +41,20 @@ public class ConfigFormDescriptor
public ConfigFormDescriptor(ConfigurationForm configForm)
{
this.configForm = configForm;
-
+
byte[] icon = null;
-
+
try
{
icon = configForm.getIcon();
-
+
configFormTitle = configForm.getTitle();
}
catch (Exception e)
{
logger.error("Could not load configuration form.", e);
}
-
+
if(icon != null)
configFormIcon = new ImageIcon(icon);
}
diff --git a/src/net/java/sip/communicator/impl/gui/main/configforms/ConfigFormListCellRenderer.java b/src/net/java/sip/communicator/impl/gui/main/configforms/ConfigFormListCellRenderer.java
index cd4bfeb..da5a60c 100644
--- a/src/net/java/sip/communicator/impl/gui/main/configforms/ConfigFormListCellRenderer.java
+++ b/src/net/java/sip/communicator/impl/gui/main/configforms/ConfigFormListCellRenderer.java
@@ -33,12 +33,12 @@ public class ConfigFormListCellRenderer
*/
public static final int SELECTED_GRADIENT_SIZE = 5;
- private final JLabel textLabel = new JLabel();
+ private final JLabel textLabel = new EmphasizedLabel("");
private final JLabel iconLabel = new JLabel();
private boolean isSelected = false;
-
+
/**
* Initialize the panel containing the node.
*/
@@ -49,7 +49,7 @@ public class ConfigFormListCellRenderer
this.setPreferredSize(new Dimension(60, 50));
Font font = getFont();
- this.textLabel.setFont(font.deriveFont(Font.BOLD, font.getSize() - 2));
+ this.textLabel.setFont(font.deriveFont(11f));
this.iconLabel.setHorizontalAlignment(JLabel.CENTER);
this.textLabel.setHorizontalAlignment(JLabel.CENTER);
diff --git a/src/net/java/sip/communicator/impl/gui/main/configforms/ConfigurationFrame.java b/src/net/java/sip/communicator/impl/gui/main/configforms/ConfigurationFrame.java
index b75402b..adbc347 100644
--- a/src/net/java/sip/communicator/impl/gui/main/configforms/ConfigurationFrame.java
+++ b/src/net/java/sip/communicator/impl/gui/main/configforms/ConfigurationFrame.java
@@ -17,6 +17,8 @@ import net.java.sip.communicator.util.swing.*;
import org.osgi.framework.*;
+import com.explodingpixels.macwidgets.*;
+
/**
* The <tt>ConfigurationFrame</tt> is the dialog opened when the "Options" menu
* is selected. It contains different basic configuration forms, like General,
@@ -73,7 +75,7 @@ public class ConfigurationFrame
configScrollList.setHorizontalScrollBarPolicy(
JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
- configScrollList.setBorder(BorderFactory.createEmptyBorder());
+ configScrollList.setBorder(null);
configScrollList.setOpaque(false);
configScrollList.getViewport().setOpaque(false);
configScrollList.getViewport().add(configList);
@@ -86,16 +88,18 @@ public class ConfigurationFrame
this.addDefaultForms();
TransparentPanel mainPanel
- = new TransparentPanel(new BorderLayout(5, 5));
+ = new TransparentPanel(new BorderLayout());
centerPanel.setMinimumSize(new Dimension(600, 100));
centerPanel.setMaximumSize(
- new Dimension( 600, Integer.MAX_VALUE));
+ new Dimension(600, Integer.MAX_VALUE));
this.setResizable(false);
- mainPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
mainPanel.add(centerPanel, BorderLayout.SOUTH);
- mainPanel.add(configScrollList, BorderLayout.NORTH);
+
+ JComponent topComponent = createTopComponent();
+ topComponent.add(configScrollList);
+ mainPanel.add(topComponent, BorderLayout.NORTH);
centerPanel.setBorder(BorderFactory.createEmptyBorder( BORDER_SIZE,
BORDER_SIZE,
@@ -136,6 +140,42 @@ public class ConfigurationFrame
}
/**
+ * Creates the toolbar panel for this chat window, depending on the current
+ * operating system.
+ *
+ * @return the created toolbar
+ */
+ private JComponent createTopComponent()
+ {
+ JComponent topComponent = null;
+
+ if (OSUtils.IS_MAC)
+ {
+ UnifiedToolBar macToolbarPanel = new UnifiedToolBar();
+
+ MacUtils.makeWindowLeopardStyle(getRootPane());
+
+ macToolbarPanel.getComponent().setLayout(new BorderLayout());
+ macToolbarPanel.disableBackgroundPainter();
+ macToolbarPanel.installWindowDraggerOnWindow(this);
+ centerPanel.setOpaque(true);
+ centerPanel.setBackground(
+ new Color(GuiActivator.getResources()
+ .getColor("service.gui.MAC_PANEL_BACKGROUND")));
+
+ topComponent = macToolbarPanel.getComponent();
+ }
+ else
+ {
+ JPanel panel = new TransparentPanel(new BorderLayout());
+
+ topComponent = panel;
+ }
+
+ return topComponent;
+ }
+
+ /**
* Some configuration forms constructed from the ui implementation itself
* are added here in the configuration dialog.
*/
diff --git a/src/net/java/sip/communicator/impl/gui/main/contactlist/ContactListTreeCellRenderer.java b/src/net/java/sip/communicator/impl/gui/main/contactlist/ContactListTreeCellRenderer.java
index e1331de..ba03c71 100644
--- a/src/net/java/sip/communicator/impl/gui/main/contactlist/ContactListTreeCellRenderer.java
+++ b/src/net/java/sip/communicator/impl/gui/main/contactlist/ContactListTreeCellRenderer.java
@@ -432,9 +432,20 @@ public class ContactListTreeCellRenderer
super.paintComponent(g);
g = g.create();
+
+ if (!(treeNode instanceof GroupNode) && !isSelected)
+ return;
+
+ AntialiasingManager.activateAntialiasing(g);
+
+ Graphics2D g2 = (Graphics2D) g;
+
try
{
- internalPaintComponent(g);
+ if (OSUtils.IS_MAC)
+ internalPaintComponentMacOS(g2);
+ else
+ internalPaintComponent(g2);
}
finally
{
@@ -446,17 +457,10 @@ public class ContactListTreeCellRenderer
* Paint a background for all groups and a round blue border and background
* when a cell is selected.
*
- * @param g the <tt>Graphics</tt> object through which we paint
+ * @param g2 the <tt>Graphics2D</tt> object through which we paint
*/
- private void internalPaintComponent(Graphics g)
+ private void internalPaintComponent(Graphics2D g2)
{
- if (!(treeNode instanceof GroupNode) && !isSelected)
- return;
-
- AntialiasingManager.activateAntialiasing(g);
-
- Graphics2D g2 = (Graphics2D) g;
-
Shape clipShape
= GraphicUtils.createRoundedClipShape(
getWidth(), getHeight(), 20, 20);
@@ -506,6 +510,39 @@ public class ContactListTreeCellRenderer
}
/**
+ * Paint a background for all groups and a round blue border and background
+ * when a cell is selected.
+ *
+ * @param g2 the <tt>Graphics2D</tt> object through which we paint
+ */
+ private void internalPaintComponentMacOS(Graphics2D g2)
+ {
+ Color borderColor = Color.GRAY;
+
+ if (isSelected)
+ {
+ g2.setPaint(new GradientPaint(0, 0,
+ Color.WHITE, 0, getHeight(), Constants.SELECTED_COLOR));
+
+ borderColor = Constants.SELECTED_COLOR;
+ }
+ else if (treeNode instanceof GroupNode)
+ {
+ g2.setPaint(new GradientPaint(0, 0,
+ Constants.CONTACT_LIST_GROUP_BG_GRADIENT_COLOR,
+ 0, getHeight(),
+ Constants.CONTACT_LIST_GROUP_BG_COLOR));
+
+ borderColor = Constants.CONTACT_LIST_GROUP_BG_COLOR;
+ }
+
+ g2.fillRect(0, 0, getWidth(), getHeight());
+ g2.setColor(borderColor);
+ g2.drawLine(0, 0, getWidth(), 0);
+ g2.drawLine(0, getHeight() - 1, getWidth(), getHeight() - 1);
+ }
+
+ /**
* Returns the height of this icon. Used for the drag&drop component.
* @return the height of this icon
*/
diff --git a/src/net/java/sip/communicator/impl/gui/main/contactlist/SearchFieldUI.java b/src/net/java/sip/communicator/impl/gui/main/contactlist/SearchFieldUI.java
index 9510466..89c2a05 100644
--- a/src/net/java/sip/communicator/impl/gui/main/contactlist/SearchFieldUI.java
+++ b/src/net/java/sip/communicator/impl/gui/main/contactlist/SearchFieldUI.java
@@ -109,7 +109,7 @@ public class SearchFieldUI
int dy = (c.getY() + c.getHeight()) / 2
- searchIcon.getIconHeight()/2;
- g2.drawImage(searchIcon.getImage(), c.getX(), dy + 1, null);
+ g2.drawImage(searchIcon.getImage(), c.getX() + 5, dy + 1, null);
// Paint call button.
Rectangle callRect = getCallButtonRect();
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 320ab2b..31d9923 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
@@ -41,12 +41,12 @@ public class AccountStatusPanel
/**
* The desired height of the avatar.
*/
- private static final int AVATAR_ICON_HEIGHT = 45;
+ private static final int AVATAR_ICON_HEIGHT = 40;
/**
* The desired width of the avatar.
*/
- private static final int AVATAR_ICON_WIDTH = 45;
+ private static final int AVATAR_ICON_WIDTH = 40;
/**
* The image object storing the avatar.
@@ -57,7 +57,7 @@ public class AccountStatusPanel
* The label showing the name of the user.
*/
private final JLabel accountNameLabel
- = new JLabel(
+ = new EmphasizedLabel(
GuiActivator
.getResources().getI18NString("service.gui.ACCOUNT_ME"));
@@ -106,8 +106,6 @@ public class AccountStatusPanel
{
super(new BorderLayout(10, 0));
- this.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
-
if (ConfigurationManager.isTransparentWindowEnabled())
this.setUI(new SIPCommOpaquePanelUI());
@@ -123,7 +121,7 @@ public class AccountStatusPanel
this.accountImageLabel = imageWithMenu;
accountNameLabel.setFont(
- accountNameLabel.getFont().deriveFont(Font.BOLD));
+ accountNameLabel.getFont().deriveFont(12f));
accountNameLabel.setOpaque(false);
statusComboBox = new GlobalStatusSelectorBox(mainFrame);
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 fe9f1fa..52473de 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
@@ -151,6 +151,9 @@ public class GlobalStatusSelectorBox
this.addSeparator();
+ this.setUI(new SIPCommStatusMenuUI());
+
+ this.setFont(titleLabel.getFont().deriveFont(Font.PLAIN, 11f));
this.setIcon(offlineItem.getIcon());
this.setIconTextGap(2);
this.setOpaque(false);
@@ -158,7 +161,6 @@ public class GlobalStatusSelectorBox
this.setToolTipText("<html><b>" + GuiActivator.getResources()
.getI18NString("service.gui.SET_GLOBAL_STATUS")
+ "</b></html>");
- this.setUI(new SIPCommStatusMenuUI());
fitSizeToText();
}
diff --git a/src/net/java/sip/communicator/util/swing/AuthenticationWindow.java b/src/net/java/sip/communicator/util/swing/AuthenticationWindow.java
index a676cb2..c20968d 100644
--- a/src/net/java/sip/communicator/util/swing/AuthenticationWindow.java
+++ b/src/net/java/sip/communicator/util/swing/AuthenticationWindow.java
@@ -132,6 +132,10 @@ public class AuthenticationWindow
removeWindowListener(this);
}
});
+
+ if (OSUtils.IS_MAC)
+ getRootPane()
+ .putClientProperty("apple.awt.brushMetalLook", Boolean.TRUE);
}
/**
diff --git a/src/net/java/sip/communicator/util/swing/EmphasizedLabel.java b/src/net/java/sip/communicator/util/swing/EmphasizedLabel.java
new file mode 100644
index 0000000..b43bfb3
--- /dev/null
+++ b/src/net/java/sip/communicator/util/swing/EmphasizedLabel.java
@@ -0,0 +1,99 @@
+/*
+ * 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.util.swing;
+
+import java.awt.*;
+
+import javax.swing.*;
+
+/**
+ * A label with white shadow.
+ * Based on code published on http://explodingpixels.wordpress.com.
+ *
+ * @author Yana Stamcheva
+ */
+public class EmphasizedLabel
+ extends JLabel
+{
+ private boolean fUseEmphasisColor;
+
+ /**
+ * The color used to paint the shadow.
+ */
+ public static final Color EMPHASIZED_FONT_COLOR =
+ new Color(255, 255, 255, 110);
+
+ /**
+ * The color used to paint focused view.
+ */
+ public static final Color EMPHASIZED_FOCUSED_FONT_COLOR =
+ new Color(0x000000);
+
+ /**
+ * The color used to paint unfocused view.
+ */
+ public static final Color EMPHASIZED_UNFOCUSED_FONT_COLOR =
+ new Color(0x3f3f3f);
+
+ /**
+ * Creates an instance of <tt>EmphasizedLabel</tt>.
+ *
+ * @param text the text to show in this label
+ */
+ public EmphasizedLabel(String text)
+ {
+ super(text);
+ }
+
+ /**
+ * Overrides the <tt>getPreferredSize()</tt> method in order to enlarge the
+ * height of this label, which should welcome the lightening shadow.
+ */
+ @Override
+ public Dimension getPreferredSize()
+ {
+ Dimension d = super.getPreferredSize();
+ d.height += 1;
+ return d;
+ }
+
+ /**
+ * Overrides the <tt>getForeground()</tt> method in order to provide
+ * different foreground color, depending on whether the label is focused.
+ */
+ @Override
+ public Color getForeground()
+ {
+ Color retVal;
+ Window window = SwingUtilities.getWindowAncestor(this);
+ boolean hasFoucs = window != null && window.isFocused();
+
+ if (fUseEmphasisColor)
+ retVal = EMPHASIZED_FONT_COLOR;
+ else if (hasFoucs)
+ retVal = EMPHASIZED_FOCUSED_FONT_COLOR;
+ else
+ retVal = EMPHASIZED_UNFOCUSED_FONT_COLOR;
+
+ return retVal;
+ }
+
+ /**
+ * Paints this label.
+ *
+ * @param g the <tt>Graphics</tt> object used for painting
+ */
+ @Override
+ protected void paintComponent(Graphics g)
+ {
+ fUseEmphasisColor = true;
+ g.translate(0,1);
+ super.paintComponent(g);
+ g.translate(0,-1);
+ fUseEmphasisColor = false;
+ super.paintComponent(g);
+ }
+} \ No newline at end of file
diff --git a/src/net/java/sip/communicator/util/swing/SIPCommDialog.java b/src/net/java/sip/communicator/util/swing/SIPCommDialog.java
index 0b072c6..75a31cf 100644
--- a/src/net/java/sip/communicator/util/swing/SIPCommDialog.java
+++ b/src/net/java/sip/communicator/util/swing/SIPCommDialog.java
@@ -126,7 +126,9 @@ public abstract class SIPCommDialog
*/
private void init()
{
- this.setContentPane(new SIPCommFrame.MainContentPane());
+ // If on MacOS we would use the native background.
+ if (!OSUtils.IS_MAC)
+ this.setContentPane(new SIPCommFrame.MainContentPane());
this.addWindowListener(new DialogWindowAdapter());
diff --git a/src/net/java/sip/communicator/util/swing/SIPCommFrame.java b/src/net/java/sip/communicator/util/swing/SIPCommFrame.java
index cb40a51..115c0ea 100644
--- a/src/net/java/sip/communicator/util/swing/SIPCommFrame.java
+++ b/src/net/java/sip/communicator/util/swing/SIPCommFrame.java
@@ -68,7 +68,9 @@ public abstract class SIPCommFrame
*/
public SIPCommFrame()
{
- this.setContentPane(new MainContentPane());
+ // If on MacOS we would use the native background.
+ if (!OSUtils.IS_MAC)
+ this.setContentPane(new MainContentPane());
init();