From 332089235bc7a78e24f172fdb0987ccf5b207ea8 Mon Sep 17 00:00:00 2001 From: Lyubomir Marinov Date: Thu, 4 Dec 2008 19:01:03 +0000 Subject: Moves SIPCommFrame into public visibility out of its defining bundle so that it can be used not only in the main UI but also in the plugins. Though no plugin currently takes advantage of it, I'm committing it because there're a lot of changed files involved and I don't really want to merge. --- .../gui/customcontrols/ExtListCellRenderer.java | 1 + .../impl/gui/customcontrols/FramedImage.java | 2 +- .../impl/gui/customcontrols/SCScrollPane.java | 1 + .../impl/gui/customcontrols/SIPCommButton.java | 1 + .../impl/gui/customcontrols/SIPCommDialog.java | 2 +- .../impl/gui/customcontrols/SIPCommFrame.java | 505 -------- .../gui/customcontrols/SIPCommToggleButton.java | 1 + .../impl/gui/customcontrols/SIPCommToolBar.java | 4 +- .../impl/gui/customcontrols/ScreenInformation.java | 90 -- .../gui/customcontrols/TransparentBackground.java | 3 +- .../impl/gui/lookandfeel/SIPCommButtonUI.java | 1 + .../gui/lookandfeel/SIPCommChatSelectorMenuUI.java | 1 + .../gui/lookandfeel/SIPCommCheckBoxMenuItemUI.java | 3 +- .../impl/gui/lookandfeel/SIPCommCheckBoxUI.java | 2 +- .../gui/lookandfeel/SIPCommComboBoxEditor.java | 3 +- .../impl/gui/lookandfeel/SIPCommComboBoxUI.java | 2 +- .../impl/gui/lookandfeel/SIPCommDefaultTheme.java | 3 +- .../impl/gui/lookandfeel/SIPCommEditorPaneUI.java | 3 +- .../impl/gui/lookandfeel/SIPCommLFUtils.java | 1 + .../impl/gui/lookandfeel/SIPCommLabelUI.java | 3 +- .../impl/gui/lookandfeel/SIPCommListUI.java | 2 +- .../impl/gui/lookandfeel/SIPCommMenuItemUI.java | 2 +- .../impl/gui/lookandfeel/SIPCommMenuUI.java | 2 +- .../impl/gui/lookandfeel/SIPCommOptionPaneUI.java | 3 +- .../gui/lookandfeel/SIPCommPasswordFieldUI.java | 4 +- .../impl/gui/lookandfeel/SIPCommPopupMenuUI.java | 2 +- .../gui/lookandfeel/SIPCommSelectorMenuUI.java | 1 + .../gui/lookandfeel/SIPCommSplitPaneDivider.java | 2 + .../impl/gui/lookandfeel/SIPCommStatusMenuUI.java | 3 +- .../lookandfeel/SIPCommTabbedPaneEnhancedUI.java | 1 + .../impl/gui/lookandfeel/SIPCommTextAreaUI.java | 2 +- .../impl/gui/lookandfeel/SIPCommTextFieldUI.java | 1 + .../impl/gui/lookandfeel/SIPCommTextPaneUI.java | 3 +- .../gui/lookandfeel/SIPCommToggleButtonUI.java | 1 + .../impl/gui/lookandfeel/SIPCommToolBarUI.java | 8 +- .../impl/gui/lookandfeel/SIPCommToolTipUI.java | 3 +- .../AuthorizationRequestedDialog.java | 3 +- .../authorization/AuthorizationResponseDialog.java | 1 + .../authorization/RequestAuthorizationDialog.java | 2 + .../impl/gui/main/call/AccountSelectorBox.java | 1 + .../communicator/impl/gui/main/call/DialPanel.java | 1 + .../impl/gui/main/call/HoldButton.java | 2 +- .../impl/gui/main/call/MuteButton.java | 2 +- .../impl/gui/main/call/SecureButton.java | 2 +- .../impl/gui/main/call/TransferCallButton.java | 2 +- .../communicator/impl/gui/main/call/ZrtpPanel.java | 23 +- .../gui/main/chat/ChatContactRightButtonMenu.java | 3 +- .../impl/gui/main/chat/ChatConversationPanel.java | 1 + .../gui/main/chat/ChatTransportSelectorBox.java | 1 + .../impl/gui/main/chat/ChatWindow.java | 1 + .../impl/gui/main/chat/SmiliesSelectorBox.java | 1 + .../conference/ChatRoomConfigurationWindow.java | 1 + .../main/chat/conference/ChatRoomSubjectPanel.java | 2 +- .../chat/conference/InvitationReceivedDialog.java | 1 + .../gui/main/chat/history/DatesListRenderer.java | 1 + .../gui/main/chat/menus/ChatRightButtonMenu.java | 2 +- .../impl/gui/main/chat/menus/EditMenu.java | 4 +- .../impl/gui/main/chat/menus/FileMenu.java | 3 +- .../gui/main/chat/menus/MessageWindowMenuBar.java | 3 +- .../main/chat/menus/WritePanelRightButtonMenu.java | 2 +- .../ChatRoomCommonRightButtonMenu.java | 5 +- .../chatroomslist/ChatRoomRightButtonMenu.java | 4 +- .../ChatRoomServerRightButtonMenu.java | 3 +- .../chatroomslist/ChatRoomsListCellRenderer.java | 2 +- .../createforms/ChatRoomNamePanel.java | 4 +- .../createforms/SelectAccountPanel.java | 4 +- .../joinforms/ChatRoomAuthenticationWindow.java | 5 +- .../joinforms/JoinChatRoomDialog.java | 2 +- .../joinforms/SelectAccountPanel.java | 7 +- .../gui/main/configforms/ConfigFormDescriptor.java | 2 +- .../main/contactlist/CommonRightButtonMenu.java | 2 +- .../gui/main/contactlist/ContactInfoDialog.java | 18 +- .../impl/gui/main/contactlist/ContactList.java | 2 +- .../main/contactlist/ContactListCellRenderer.java | 1 + .../main/contactlist/ContactRightButtonMenu.java | 2 +- .../gui/main/contactlist/GroupRightButtonMenu.java | 2 +- .../impl/gui/main/menus/AboutWindow.java | 1 + .../impl/gui/main/menus/ExtendedQuickMenu.java | 2 +- .../communicator/impl/gui/main/menus/FileMenu.java | 4 +- .../communicator/impl/gui/main/menus/MainMenu.java | 3 +- .../impl/gui/main/menus/MoreButton.java | 2 +- .../gui/main/presence/GlobalStatusSelectorBox.java | 1 + .../impl/gui/main/presence/PresenceStatusMenu.java | 2 +- .../impl/gui/main/presence/SimpleStatusMenu.java | 2 +- .../presence/message/NewStatusMessageDialog.java | 73 +- .../impl/gui/utils/AntialiasingManager.java | 33 - .../sip/communicator/impl/gui/utils/Constants.java | 2 +- .../communicator/impl/gui/utils/ImageLoader.java | 1316 ------------------- .../sip/communicator/impl/gui/utils/Smiley.java | 91 -- .../communicator/swing/AntialiasingManager.java | 32 + .../java/sip/communicator/swing/ImageCanvas.java | 72 ++ .../java/sip/communicator/swing/ImageLoader.java | 1318 ++++++++++++++++++++ .../java/sip/communicator/swing/SIPCommFrame.java | 504 ++++++++ .../sip/communicator/swing/ScreenInformation.java | 90 ++ src/net/java/sip/communicator/swing/Smiley.java | 90 ++ .../communicator/swing/SwingCommonActivator.java | 76 ++ .../communicator/swing/swing.common.manifest.mf | 9 +- 97 files changed, 2364 insertions(+), 2161 deletions(-) delete mode 100644 src/net/java/sip/communicator/impl/gui/customcontrols/SIPCommFrame.java delete mode 100644 src/net/java/sip/communicator/impl/gui/customcontrols/ScreenInformation.java delete mode 100644 src/net/java/sip/communicator/impl/gui/utils/AntialiasingManager.java delete mode 100644 src/net/java/sip/communicator/impl/gui/utils/ImageLoader.java delete mode 100644 src/net/java/sip/communicator/impl/gui/utils/Smiley.java create mode 100644 src/net/java/sip/communicator/swing/AntialiasingManager.java create mode 100644 src/net/java/sip/communicator/swing/ImageCanvas.java create mode 100644 src/net/java/sip/communicator/swing/ImageLoader.java create mode 100644 src/net/java/sip/communicator/swing/SIPCommFrame.java create mode 100644 src/net/java/sip/communicator/swing/ScreenInformation.java create mode 100644 src/net/java/sip/communicator/swing/Smiley.java create mode 100644 src/net/java/sip/communicator/swing/SwingCommonActivator.java (limited to 'src/net/java') diff --git a/src/net/java/sip/communicator/impl/gui/customcontrols/ExtListCellRenderer.java b/src/net/java/sip/communicator/impl/gui/customcontrols/ExtListCellRenderer.java index 72e2c5d..89867b4 100644 --- a/src/net/java/sip/communicator/impl/gui/customcontrols/ExtListCellRenderer.java +++ b/src/net/java/sip/communicator/impl/gui/customcontrols/ExtListCellRenderer.java @@ -11,6 +11,7 @@ import java.awt.*; import javax.swing.*; import net.java.sip.communicator.impl.gui.utils.*; +import net.java.sip.communicator.swing.*; /** * @author Yana Stamcheva diff --git a/src/net/java/sip/communicator/impl/gui/customcontrols/FramedImage.java b/src/net/java/sip/communicator/impl/gui/customcontrols/FramedImage.java index b9f5a30..eb0ab09 100644 --- a/src/net/java/sip/communicator/impl/gui/customcontrols/FramedImage.java +++ b/src/net/java/sip/communicator/impl/gui/customcontrols/FramedImage.java @@ -10,7 +10,7 @@ import java.awt.*; import javax.swing.*; -import net.java.sip.communicator.impl.gui.utils.*; +import net.java.sip.communicator.swing.*; import net.java.sip.communicator.util.*; /** diff --git a/src/net/java/sip/communicator/impl/gui/customcontrols/SCScrollPane.java b/src/net/java/sip/communicator/impl/gui/customcontrols/SCScrollPane.java index 4fda0e3..35bcf20 100644 --- a/src/net/java/sip/communicator/impl/gui/customcontrols/SCScrollPane.java +++ b/src/net/java/sip/communicator/impl/gui/customcontrols/SCScrollPane.java @@ -13,6 +13,7 @@ import javax.swing.*; import net.java.sip.communicator.impl.gui.*; import net.java.sip.communicator.impl.gui.utils.*; +import net.java.sip.communicator.swing.*; public class SCScrollPane extends JScrollPane diff --git a/src/net/java/sip/communicator/impl/gui/customcontrols/SIPCommButton.java b/src/net/java/sip/communicator/impl/gui/customcontrols/SIPCommButton.java index 57c2073..dea87a1 100755 --- a/src/net/java/sip/communicator/impl/gui/customcontrols/SIPCommButton.java +++ b/src/net/java/sip/communicator/impl/gui/customcontrols/SIPCommButton.java @@ -14,6 +14,7 @@ import javax.swing.*; import org.jvnet.lafwidget.animation.*; import net.java.sip.communicator.impl.gui.utils.*; +import net.java.sip.communicator.swing.*; /** * The SIPCommButton is a very flexible JButton that allows diff --git a/src/net/java/sip/communicator/impl/gui/customcontrols/SIPCommDialog.java b/src/net/java/sip/communicator/impl/gui/customcontrols/SIPCommDialog.java index 2f6a49f..8389f46 100644 --- a/src/net/java/sip/communicator/impl/gui/customcontrols/SIPCommDialog.java +++ b/src/net/java/sip/communicator/impl/gui/customcontrols/SIPCommDialog.java @@ -13,8 +13,8 @@ import java.awt.geom.*; import javax.swing.*; import net.java.sip.communicator.impl.gui.*; -import net.java.sip.communicator.impl.gui.utils.*; import net.java.sip.communicator.service.configuration.*; +import net.java.sip.communicator.swing.*; import net.java.sip.communicator.util.*; public abstract class SIPCommDialog extends JDialog diff --git a/src/net/java/sip/communicator/impl/gui/customcontrols/SIPCommFrame.java b/src/net/java/sip/communicator/impl/gui/customcontrols/SIPCommFrame.java deleted file mode 100644 index 9c2e97e..0000000 --- a/src/net/java/sip/communicator/impl/gui/customcontrols/SIPCommFrame.java +++ /dev/null @@ -1,505 +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 java.awt.geom.*; -import java.util.*; - -import javax.swing.*; - -import net.java.sip.communicator.impl.gui.*; -import net.java.sip.communicator.impl.gui.utils.*; -import net.java.sip.communicator.service.configuration.*; -import net.java.sip.communicator.service.keybindings.*; -import net.java.sip.communicator.service.resources.*; -import net.java.sip.communicator.util.*; - -/** - * A custom frame that remembers its size and location and could have a semi - * transparent background. - * - * @author Yana Stamcheva - */ -public abstract class SIPCommFrame - extends JFrame - implements Observer -{ - private final Logger logger = Logger.getLogger(SIPCommFrame.class); - - private final ActionMap amap; - - private final InputMap imap; - - private KeybindingSet bindings = null; - - public SIPCommFrame() - { - this.setContentPane(new MainContentPane()); - - Image scLogo = ImageLoader.getImage(ImageLoader.SIP_COMMUNICATOR_LOGO); - this.setIconImage(scLogo); - - // In order to have the same icon when using option panes - JOptionPane.getRootFrame().setIconImage(scLogo); - - this.addWindowListener(new FrameWindowAdapter()); - - JRootPane rootPane = getRootPane(); - amap = rootPane.getActionMap(); - amap.put("close", new CloseAction()); - - imap = - rootPane.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT); - } - - /** - * The action invoked when user presses Escape key. - */ - private class CloseAction - extends AbstractAction - { - public void actionPerformed(ActionEvent e) - { - saveSizeAndLocation(); - close(true); - } - } - - /** - * Sets the input map to utilize a given category of keybindings. The frame - * is updated to reflect the new bindings when they change. This replaces - * any previous bindings that have been added. - * - * @param category set of keybindings to be utilized - */ - protected void setKeybindingInput(KeybindingSet.Category category) - { - // Removes old binding set - if (this.bindings != null) - { - this.bindings.deleteObserver(this); - resetInputMap(); - } - - // Adds new bindings to input map - this.bindings = - GuiActivator.getKeybindingsService().getBindings(category); - - for (Map.Entry key2action : this.bindings - .getBindings().entrySet()) - { - imap.put(key2action.getKey(), key2action.getValue()); - } - - this.bindings.addObserver(this); - } - - /** - * Bindings the string representation for a keybinding to the action that - * will be executed. - * - * @param binding string representation of action used by input map - * @param action the action which will be executed when user presses the - * given key combination - */ - protected void addKeybindingAction(String binding, Action action) - { - amap.put(binding, action); - } - - /** - * Before closing the application window saves the current size and position - * through the ConfigurationService. - */ - public class FrameWindowAdapter - extends WindowAdapter - { - public void windowClosing(WindowEvent e) - { - saveSizeAndLocation(); - - close(false); - } - } - - /** - * Saves the size and the location of this frame through the - * ConfigurationService. - */ - private void saveSizeAndLocation() - { - ConfigurationService configService = - GuiActivator.getConfigurationService(); - - String className = this.getClass().getName(); - - try - { - configService.setProperty(className + ".width", new Integer( - getWidth())); - - configService.setProperty(className + ".height", new Integer( - getHeight())); - - configService.setProperty(className + ".x", new Integer(getX())); - - configService.setProperty(className + ".y", new Integer(getY())); - } - catch (PropertyVetoException e1) - { - logger.error("The proposed property change " - + "represents an unacceptable value"); - } - } - - /** - * Sets window size and position. - */ - public void setSizeAndLocation() - { - ConfigurationService configService = - GuiActivator.getConfigurationService(); - - String className = this.getClass().getName(); - - String widthString = configService.getString(className + ".width"); - - String heightString = configService.getString(className + ".height"); - - String xString = configService.getString(className + ".x"); - - String yString = configService.getString(className + ".y"); - - int width = 0; - int height = 0; - - if (widthString != null && heightString != null) - { - width = new Integer(widthString).intValue(); - height = new Integer(heightString).intValue(); - - if (width > 0 && height > 0) - { - Dimension screenSize = - Toolkit.getDefaultToolkit().getScreenSize(); - if (width <= screenSize.width && height <= screenSize.height) - this.setSize(width, height); - } - } - - int x = 0; - int y = 0; - - if (xString != null && yString != null) - { - x = new Integer(xString).intValue(); - y = new Integer(yString).intValue(); - - this.setLocation(x, y); - } - else - { - this.setCenterLocation(); - } - } - - /** - * Positions this window in the center of the screen. - */ - private void setCenterLocation() - { - Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); - this.setLocation(screenSize.width / 2 - this.getWidth() / 2, - screenSize.height / 2 - this.getHeight() / 2); - } - - /** - * Checks whether the current component will exceeds the screen size and if - * it do will set a default size - */ - private void ensureOnScreenLocationAndSize() - { - int x = this.getX(); - int y = this.getY(); - - int width = this.getWidth(); - int height = this.getHeight(); - - Rectangle virtualBounds = ScreenInformation.getScreenBounds(); - - // the default distance to the screen border - final int borderDistance = 10; - - // in case any of the sizes exceeds the screen size - // we set default one - // get the left upper point of the window - if (!(virtualBounds.contains(x, y))) - { - // top left exceeds screen bounds - if (x < virtualBounds.x) - { - // window is too far to the left - // move it to the right - x = virtualBounds.x + borderDistance; - } - else if (x > virtualBounds.x) - { - // window is too far to the right - // can only occour, when screen resolution is - // changed or displayed are disconnected - - // move the window in the bounds to the very right - x = - virtualBounds.x + virtualBounds.width - width - - borderDistance; - if (x < virtualBounds.x + borderDistance) - { - x = virtualBounds.x + borderDistance; - } - } - - // top left exceeds screen bounds - if (y < virtualBounds.y) - { - // window is too far to the top - // move it to the bottom - y = virtualBounds.y + borderDistance; - } - else if (y > virtualBounds.y) - { - // window is too far to the bottom - // can only occour, when screen resolution is - // changed or displayed are disconnected - - // move the window in the bounds to the very bottom - y = - virtualBounds.y + virtualBounds.height - height - - borderDistance; - if (y < virtualBounds.y + borderDistance) - { - y = virtualBounds.y + borderDistance; - } - } - this.setLocation(x, y); - } - - // check the lower right corder - if (!(virtualBounds.contains(x + width, y + height))) - { - - if (x + width > virtualBounds.x + virtualBounds.width) - { - // location of window is too far to the right, its right - // border is out of bounds - - // calculate a new horizontal position - // move the whole window to the left - x = - virtualBounds.x + virtualBounds.width - width - - borderDistance; - if (x < virtualBounds.x + borderDistance) - { - // window is already on left side, it is too wide. - x = virtualBounds.x + borderDistance; - // reduce the width, so it surely fits - width = virtualBounds.width - 2 * borderDistance; - } - } - if (y + height > virtualBounds.y + virtualBounds.height) - { - // location of window is too far to the bottom, its bottom - // border is out of bounds - - // calculate a new vertical position - // move the whole window to the top - y = - virtualBounds.y + virtualBounds.height - height - - borderDistance; - if (y < virtualBounds.y + borderDistance) - { - // window is already on top, it is too high. - y = virtualBounds.y + borderDistance; - // reduce the width, so it surely fits - height = virtualBounds.height - 2 * borderDistance; - } - } - this.setPreferredSize(new Dimension(width, height)); - this.setSize(width, height); - this.setLocation(x, y); - } - } - - /** - * Overwrites the setVisible method in order to set the size and the - * position of this window before showing it. - */ - public void setVisible(boolean isVisible) - { - if (isVisible) - { - this.setSizeAndLocation(); - - this.ensureOnScreenLocationAndSize(); - } - - super.setVisible(isVisible); - } - - /** - * Overwrites the dispose method in order to save the size and the position - * of this window before closing it. - */ - public void dispose() - { - this.saveSizeAndLocation(); - - /* - * The keybinding service will outlive us so don't let us retain our - * memory. - */ - if (bindings != null) - bindings.deleteObserver(this); - - super.dispose(); - } - - private void resetInputMap() - { - imap.clear(); - imap.put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), "close"); - } - - /** - * Listens for changes in binding sets so they can be reflected in the input - * map - */ - public void update(Observable obs, Object arg) - { - if (obs instanceof KeybindingSet) - { - KeybindingSet changedBindings = (KeybindingSet) obs; - - resetInputMap(); - for (Map.Entry key2action : changedBindings - .getBindings().entrySet()) - { - imap.put(key2action.getKey(), key2action.getValue()); - } - } - } - - private static class MainContentPane - extends JPanel - { - private final boolean isColorBgEnabled; - - private final Color bgStartColor; - - private final Color bgEndColor; - - public MainContentPane() - { - super(new BorderLayout()); - - ResourceManagementService resources = GuiActivator.getResources(); - - isColorBgEnabled = - new Boolean(resources.getSettingsString( - "impl.gui.IS_WINDOW_COLOR_BACKGROUND_ENABLED")) - .booleanValue(); - if (isColorBgEnabled) - { - bgStartColor = - new Color(resources.getColor("service.gui.MAIN_BACKGROUND")); - bgEndColor = - new Color(resources - .getColor("service.gui.MAIN_BACKGROUND_GRADIENT")); - - int borderSize = - resources - .getSettingsInt("impl.gui.MAIN_WINDOW_BORDER_SIZE"); - this.setBorder(BorderFactory.createEmptyBorder(borderSize, - borderSize, borderSize, borderSize)); - } - else - { - bgStartColor = null; - bgEndColor = null; - } - } - - public void paintComponent(Graphics g) - { - super.paintComponent(g); - - // If the custom color window background is not enabled we have - // nothing to do here. - if (!isColorBgEnabled) - return; - - g = g.create(); - try - { - internalPaintComponent(g); - } - finally - { - g.dispose(); - } - } - - private void internalPaintComponent(Graphics g) - { - AntialiasingManager.activateAntialiasing(g); - - Graphics2D g2 = (Graphics2D) g; - int width = getWidth(); - int height = getHeight(); - - GradientPaint bgGradientColor = - new GradientPaint(width / 2, 0, bgStartColor, width / 2, 80, - bgEndColor); - - g2.setPaint(bgGradientColor); - g2.fillRect(0, 0, width, 80); - - g2.setColor(bgEndColor); - g2.fillRect(0, 78, width, height); - - GradientPaint curveShadow = - new GradientPaint(0, 0, new Color(255, 255, 255, 150), width, - height, new Color(255, 255, 255, 50)); - - g2.setPaint(curveShadow); - g2.setStroke(new BasicStroke(1f)); - CubicCurve2D curve1 = - new CubicCurve2D.Float(50, -1, 250, 30, 50, 150, 0, 300); - - g2.draw(curve1); - - CubicCurve2D curve2 = - new CubicCurve2D.Float(width - 20, 0, width, 100, width / 2, - 100, 0, 150); - - g2.draw(curve2); - - CubicCurve2D curve3 = - new CubicCurve2D.Float(0, 90, width / 3, 60, 2 * width / 3, 60, - width, 90); - - g2.draw(curve3); - } - } - - /** - * All functions implemented in this method will be invoked when user - * presses the Escape key. - */ - protected abstract void close(boolean isEscaped); -} diff --git a/src/net/java/sip/communicator/impl/gui/customcontrols/SIPCommToggleButton.java b/src/net/java/sip/communicator/impl/gui/customcontrols/SIPCommToggleButton.java index 7acb2ab..c2e0f0d 100644 --- a/src/net/java/sip/communicator/impl/gui/customcontrols/SIPCommToggleButton.java +++ b/src/net/java/sip/communicator/impl/gui/customcontrols/SIPCommToggleButton.java @@ -11,6 +11,7 @@ import java.awt.*; import javax.swing.*; import net.java.sip.communicator.impl.gui.utils.*; +import net.java.sip.communicator.swing.*; /** * The SIPCommToggleButton is a flexible JToggleButton that diff --git a/src/net/java/sip/communicator/impl/gui/customcontrols/SIPCommToolBar.java b/src/net/java/sip/communicator/impl/gui/customcontrols/SIPCommToolBar.java index 7b1c9c8..df8ea96 100644 --- a/src/net/java/sip/communicator/impl/gui/customcontrols/SIPCommToolBar.java +++ b/src/net/java/sip/communicator/impl/gui/customcontrols/SIPCommToolBar.java @@ -4,15 +4,15 @@ * 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.image.*; + import javax.swing.*; import net.java.sip.communicator.impl.gui.lookandfeel.*; -import net.java.sip.communicator.impl.gui.utils.*; +import net.java.sip.communicator.swing.*; /** * The SIPCommToolBar is a JToolBar, which has its own drag icon diff --git a/src/net/java/sip/communicator/impl/gui/customcontrols/ScreenInformation.java b/src/net/java/sip/communicator/impl/gui/customcontrols/ScreenInformation.java deleted file mode 100644 index 2953704..0000000 --- a/src/net/java/sip/communicator/impl/gui/customcontrols/ScreenInformation.java +++ /dev/null @@ -1,90 +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.*; - -/** - * A class which reads the screen bounds once and provides this information - * - * @author Thomas Hofer - * - */ -public class ScreenInformation -{ - private static Rectangle screenBounds = null; - - public static synchronized void init() - { - if (screenBounds == null) - { - final GraphicsEnvironment ge = GraphicsEnvironment - .getLocalGraphicsEnvironment(); - final GraphicsDevice[] gs = ge.getScreenDevices(); - - screenBounds = new Rectangle(); - - if (gs.length > 1) - { - - // create a thread for each display, as the query is very slow - Thread thread[] = new Thread[gs.length]; - for (int j = 0; j < gs.length; j++) - { - final int j1 = j; - thread[j] = new Thread(new Runnable() - { - public void run() - { - Rectangle screenDeviceBounds = new Rectangle(); - GraphicsDevice gd = gs[j1]; - GraphicsConfiguration[] gc = gd.getConfigurations(); - for (int i = 0; i < gc.length; i++) - { - screenDeviceBounds = screenDeviceBounds - .union(gc[i].getBounds()); - } - screenBounds.setBounds(screenBounds - .union(screenDeviceBounds)); - - } - }); - thread[j].start(); - } - for (int j = 0; j < gs.length; j++) - { - // wait for all threads here - try - { - thread[j].join(); - } catch (InterruptedException e) - { - } - } - } else - { - // only one display, get the screen size directy. this method - // is much faster, but can only handle the primary display - Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); - screenBounds.setBounds(0, 0, dim.width, dim.height); - } - - } - } - - public static synchronized Rectangle getScreenBounds() - { - // the initialization needs a moment - // prevent a concurrent initalization - if (screenBounds == null) - { - init(); - } - - return screenBounds; - } -} diff --git a/src/net/java/sip/communicator/impl/gui/customcontrols/TransparentBackground.java b/src/net/java/sip/communicator/impl/gui/customcontrols/TransparentBackground.java index 4a3b9b9..116c395 100644 --- a/src/net/java/sip/communicator/impl/gui/customcontrols/TransparentBackground.java +++ b/src/net/java/sip/communicator/impl/gui/customcontrols/TransparentBackground.java @@ -4,14 +4,15 @@ * 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.image.*; + import javax.swing.*; import net.java.sip.communicator.impl.gui.utils.*; +import net.java.sip.communicator.swing.*; /** * The TransparentBackground is a JComponent, which is diff --git a/src/net/java/sip/communicator/impl/gui/lookandfeel/SIPCommButtonUI.java b/src/net/java/sip/communicator/impl/gui/lookandfeel/SIPCommButtonUI.java index db14e0a..404e77f 100644 --- a/src/net/java/sip/communicator/impl/gui/lookandfeel/SIPCommButtonUI.java +++ b/src/net/java/sip/communicator/impl/gui/lookandfeel/SIPCommButtonUI.java @@ -13,6 +13,7 @@ import javax.swing.plaf.*; import javax.swing.plaf.metal.*; import net.java.sip.communicator.impl.gui.utils.*; +import net.java.sip.communicator.swing.*; /** * SIPCommButtonUI implementation. diff --git a/src/net/java/sip/communicator/impl/gui/lookandfeel/SIPCommChatSelectorMenuUI.java b/src/net/java/sip/communicator/impl/gui/lookandfeel/SIPCommChatSelectorMenuUI.java index 729dc9e..1d1778d 100644 --- a/src/net/java/sip/communicator/impl/gui/lookandfeel/SIPCommChatSelectorMenuUI.java +++ b/src/net/java/sip/communicator/impl/gui/lookandfeel/SIPCommChatSelectorMenuUI.java @@ -14,6 +14,7 @@ import javax.swing.plaf.basic.*; import net.java.sip.communicator.impl.gui.*; import net.java.sip.communicator.impl.gui.utils.*; +import net.java.sip.communicator.swing.*; /** * The SIPCommChatSelectorMenuUI implementation. diff --git a/src/net/java/sip/communicator/impl/gui/lookandfeel/SIPCommCheckBoxMenuItemUI.java b/src/net/java/sip/communicator/impl/gui/lookandfeel/SIPCommCheckBoxMenuItemUI.java index 7c14847..b763f5c 100644 --- a/src/net/java/sip/communicator/impl/gui/lookandfeel/SIPCommCheckBoxMenuItemUI.java +++ b/src/net/java/sip/communicator/impl/gui/lookandfeel/SIPCommCheckBoxMenuItemUI.java @@ -12,7 +12,8 @@ import javax.swing.*; import javax.swing.plaf.*; import javax.swing.plaf.basic.*; -import net.java.sip.communicator.impl.gui.utils.*; +import net.java.sip.communicator.swing.*; + /** * The SIPCommCheckBoxMenuItemUI implementation. * diff --git a/src/net/java/sip/communicator/impl/gui/lookandfeel/SIPCommCheckBoxUI.java b/src/net/java/sip/communicator/impl/gui/lookandfeel/SIPCommCheckBoxUI.java index 3ce0e8f..0bbc3a4 100644 --- a/src/net/java/sip/communicator/impl/gui/lookandfeel/SIPCommCheckBoxUI.java +++ b/src/net/java/sip/communicator/impl/gui/lookandfeel/SIPCommCheckBoxUI.java @@ -12,7 +12,7 @@ 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.swing.*; /** * SIPCommCheckBoxUI implementation. diff --git a/src/net/java/sip/communicator/impl/gui/lookandfeel/SIPCommComboBoxEditor.java b/src/net/java/sip/communicator/impl/gui/lookandfeel/SIPCommComboBoxEditor.java index 66af56f..c31cf74 100644 --- a/src/net/java/sip/communicator/impl/gui/lookandfeel/SIPCommComboBoxEditor.java +++ b/src/net/java/sip/communicator/impl/gui/lookandfeel/SIPCommComboBoxEditor.java @@ -8,10 +8,11 @@ package net.java.sip.communicator.impl.gui.lookandfeel; import java.awt.*; import java.awt.geom.*; + import javax.swing.border.*; import javax.swing.plaf.metal.*; -import net.java.sip.communicator.impl.gui.utils.*; +import net.java.sip.communicator.swing.*; /** * The default editor for SIPCommunicator editable combo boxes. diff --git a/src/net/java/sip/communicator/impl/gui/lookandfeel/SIPCommComboBoxUI.java b/src/net/java/sip/communicator/impl/gui/lookandfeel/SIPCommComboBoxUI.java index f3df29f..7a817fb 100644 --- a/src/net/java/sip/communicator/impl/gui/lookandfeel/SIPCommComboBoxUI.java +++ b/src/net/java/sip/communicator/impl/gui/lookandfeel/SIPCommComboBoxUI.java @@ -11,7 +11,7 @@ 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.swing.*; /** * SIPCommComboBoxUI implementation. diff --git a/src/net/java/sip/communicator/impl/gui/lookandfeel/SIPCommDefaultTheme.java b/src/net/java/sip/communicator/impl/gui/lookandfeel/SIPCommDefaultTheme.java index 9cbec29..aa0ff79 100644 --- a/src/net/java/sip/communicator/impl/gui/lookandfeel/SIPCommDefaultTheme.java +++ b/src/net/java/sip/communicator/impl/gui/lookandfeel/SIPCommDefaultTheme.java @@ -5,10 +5,10 @@ */ package net.java.sip.communicator.impl.gui.lookandfeel; +import java.awt.*; import java.util.*; import java.util.List; -import java.awt.*; import javax.swing.*; import javax.swing.plaf.*; import javax.swing.plaf.metal.*; @@ -16,6 +16,7 @@ import javax.swing.text.*; import net.java.sip.communicator.impl.gui.*; import net.java.sip.communicator.impl.gui.utils.*; +import net.java.sip.communicator.swing.*; /** * SipCommunicator default theme. diff --git a/src/net/java/sip/communicator/impl/gui/lookandfeel/SIPCommEditorPaneUI.java b/src/net/java/sip/communicator/impl/gui/lookandfeel/SIPCommEditorPaneUI.java index c199eec..cf55d0b 100644 --- a/src/net/java/sip/communicator/impl/gui/lookandfeel/SIPCommEditorPaneUI.java +++ b/src/net/java/sip/communicator/impl/gui/lookandfeel/SIPCommEditorPaneUI.java @@ -7,11 +7,12 @@ package net.java.sip.communicator.impl.gui.lookandfeel; import java.awt.*; + import javax.swing.*; import javax.swing.plaf.*; import javax.swing.plaf.basic.*; -import net.java.sip.communicator.impl.gui.utils.*; +import net.java.sip.communicator.swing.*; /** * The SIPCommEditorPaneUI implementation. diff --git a/src/net/java/sip/communicator/impl/gui/lookandfeel/SIPCommLFUtils.java b/src/net/java/sip/communicator/impl/gui/lookandfeel/SIPCommLFUtils.java index 7060bc7..e9aef89 100644 --- a/src/net/java/sip/communicator/impl/gui/lookandfeel/SIPCommLFUtils.java +++ b/src/net/java/sip/communicator/impl/gui/lookandfeel/SIPCommLFUtils.java @@ -9,6 +9,7 @@ package net.java.sip.communicator.impl.gui.lookandfeel; import java.awt.*; import net.java.sip.communicator.impl.gui.utils.*; +import net.java.sip.communicator.swing.*; /** * diff --git a/src/net/java/sip/communicator/impl/gui/lookandfeel/SIPCommLabelUI.java b/src/net/java/sip/communicator/impl/gui/lookandfeel/SIPCommLabelUI.java index 0f9388e..d785c86 100644 --- a/src/net/java/sip/communicator/impl/gui/lookandfeel/SIPCommLabelUI.java +++ b/src/net/java/sip/communicator/impl/gui/lookandfeel/SIPCommLabelUI.java @@ -7,11 +7,12 @@ package net.java.sip.communicator.impl.gui.lookandfeel; import java.awt.*; + 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.swing.*; /** * The SIPCommLabelUI implementation. diff --git a/src/net/java/sip/communicator/impl/gui/lookandfeel/SIPCommListUI.java b/src/net/java/sip/communicator/impl/gui/lookandfeel/SIPCommListUI.java index 3cd0a89..dff8f08 100644 --- a/src/net/java/sip/communicator/impl/gui/lookandfeel/SIPCommListUI.java +++ b/src/net/java/sip/communicator/impl/gui/lookandfeel/SIPCommListUI.java @@ -12,7 +12,7 @@ import javax.swing.*; import javax.swing.plaf.*; import javax.swing.plaf.basic.*; -import net.java.sip.communicator.impl.gui.utils.*; +import net.java.sip.communicator.swing.*; /** * SIPCommListUI is an implementation of the BasicListUI. diff --git a/src/net/java/sip/communicator/impl/gui/lookandfeel/SIPCommMenuItemUI.java b/src/net/java/sip/communicator/impl/gui/lookandfeel/SIPCommMenuItemUI.java index 92c30c6..9e164e7 100644 --- a/src/net/java/sip/communicator/impl/gui/lookandfeel/SIPCommMenuItemUI.java +++ b/src/net/java/sip/communicator/impl/gui/lookandfeel/SIPCommMenuItemUI.java @@ -12,7 +12,7 @@ import javax.swing.*; import javax.swing.plaf.*; import javax.swing.plaf.basic.*; -import net.java.sip.communicator.impl.gui.utils.*; +import net.java.sip.communicator.swing.*; /** * The SIPCommMenuItemUI implementation. diff --git a/src/net/java/sip/communicator/impl/gui/lookandfeel/SIPCommMenuUI.java b/src/net/java/sip/communicator/impl/gui/lookandfeel/SIPCommMenuUI.java index 67139e4..086c6a7 100644 --- a/src/net/java/sip/communicator/impl/gui/lookandfeel/SIPCommMenuUI.java +++ b/src/net/java/sip/communicator/impl/gui/lookandfeel/SIPCommMenuUI.java @@ -11,7 +11,7 @@ import javax.swing.*; import javax.swing.plaf.*; import javax.swing.plaf.basic.*; -import net.java.sip.communicator.impl.gui.utils.*; +import net.java.sip.communicator.swing.*; /** * The SIPCommMenuUI implementation. diff --git a/src/net/java/sip/communicator/impl/gui/lookandfeel/SIPCommOptionPaneUI.java b/src/net/java/sip/communicator/impl/gui/lookandfeel/SIPCommOptionPaneUI.java index 8c31a5d..f252bbf 100644 --- a/src/net/java/sip/communicator/impl/gui/lookandfeel/SIPCommOptionPaneUI.java +++ b/src/net/java/sip/communicator/impl/gui/lookandfeel/SIPCommOptionPaneUI.java @@ -7,11 +7,12 @@ package net.java.sip.communicator.impl.gui.lookandfeel; import java.awt.*; + import javax.swing.*; import javax.swing.plaf.*; import javax.swing.plaf.basic.*; -import net.java.sip.communicator.impl.gui.utils.*; +import net.java.sip.communicator.swing.*; /** * The SIPCommOptionPaneUI implementation. diff --git a/src/net/java/sip/communicator/impl/gui/lookandfeel/SIPCommPasswordFieldUI.java b/src/net/java/sip/communicator/impl/gui/lookandfeel/SIPCommPasswordFieldUI.java index 16ba175..80bf980 100644 --- a/src/net/java/sip/communicator/impl/gui/lookandfeel/SIPCommPasswordFieldUI.java +++ b/src/net/java/sip/communicator/impl/gui/lookandfeel/SIPCommPasswordFieldUI.java @@ -7,12 +7,14 @@ package net.java.sip.communicator.impl.gui.lookandfeel; import java.awt.*; + import javax.swing.*; import javax.swing.plaf.*; import javax.swing.plaf.basic.*; import javax.swing.text.*; -import net.java.sip.communicator.impl.gui.utils.*; +import net.java.sip.communicator.swing.*; + /** * The SIPCommPasswordFieldUI implementation. * diff --git a/src/net/java/sip/communicator/impl/gui/lookandfeel/SIPCommPopupMenuUI.java b/src/net/java/sip/communicator/impl/gui/lookandfeel/SIPCommPopupMenuUI.java index b285b9e..8369d95 100644 --- a/src/net/java/sip/communicator/impl/gui/lookandfeel/SIPCommPopupMenuUI.java +++ b/src/net/java/sip/communicator/impl/gui/lookandfeel/SIPCommPopupMenuUI.java @@ -12,7 +12,7 @@ import javax.swing.*; import javax.swing.plaf.*; import javax.swing.plaf.basic.*; -import net.java.sip.communicator.impl.gui.utils.*; +import net.java.sip.communicator.swing.*; /** * SIPCommPopupMenuUI implementation. diff --git a/src/net/java/sip/communicator/impl/gui/lookandfeel/SIPCommSelectorMenuUI.java b/src/net/java/sip/communicator/impl/gui/lookandfeel/SIPCommSelectorMenuUI.java index 8c8dd48..31cf18f 100644 --- a/src/net/java/sip/communicator/impl/gui/lookandfeel/SIPCommSelectorMenuUI.java +++ b/src/net/java/sip/communicator/impl/gui/lookandfeel/SIPCommSelectorMenuUI.java @@ -13,6 +13,7 @@ import javax.swing.plaf.*; import javax.swing.plaf.basic.*; import net.java.sip.communicator.impl.gui.utils.*; +import net.java.sip.communicator.swing.*; /** * The SIPCommSelectorMenuUI implementation. diff --git a/src/net/java/sip/communicator/impl/gui/lookandfeel/SIPCommSplitPaneDivider.java b/src/net/java/sip/communicator/impl/gui/lookandfeel/SIPCommSplitPaneDivider.java index 3c67faa..5224091 100644 --- a/src/net/java/sip/communicator/impl/gui/lookandfeel/SIPCommSplitPaneDivider.java +++ b/src/net/java/sip/communicator/impl/gui/lookandfeel/SIPCommSplitPaneDivider.java @@ -8,12 +8,14 @@ package net.java.sip.communicator.impl.gui.lookandfeel; import java.awt.*; import java.awt.image.*; + import javax.swing.*; import javax.swing.border.*; import javax.swing.plaf.basic.*; import javax.swing.plaf.metal.*; import net.java.sip.communicator.impl.gui.utils.*; +import net.java.sip.communicator.swing.*; /** * Divider used by SIPCommSplitPaneUI. diff --git a/src/net/java/sip/communicator/impl/gui/lookandfeel/SIPCommStatusMenuUI.java b/src/net/java/sip/communicator/impl/gui/lookandfeel/SIPCommStatusMenuUI.java index c98203d..172b21e 100644 --- a/src/net/java/sip/communicator/impl/gui/lookandfeel/SIPCommStatusMenuUI.java +++ b/src/net/java/sip/communicator/impl/gui/lookandfeel/SIPCommStatusMenuUI.java @@ -11,8 +11,7 @@ import javax.swing.*; import javax.swing.plaf.*; import javax.swing.plaf.basic.*; -import net.java.sip.communicator.impl.gui.*; -import net.java.sip.communicator.impl.gui.utils.*; +import net.java.sip.communicator.swing.*; /** * The SIPCommMenuUI implementation. diff --git a/src/net/java/sip/communicator/impl/gui/lookandfeel/SIPCommTabbedPaneEnhancedUI.java b/src/net/java/sip/communicator/impl/gui/lookandfeel/SIPCommTabbedPaneEnhancedUI.java index 8c0acc0..0b4cf72 100644 --- a/src/net/java/sip/communicator/impl/gui/lookandfeel/SIPCommTabbedPaneEnhancedUI.java +++ b/src/net/java/sip/communicator/impl/gui/lookandfeel/SIPCommTabbedPaneEnhancedUI.java @@ -21,6 +21,7 @@ import javax.swing.text.*; import net.java.sip.communicator.impl.gui.*; import net.java.sip.communicator.impl.gui.utils.*; +import net.java.sip.communicator.swing.*; /** * This UI displays a different interface, which is independent from the look diff --git a/src/net/java/sip/communicator/impl/gui/lookandfeel/SIPCommTextAreaUI.java b/src/net/java/sip/communicator/impl/gui/lookandfeel/SIPCommTextAreaUI.java index 1bd29c9..d886477 100644 --- a/src/net/java/sip/communicator/impl/gui/lookandfeel/SIPCommTextAreaUI.java +++ b/src/net/java/sip/communicator/impl/gui/lookandfeel/SIPCommTextAreaUI.java @@ -11,7 +11,7 @@ import javax.swing.*; import javax.swing.plaf.*; import javax.swing.plaf.basic.*; -import net.java.sip.communicator.impl.gui.utils.*; +import net.java.sip.communicator.swing.*; /** * SIPCommTextAreaUI implementation. 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 cf56ab3..9904e8f 100644 --- a/src/net/java/sip/communicator/impl/gui/lookandfeel/SIPCommTextFieldUI.java +++ b/src/net/java/sip/communicator/impl/gui/lookandfeel/SIPCommTextFieldUI.java @@ -15,6 +15,7 @@ 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.swing.*; /** * SIPCommTextFieldUI implementation. diff --git a/src/net/java/sip/communicator/impl/gui/lookandfeel/SIPCommTextPaneUI.java b/src/net/java/sip/communicator/impl/gui/lookandfeel/SIPCommTextPaneUI.java index fd1012a..f7cfac8 100644 --- a/src/net/java/sip/communicator/impl/gui/lookandfeel/SIPCommTextPaneUI.java +++ b/src/net/java/sip/communicator/impl/gui/lookandfeel/SIPCommTextPaneUI.java @@ -7,11 +7,12 @@ package net.java.sip.communicator.impl.gui.lookandfeel; import java.awt.*; + import javax.swing.*; import javax.swing.plaf.*; import javax.swing.plaf.basic.*; -import net.java.sip.communicator.impl.gui.utils.*; +import net.java.sip.communicator.swing.*; /** * SIPCommTextPaneUI implementation. diff --git a/src/net/java/sip/communicator/impl/gui/lookandfeel/SIPCommToggleButtonUI.java b/src/net/java/sip/communicator/impl/gui/lookandfeel/SIPCommToggleButtonUI.java index b6e5ad5..bd33f59 100644 --- a/src/net/java/sip/communicator/impl/gui/lookandfeel/SIPCommToggleButtonUI.java +++ b/src/net/java/sip/communicator/impl/gui/lookandfeel/SIPCommToggleButtonUI.java @@ -13,6 +13,7 @@ import javax.swing.plaf.*; import javax.swing.plaf.basic.*; import net.java.sip.communicator.impl.gui.utils.*; +import net.java.sip.communicator.swing.*; /** * SIPCommToggleButtonUI implementation. diff --git a/src/net/java/sip/communicator/impl/gui/lookandfeel/SIPCommToolBarUI.java b/src/net/java/sip/communicator/impl/gui/lookandfeel/SIPCommToolBarUI.java index 201d999..7234361 100644 --- a/src/net/java/sip/communicator/impl/gui/lookandfeel/SIPCommToolBarUI.java +++ b/src/net/java/sip/communicator/impl/gui/lookandfeel/SIPCommToolBarUI.java @@ -1,3 +1,9 @@ +/* + * 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.lookandfeel; import java.awt.*; @@ -6,7 +12,7 @@ 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.swing.*; /** * SIPCommToolBarUI implementation. diff --git a/src/net/java/sip/communicator/impl/gui/lookandfeel/SIPCommToolTipUI.java b/src/net/java/sip/communicator/impl/gui/lookandfeel/SIPCommToolTipUI.java index e872d7e..387b1e0 100644 --- a/src/net/java/sip/communicator/impl/gui/lookandfeel/SIPCommToolTipUI.java +++ b/src/net/java/sip/communicator/impl/gui/lookandfeel/SIPCommToolTipUI.java @@ -7,11 +7,12 @@ package net.java.sip.communicator.impl.gui.lookandfeel; import java.awt.*; + import javax.swing.*; import javax.swing.plaf.*; import javax.swing.plaf.basic.*; -import net.java.sip.communicator.impl.gui.utils.*; +import net.java.sip.communicator.swing.*; /** * SIPCommToolTipUI implementation. diff --git a/src/net/java/sip/communicator/impl/gui/main/authorization/AuthorizationRequestedDialog.java b/src/net/java/sip/communicator/impl/gui/main/authorization/AuthorizationRequestedDialog.java index 51dfb1b..5fd13df 100644 --- a/src/net/java/sip/communicator/impl/gui/main/authorization/AuthorizationRequestedDialog.java +++ b/src/net/java/sip/communicator/impl/gui/main/authorization/AuthorizationRequestedDialog.java @@ -8,6 +8,7 @@ package net.java.sip.communicator.impl.gui.main.authorization; import java.awt.*; import java.awt.event.*; + import javax.swing.*; import net.java.sip.communicator.impl.gui.customcontrols.*; @@ -16,9 +17,9 @@ import net.java.sip.communicator.impl.gui.lookandfeel.*; import net.java.sip.communicator.impl.gui.main.*; import net.java.sip.communicator.impl.gui.utils.*; import net.java.sip.communicator.service.protocol.*; +import net.java.sip.communicator.swing.*; /** - * * @author Yana Stamcheva */ public class AuthorizationRequestedDialog diff --git a/src/net/java/sip/communicator/impl/gui/main/authorization/AuthorizationResponseDialog.java b/src/net/java/sip/communicator/impl/gui/main/authorization/AuthorizationResponseDialog.java index 0ca0366..a5d1c6b 100644 --- a/src/net/java/sip/communicator/impl/gui/main/authorization/AuthorizationResponseDialog.java +++ b/src/net/java/sip/communicator/impl/gui/main/authorization/AuthorizationResponseDialog.java @@ -17,6 +17,7 @@ import net.java.sip.communicator.impl.gui.lookandfeel.*; import net.java.sip.communicator.impl.gui.main.*; import net.java.sip.communicator.impl.gui.utils.*; import net.java.sip.communicator.service.protocol.*; +import net.java.sip.communicator.swing.*; public class AuthorizationResponseDialog extends SIPCommDialog implements ActionListener { diff --git a/src/net/java/sip/communicator/impl/gui/main/authorization/RequestAuthorizationDialog.java b/src/net/java/sip/communicator/impl/gui/main/authorization/RequestAuthorizationDialog.java index 3bf582c..356555a 100644 --- a/src/net/java/sip/communicator/impl/gui/main/authorization/RequestAuthorizationDialog.java +++ b/src/net/java/sip/communicator/impl/gui/main/authorization/RequestAuthorizationDialog.java @@ -16,6 +16,8 @@ import net.java.sip.communicator.impl.gui.i18n.*; import net.java.sip.communicator.impl.gui.main.*; import net.java.sip.communicator.impl.gui.utils.*; import net.java.sip.communicator.service.protocol.*; +import net.java.sip.communicator.swing.*; + /** * The RequestAuthorisationDialog is a JDialog that is * shown when user is trying to add a contact, which requires authorization. diff --git a/src/net/java/sip/communicator/impl/gui/main/call/AccountSelectorBox.java b/src/net/java/sip/communicator/impl/gui/main/call/AccountSelectorBox.java index dc508b0..f0e3375 100644 --- a/src/net/java/sip/communicator/impl/gui/main/call/AccountSelectorBox.java +++ b/src/net/java/sip/communicator/impl/gui/main/call/AccountSelectorBox.java @@ -16,6 +16,7 @@ import net.java.sip.communicator.impl.gui.customcontrols.*; import net.java.sip.communicator.impl.gui.lookandfeel.*; import net.java.sip.communicator.impl.gui.utils.*; import net.java.sip.communicator.service.protocol.*; +import net.java.sip.communicator.swing.*; import net.java.sip.communicator.util.*; /** 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 ef017ac..6df6d21 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 @@ -20,6 +20,7 @@ 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.swing.*; import net.java.sip.communicator.util.*; /** 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 28b97dd..a11445c 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 javax.swing.*; -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.swing.*; /** * Represents an UI means to put an associated CallPariticant 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 4e3a138..ef08b78 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,8 +10,8 @@ import java.awt.event.*; import javax.swing.*; -import net.java.sip.communicator.impl.gui.utils.*; import net.java.sip.communicator.service.protocol.*; +import net.java.sip.communicator.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/SecureButton.java b/src/net/java/sip/communicator/impl/gui/main/call/SecureButton.java index 394bd48..d6d4231 100644 --- a/src/net/java/sip/communicator/impl/gui/main/call/SecureButton.java +++ b/src/net/java/sip/communicator/impl/gui/main/call/SecureButton.java @@ -10,9 +10,9 @@ import java.awt.event.*; import javax.swing.*; -import net.java.sip.communicator.impl.gui.utils.*; import net.java.sip.communicator.impl.gui.i18n.*; import net.java.sip.communicator.service.protocol.*; +import net.java.sip.communicator.swing.*; /** * The UI button used to toggle on or off call securing 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 d0d3d32..a98517c 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 @@ -15,9 +15,9 @@ import javax.swing.*; import org.osgi.framework.*; import net.java.sip.communicator.impl.gui.*; -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.swing.*; import net.java.sip.communicator.util.*; /** diff --git a/src/net/java/sip/communicator/impl/gui/main/call/ZrtpPanel.java b/src/net/java/sip/communicator/impl/gui/main/call/ZrtpPanel.java index e95932e..6fb2f8b 100755 --- a/src/net/java/sip/communicator/impl/gui/main/call/ZrtpPanel.java +++ b/src/net/java/sip/communicator/impl/gui/main/call/ZrtpPanel.java @@ -4,26 +4,17 @@ * Distributable under LGPL license. * See terms of license at gnu.org. */ - package net.java.sip.communicator.impl.gui.main.call; -import java.awt.Dimension; -import java.awt.GridLayout; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.util.HashMap; - -import javax.swing.ImageIcon; -import javax.swing.JButton; -import javax.swing.JLabel; +import java.awt.*; +import java.awt.event.*; +import java.util.*; -import net.java.sip.communicator.impl.gui.utils.ImageLoader; -import net.java.sip.communicator.service.protocol.Call; -import net.java.sip.communicator.service.protocol.CallParticipant; -import net.java.sip.communicator.service.protocol.OperationSetSecureTelephony; -import net.java.sip.communicator.service.protocol.event.SecurityGUIEventZrtp; -import net.java.sip.communicator.swing.TransparentPanel; +import javax.swing.*; +import net.java.sip.communicator.service.protocol.*; +import net.java.sip.communicator.service.protocol.event.*; +import net.java.sip.communicator.swing.*; public class ZrtpPanel extends TransparentPanel { /** diff --git a/src/net/java/sip/communicator/impl/gui/main/chat/ChatContactRightButtonMenu.java b/src/net/java/sip/communicator/impl/gui/main/chat/ChatContactRightButtonMenu.java index e0b45b7..586ab31 100644 --- a/src/net/java/sip/communicator/impl/gui/main/chat/ChatContactRightButtonMenu.java +++ b/src/net/java/sip/communicator/impl/gui/main/chat/ChatContactRightButtonMenu.java @@ -4,7 +4,6 @@ * Distributable under LGPL license. * See terms of license at gnu.org. */ - package net.java.sip.communicator.impl.gui.main.chat; import java.awt.*; @@ -15,8 +14,8 @@ import javax.swing.*; import net.java.sip.communicator.impl.gui.customcontrols.*; import net.java.sip.communicator.impl.gui.i18n.*; import net.java.sip.communicator.impl.gui.main.chat.conference.*; -import net.java.sip.communicator.impl.gui.utils.*; import net.java.sip.communicator.service.protocol.*; +import net.java.sip.communicator.swing.*; import net.java.sip.communicator.util.*; /** 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 e6a3a88..3271504 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 @@ -24,6 +24,7 @@ import net.java.sip.communicator.impl.gui.i18n.*; import net.java.sip.communicator.impl.gui.main.chat.history.*; import net.java.sip.communicator.impl.gui.main.chat.menus.*; import net.java.sip.communicator.impl.gui.utils.*; +import net.java.sip.communicator.swing.*; import net.java.sip.communicator.util.*; /** diff --git a/src/net/java/sip/communicator/impl/gui/main/chat/ChatTransportSelectorBox.java b/src/net/java/sip/communicator/impl/gui/main/chat/ChatTransportSelectorBox.java index f9c6636..56114c4 100644 --- a/src/net/java/sip/communicator/impl/gui/main/chat/ChatTransportSelectorBox.java +++ b/src/net/java/sip/communicator/impl/gui/main/chat/ChatTransportSelectorBox.java @@ -17,6 +17,7 @@ import net.java.sip.communicator.impl.gui.*; import net.java.sip.communicator.impl.gui.customcontrols.*; import net.java.sip.communicator.impl.gui.lookandfeel.*; import net.java.sip.communicator.impl.gui.utils.*; +import net.java.sip.communicator.swing.*; import net.java.sip.communicator.util.*; /** 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 58030c9..8fb6956 100755 --- a/src/net/java/sip/communicator/impl/gui/main/chat/ChatWindow.java +++ b/src/net/java/sip/communicator/impl/gui/main/chat/ChatWindow.java @@ -25,6 +25,7 @@ import net.java.sip.communicator.impl.gui.utils.*; import net.java.sip.communicator.service.gui.*; import net.java.sip.communicator.service.gui.Container; import net.java.sip.communicator.service.keybindings.*; +import net.java.sip.communicator.swing.*; import net.java.sip.communicator.util.*; import org.osgi.framework.*; diff --git a/src/net/java/sip/communicator/impl/gui/main/chat/SmiliesSelectorBox.java b/src/net/java/sip/communicator/impl/gui/main/chat/SmiliesSelectorBox.java index 31471c0..1b5630e 100644 --- a/src/net/java/sip/communicator/impl/gui/main/chat/SmiliesSelectorBox.java +++ b/src/net/java/sip/communicator/impl/gui/main/chat/SmiliesSelectorBox.java @@ -14,6 +14,7 @@ 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.swing.*; /** * The SmiliesSelectorBox is the component where user could choose a diff --git a/src/net/java/sip/communicator/impl/gui/main/chat/conference/ChatRoomConfigurationWindow.java b/src/net/java/sip/communicator/impl/gui/main/chat/conference/ChatRoomConfigurationWindow.java index 6bff4eb..25528c2 100644 --- a/src/net/java/sip/communicator/impl/gui/main/chat/conference/ChatRoomConfigurationWindow.java +++ b/src/net/java/sip/communicator/impl/gui/main/chat/conference/ChatRoomConfigurationWindow.java @@ -16,6 +16,7 @@ import javax.swing.text.*; import net.java.sip.communicator.impl.gui.customcontrols.*; import net.java.sip.communicator.impl.gui.i18n.*; import net.java.sip.communicator.service.protocol.*; +import net.java.sip.communicator.swing.*; /** * The configuration window for the chat room. diff --git a/src/net/java/sip/communicator/impl/gui/main/chat/conference/ChatRoomSubjectPanel.java b/src/net/java/sip/communicator/impl/gui/main/chat/conference/ChatRoomSubjectPanel.java index 2ac73ca..6417f34 100644 --- a/src/net/java/sip/communicator/impl/gui/main/chat/conference/ChatRoomSubjectPanel.java +++ b/src/net/java/sip/communicator/impl/gui/main/chat/conference/ChatRoomSubjectPanel.java @@ -14,8 +14,8 @@ import javax.swing.*; import net.java.sip.communicator.impl.gui.customcontrols.*; import net.java.sip.communicator.impl.gui.i18n.*; import net.java.sip.communicator.impl.gui.main.chat.*; -import net.java.sip.communicator.impl.gui.utils.*; import net.java.sip.communicator.service.protocol.*; +import net.java.sip.communicator.swing.*; import net.java.sip.communicator.util.*; /** diff --git a/src/net/java/sip/communicator/impl/gui/main/chat/conference/InvitationReceivedDialog.java b/src/net/java/sip/communicator/impl/gui/main/chat/conference/InvitationReceivedDialog.java index 1311c35..84073a1 100644 --- a/src/net/java/sip/communicator/impl/gui/main/chat/conference/InvitationReceivedDialog.java +++ b/src/net/java/sip/communicator/impl/gui/main/chat/conference/InvitationReceivedDialog.java @@ -16,6 +16,7 @@ import net.java.sip.communicator.impl.gui.customcontrols.*; import net.java.sip.communicator.impl.gui.i18n.*; import net.java.sip.communicator.impl.gui.utils.*; import net.java.sip.communicator.service.protocol.*; +import net.java.sip.communicator.swing.*; /** * The dialog that pops up when a chat room invitation is received. diff --git a/src/net/java/sip/communicator/impl/gui/main/chat/history/DatesListRenderer.java b/src/net/java/sip/communicator/impl/gui/main/chat/history/DatesListRenderer.java index 501141a..9f67906 100644 --- a/src/net/java/sip/communicator/impl/gui/main/chat/history/DatesListRenderer.java +++ b/src/net/java/sip/communicator/impl/gui/main/chat/history/DatesListRenderer.java @@ -12,6 +12,7 @@ import java.util.*; import javax.swing.*; import net.java.sip.communicator.impl.gui.utils.*; +import net.java.sip.communicator.swing.*; import net.java.sip.communicator.util.*; /** diff --git a/src/net/java/sip/communicator/impl/gui/main/chat/menus/ChatRightButtonMenu.java b/src/net/java/sip/communicator/impl/gui/main/chat/menus/ChatRightButtonMenu.java index 34593b9..31baa49 100644 --- a/src/net/java/sip/communicator/impl/gui/main/chat/menus/ChatRightButtonMenu.java +++ b/src/net/java/sip/communicator/impl/gui/main/chat/menus/ChatRightButtonMenu.java @@ -13,7 +13,7 @@ import javax.swing.*; import net.java.sip.communicator.impl.gui.i18n.*; import net.java.sip.communicator.impl.gui.main.chat.*; -import net.java.sip.communicator.impl.gui.utils.*; +import net.java.sip.communicator.swing.*; /** * The ChatRightButtonMenu appears when the user makes a right button diff --git a/src/net/java/sip/communicator/impl/gui/main/chat/menus/EditMenu.java b/src/net/java/sip/communicator/impl/gui/main/chat/menus/EditMenu.java index d3f1845..fc2e761 100644 --- a/src/net/java/sip/communicator/impl/gui/main/chat/menus/EditMenu.java +++ b/src/net/java/sip/communicator/impl/gui/main/chat/menus/EditMenu.java @@ -4,7 +4,6 @@ * Distributable under LGPL license. * See terms of license at gnu.org. */ - package net.java.sip.communicator.impl.gui.main.chat.menus; import java.awt.*; @@ -16,7 +15,8 @@ import net.java.sip.communicator.impl.gui.*; import net.java.sip.communicator.impl.gui.customcontrols.*; import net.java.sip.communicator.impl.gui.i18n.*; import net.java.sip.communicator.impl.gui.main.chat.*; -import net.java.sip.communicator.impl.gui.utils.*; +import net.java.sip.communicator.swing.*; + /** * The EditMenu is the menu in the chat window menu bar, which contains * cut, copy and paste. diff --git a/src/net/java/sip/communicator/impl/gui/main/chat/menus/FileMenu.java b/src/net/java/sip/communicator/impl/gui/main/chat/menus/FileMenu.java index dbaed5f..1ee5233 100644 --- a/src/net/java/sip/communicator/impl/gui/main/chat/menus/FileMenu.java +++ b/src/net/java/sip/communicator/impl/gui/main/chat/menus/FileMenu.java @@ -4,7 +4,6 @@ * Distributable under LGPL license. * See terms of license at gnu.org. */ - package net.java.sip.communicator.impl.gui.main.chat.menus; import java.awt.*; @@ -18,6 +17,8 @@ import net.java.sip.communicator.impl.gui.i18n.*; import net.java.sip.communicator.impl.gui.main.chat.*; import net.java.sip.communicator.impl.gui.main.chatroomslist.*; import net.java.sip.communicator.impl.gui.utils.*; +import net.java.sip.communicator.swing.*; + /** * The FileMenu is the menu in the chat window menu bar that contains * save, print and close. diff --git a/src/net/java/sip/communicator/impl/gui/main/chat/menus/MessageWindowMenuBar.java b/src/net/java/sip/communicator/impl/gui/main/chat/menus/MessageWindowMenuBar.java index c7e3b90..9600c09 100644 --- a/src/net/java/sip/communicator/impl/gui/main/chat/menus/MessageWindowMenuBar.java +++ b/src/net/java/sip/communicator/impl/gui/main/chat/menus/MessageWindowMenuBar.java @@ -3,7 +3,6 @@ * * Distributable under LGPL license. See terms of license at gnu.org. */ - package net.java.sip.communicator.impl.gui.main.chat.menus; import java.awt.*; @@ -16,9 +15,9 @@ import net.java.sip.communicator.impl.gui.*; import net.java.sip.communicator.impl.gui.customcontrols.*; import net.java.sip.communicator.impl.gui.event.*; import net.java.sip.communicator.impl.gui.main.chat.*; -import net.java.sip.communicator.impl.gui.utils.*; import net.java.sip.communicator.service.gui.*; import net.java.sip.communicator.service.gui.Container; +import net.java.sip.communicator.swing.*; import net.java.sip.communicator.util.*; /** diff --git a/src/net/java/sip/communicator/impl/gui/main/chat/menus/WritePanelRightButtonMenu.java b/src/net/java/sip/communicator/impl/gui/main/chat/menus/WritePanelRightButtonMenu.java index 9749659..3858977 100644 --- a/src/net/java/sip/communicator/impl/gui/main/chat/menus/WritePanelRightButtonMenu.java +++ b/src/net/java/sip/communicator/impl/gui/main/chat/menus/WritePanelRightButtonMenu.java @@ -12,7 +12,7 @@ import javax.swing.*; import net.java.sip.communicator.impl.gui.i18n.*; import net.java.sip.communicator.impl.gui.main.chat.*; -import net.java.sip.communicator.impl.gui.utils.*; +import net.java.sip.communicator.swing.*; /** * The WritePanelRightButtonMenu appears when the user makes a right diff --git a/src/net/java/sip/communicator/impl/gui/main/chatroomslist/ChatRoomCommonRightButtonMenu.java b/src/net/java/sip/communicator/impl/gui/main/chatroomslist/ChatRoomCommonRightButtonMenu.java index 93b18c6..b3a934c 100644 --- a/src/net/java/sip/communicator/impl/gui/main/chatroomslist/ChatRoomCommonRightButtonMenu.java +++ b/src/net/java/sip/communicator/impl/gui/main/chatroomslist/ChatRoomCommonRightButtonMenu.java @@ -4,12 +4,10 @@ * Distributable under LGPL license. * See terms of license at gnu.org. */ - package net.java.sip.communicator.impl.gui.main.chatroomslist; import java.awt.*; import java.awt.event.*; -import java.util.*; import javax.swing.*; @@ -22,10 +20,9 @@ import net.java.sip.communicator.impl.gui.main.*; import net.java.sip.communicator.impl.gui.main.chat.conference.*; import net.java.sip.communicator.impl.gui.main.chatroomslist.createforms.*; import net.java.sip.communicator.impl.gui.main.chatroomslist.joinforms.*; -import net.java.sip.communicator.impl.gui.utils.*; import net.java.sip.communicator.service.gui.*; import net.java.sip.communicator.service.gui.Container; -import net.java.sip.communicator.service.protocol.*; +import net.java.sip.communicator.swing.*; import net.java.sip.communicator.util.*; /** diff --git a/src/net/java/sip/communicator/impl/gui/main/chatroomslist/ChatRoomRightButtonMenu.java b/src/net/java/sip/communicator/impl/gui/main/chatroomslist/ChatRoomRightButtonMenu.java index 432052c..63ac119 100644 --- a/src/net/java/sip/communicator/impl/gui/main/chatroomslist/ChatRoomRightButtonMenu.java +++ b/src/net/java/sip/communicator/impl/gui/main/chatroomslist/ChatRoomRightButtonMenu.java @@ -4,10 +4,8 @@ * Distributable under LGPL license. * See terms of license at gnu.org. */ - package net.java.sip.communicator.impl.gui.main.chatroomslist; -import java.awt.*; import java.awt.event.*; import javax.swing.*; @@ -16,7 +14,7 @@ import net.java.sip.communicator.impl.gui.*; import net.java.sip.communicator.impl.gui.i18n.*; import net.java.sip.communicator.impl.gui.main.chat.conference.*; import net.java.sip.communicator.impl.gui.main.chatroomslist.joinforms.*; -import net.java.sip.communicator.impl.gui.utils.*; +import net.java.sip.communicator.swing.*; import net.java.sip.communicator.util.*; /** diff --git a/src/net/java/sip/communicator/impl/gui/main/chatroomslist/ChatRoomServerRightButtonMenu.java b/src/net/java/sip/communicator/impl/gui/main/chatroomslist/ChatRoomServerRightButtonMenu.java index 8644213..129a714 100644 --- a/src/net/java/sip/communicator/impl/gui/main/chatroomslist/ChatRoomServerRightButtonMenu.java +++ b/src/net/java/sip/communicator/impl/gui/main/chatroomslist/ChatRoomServerRightButtonMenu.java @@ -4,7 +4,6 @@ * Distributable under LGPL license. * See terms of license at gnu.org. */ - package net.java.sip.communicator.impl.gui.main.chatroomslist; import java.awt.*; @@ -16,7 +15,7 @@ import net.java.sip.communicator.impl.gui.i18n.*; import net.java.sip.communicator.impl.gui.main.chat.conference.*; import net.java.sip.communicator.impl.gui.main.chatroomslist.createforms.*; import net.java.sip.communicator.impl.gui.main.chatroomslist.joinforms.*; -import net.java.sip.communicator.impl.gui.utils.*; +import net.java.sip.communicator.swing.*; /** * The ChatRoomsListRightButtonMenu is the menu, opened when user clicks diff --git a/src/net/java/sip/communicator/impl/gui/main/chatroomslist/ChatRoomsListCellRenderer.java b/src/net/java/sip/communicator/impl/gui/main/chatroomslist/ChatRoomsListCellRenderer.java index 69abdaa..c6d2ecd 100644 --- a/src/net/java/sip/communicator/impl/gui/main/chatroomslist/ChatRoomsListCellRenderer.java +++ b/src/net/java/sip/communicator/impl/gui/main/chatroomslist/ChatRoomsListCellRenderer.java @@ -4,7 +4,6 @@ * Distributable under LGPL license. * See terms of license at gnu.org. */ - package net.java.sip.communicator.impl.gui.main.chatroomslist; import java.awt.*; @@ -14,6 +13,7 @@ import javax.swing.*; import net.java.sip.communicator.impl.gui.main.chat.conference.*; import net.java.sip.communicator.impl.gui.utils.*; import net.java.sip.communicator.service.protocol.*; +import net.java.sip.communicator.swing.*; /** * The ChatRoomsListCellRenderer is the custom cell renderer used in the diff --git a/src/net/java/sip/communicator/impl/gui/main/chatroomslist/createforms/ChatRoomNamePanel.java b/src/net/java/sip/communicator/impl/gui/main/chatroomslist/createforms/ChatRoomNamePanel.java index 34d2ab0..62d0562 100644 --- a/src/net/java/sip/communicator/impl/gui/main/chatroomslist/createforms/ChatRoomNamePanel.java +++ b/src/net/java/sip/communicator/impl/gui/main/chatroomslist/createforms/ChatRoomNamePanel.java @@ -4,12 +4,9 @@ * Distributable under LGPL license. * See terms of license at gnu.org. */ - package net.java.sip.communicator.impl.gui.main.chatroomslist.createforms; import java.awt.*; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; import javax.swing.*; import javax.swing.event.*; @@ -18,6 +15,7 @@ import net.java.sip.communicator.impl.gui.customcontrols.*; import net.java.sip.communicator.impl.gui.i18n.*; import net.java.sip.communicator.impl.gui.utils.*; import net.java.sip.communicator.service.gui.*; +import net.java.sip.communicator.swing.*; /** * The ChatRoomNamePanel is the form, where we should enter the chat diff --git a/src/net/java/sip/communicator/impl/gui/main/chatroomslist/createforms/SelectAccountPanel.java b/src/net/java/sip/communicator/impl/gui/main/chatroomslist/createforms/SelectAccountPanel.java index 568da5b..619429b 100644 --- a/src/net/java/sip/communicator/impl/gui/main/chatroomslist/createforms/SelectAccountPanel.java +++ b/src/net/java/sip/communicator/impl/gui/main/chatroomslist/createforms/SelectAccountPanel.java @@ -6,10 +6,9 @@ */ package net.java.sip.communicator.impl.gui.main.chatroomslist.createforms; -import java.util.*; - import java.awt.*; import java.io.*; +import java.util.*; import javax.imageio.*; import javax.swing.*; @@ -20,6 +19,7 @@ import net.java.sip.communicator.impl.gui.customcontrols.*; import net.java.sip.communicator.impl.gui.i18n.*; import net.java.sip.communicator.impl.gui.utils.*; import net.java.sip.communicator.service.protocol.*; +import net.java.sip.communicator.swing.*; import net.java.sip.communicator.util.*; /** diff --git a/src/net/java/sip/communicator/impl/gui/main/chatroomslist/joinforms/ChatRoomAuthenticationWindow.java b/src/net/java/sip/communicator/impl/gui/main/chatroomslist/joinforms/ChatRoomAuthenticationWindow.java index d425a5f..3d794a5 100644 --- a/src/net/java/sip/communicator/impl/gui/main/chatroomslist/joinforms/ChatRoomAuthenticationWindow.java +++ b/src/net/java/sip/communicator/impl/gui/main/chatroomslist/joinforms/ChatRoomAuthenticationWindow.java @@ -4,7 +4,6 @@ * Distributable under LGPL license. * See terms of license at gnu.org. */ - package net.java.sip.communicator.impl.gui.main.chatroomslist.joinforms; import java.awt.*; @@ -13,11 +12,11 @@ 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.i18n.*; import net.java.sip.communicator.impl.gui.main.chat.conference.*; import net.java.sip.communicator.impl.gui.utils.*; -import net.java.sip.communicator.service.protocol.*; +import net.java.sip.communicator.swing.*; + /** * The ChatRoomAuthenticationWindow is the the authentication window * for chat rooms that require password. diff --git a/src/net/java/sip/communicator/impl/gui/main/chatroomslist/joinforms/JoinChatRoomDialog.java b/src/net/java/sip/communicator/impl/gui/main/chatroomslist/joinforms/JoinChatRoomDialog.java index a5f47d3..4de1fa6 100644 --- a/src/net/java/sip/communicator/impl/gui/main/chatroomslist/joinforms/JoinChatRoomDialog.java +++ b/src/net/java/sip/communicator/impl/gui/main/chatroomslist/joinforms/JoinChatRoomDialog.java @@ -15,7 +15,7 @@ import net.java.sip.communicator.impl.gui.*; import net.java.sip.communicator.impl.gui.customcontrols.*; import net.java.sip.communicator.impl.gui.i18n.*; import net.java.sip.communicator.impl.gui.main.chat.conference.*; -import net.java.sip.communicator.impl.gui.utils.*; +import net.java.sip.communicator.swing.*; import net.java.sip.communicator.util.*; /** diff --git a/src/net/java/sip/communicator/impl/gui/main/chatroomslist/joinforms/SelectAccountPanel.java b/src/net/java/sip/communicator/impl/gui/main/chatroomslist/joinforms/SelectAccountPanel.java index a10d77d..b3d2077 100644 --- a/src/net/java/sip/communicator/impl/gui/main/chatroomslist/joinforms/SelectAccountPanel.java +++ b/src/net/java/sip/communicator/impl/gui/main/chatroomslist/joinforms/SelectAccountPanel.java @@ -6,12 +6,9 @@ */ package net.java.sip.communicator.impl.gui.main.chatroomslist.joinforms; -import java.util.*; - import java.awt.*; -import java.io.*; +import java.util.*; -import javax.imageio.*; import javax.swing.*; import javax.swing.event.*; import javax.swing.table.*; @@ -20,7 +17,7 @@ import net.java.sip.communicator.impl.gui.customcontrols.*; import net.java.sip.communicator.impl.gui.i18n.*; import net.java.sip.communicator.impl.gui.main.chat.conference.*; import net.java.sip.communicator.impl.gui.utils.*; -import net.java.sip.communicator.service.protocol.*; +import net.java.sip.communicator.swing.*; import net.java.sip.communicator.util.*; /** 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 795d067..18797d1 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 @@ -10,8 +10,8 @@ import java.awt.*; import javax.swing.*; -import net.java.sip.communicator.impl.gui.utils.*; import net.java.sip.communicator.service.gui.*; +import net.java.sip.communicator.swing.*; import net.java.sip.communicator.util.*; /** diff --git a/src/net/java/sip/communicator/impl/gui/main/contactlist/CommonRightButtonMenu.java b/src/net/java/sip/communicator/impl/gui/main/contactlist/CommonRightButtonMenu.java index ef892df..ce9c999 100644 --- a/src/net/java/sip/communicator/impl/gui/main/contactlist/CommonRightButtonMenu.java +++ b/src/net/java/sip/communicator/impl/gui/main/contactlist/CommonRightButtonMenu.java @@ -14,7 +14,7 @@ import net.java.sip.communicator.impl.gui.i18n.*; import net.java.sip.communicator.impl.gui.main.*; import net.java.sip.communicator.impl.gui.main.contactlist.addcontact.*; import net.java.sip.communicator.impl.gui.main.contactlist.addgroup.*; -import net.java.sip.communicator.impl.gui.utils.*; +import net.java.sip.communicator.swing.*; /** * The GroupRightButtonMenu is the menu, opened when user clicks with the diff --git a/src/net/java/sip/communicator/impl/gui/main/contactlist/ContactInfoDialog.java b/src/net/java/sip/communicator/impl/gui/main/contactlist/ContactInfoDialog.java index 51d965e..f9ee824 100644 --- a/src/net/java/sip/communicator/impl/gui/main/contactlist/ContactInfoDialog.java +++ b/src/net/java/sip/communicator/impl/gui/main/contactlist/ContactInfoDialog.java @@ -4,15 +4,16 @@ * Distributable under LGPL license. * See terms of license at gnu.org. */ - package net.java.sip.communicator.impl.gui.main.contactlist; import java.awt.*; import java.awt.event.*; + import javax.swing.*; import net.java.sip.communicator.impl.gui.customcontrols.*; import net.java.sip.communicator.service.contactlist.*; +import net.java.sip.communicator.swing.*; /** * The ContactInfoPanel is a popup dialog containing the contact @@ -21,11 +22,11 @@ import net.java.sip.communicator.service.contactlist.*; * @author Yana Stamcheva */ public class ContactInfoDialog - extends JDialog + extends SIPCommDialog implements WindowFocusListener { - private JPanel protocolsPanel = new JPanel(new GridLayout(0, 1)); + private JPanel protocolsPanel = new TransparentPanel(new GridLayout(0, 1)); private MetaContact contactItem; @@ -47,8 +48,6 @@ public class ContactInfoDialog this.setModal(true); - this.protocolsPanel.setOpaque(false); - // Create the transparent background component this.bg = new TransparentBackground(this); @@ -106,8 +105,7 @@ public class ContactInfoDialog public void windowLostFocus(WindowEvent e) { - this.setVisible(false); - this.dispose(); + close(false); } public void setPopupLocation(int x, int y) @@ -116,4 +114,10 @@ public class ContactInfoDialog this.bg.updateBackground(x, y); } + + protected void close(boolean isEscaped) + { + this.setVisible(false); + this.dispose(); + } } diff --git a/src/net/java/sip/communicator/impl/gui/main/contactlist/ContactList.java b/src/net/java/sip/communicator/impl/gui/main/contactlist/ContactList.java index 0607ee3..4677c0d 100644 --- a/src/net/java/sip/communicator/impl/gui/main/contactlist/ContactList.java +++ b/src/net/java/sip/communicator/impl/gui/main/contactlist/ContactList.java @@ -4,7 +4,6 @@ * Distributable under LGPL license. * See terms of license at gnu.org. */ - package net.java.sip.communicator.impl.gui.main.contactlist; import java.awt.*; @@ -25,6 +24,7 @@ import net.java.sip.communicator.service.contactlist.*; import net.java.sip.communicator.service.contactlist.event.*; import net.java.sip.communicator.service.protocol.*; import net.java.sip.communicator.service.systray.*; +import net.java.sip.communicator.swing.*; import net.java.sip.communicator.util.*; /** diff --git a/src/net/java/sip/communicator/impl/gui/main/contactlist/ContactListCellRenderer.java b/src/net/java/sip/communicator/impl/gui/main/contactlist/ContactListCellRenderer.java index fdef61a..1f4c051 100644 --- a/src/net/java/sip/communicator/impl/gui/main/contactlist/ContactListCellRenderer.java +++ b/src/net/java/sip/communicator/impl/gui/main/contactlist/ContactListCellRenderer.java @@ -14,6 +14,7 @@ import net.java.sip.communicator.impl.gui.*; import net.java.sip.communicator.impl.gui.i18n.*; import net.java.sip.communicator.impl.gui.utils.*; import net.java.sip.communicator.service.contactlist.*; +import net.java.sip.communicator.swing.*; import net.java.sip.communicator.util.*; /** diff --git a/src/net/java/sip/communicator/impl/gui/main/contactlist/ContactRightButtonMenu.java b/src/net/java/sip/communicator/impl/gui/main/contactlist/ContactRightButtonMenu.java index 614ba78..62b0403 100644 --- a/src/net/java/sip/communicator/impl/gui/main/contactlist/ContactRightButtonMenu.java +++ b/src/net/java/sip/communicator/impl/gui/main/contactlist/ContactRightButtonMenu.java @@ -4,7 +4,6 @@ * Distributable under LGPL license. * See terms of license at gnu.org. */ - package net.java.sip.communicator.impl.gui.main.contactlist; import java.awt.*; @@ -28,6 +27,7 @@ import net.java.sip.communicator.service.contactlist.*; import net.java.sip.communicator.service.gui.*; import net.java.sip.communicator.service.gui.Container; import net.java.sip.communicator.service.protocol.*; +import net.java.sip.communicator.swing.*; import net.java.sip.communicator.util.*; import org.osgi.framework.*; diff --git a/src/net/java/sip/communicator/impl/gui/main/contactlist/GroupRightButtonMenu.java b/src/net/java/sip/communicator/impl/gui/main/contactlist/GroupRightButtonMenu.java index c6bee90..ea0533c 100644 --- a/src/net/java/sip/communicator/impl/gui/main/contactlist/GroupRightButtonMenu.java +++ b/src/net/java/sip/communicator/impl/gui/main/contactlist/GroupRightButtonMenu.java @@ -27,8 +27,8 @@ import net.java.sip.communicator.impl.gui.utils.Constants; import net.java.sip.communicator.service.contactlist.*; import net.java.sip.communicator.service.gui.*; import net.java.sip.communicator.service.gui.Container; -import net.java.sip.communicator.service.gui.event.*; import net.java.sip.communicator.service.protocol.*; +import net.java.sip.communicator.swing.*; import net.java.sip.communicator.util.*; /** diff --git a/src/net/java/sip/communicator/impl/gui/main/menus/AboutWindow.java b/src/net/java/sip/communicator/impl/gui/main/menus/AboutWindow.java index 71dff24..489a4cf 100644 --- a/src/net/java/sip/communicator/impl/gui/main/menus/AboutWindow.java +++ b/src/net/java/sip/communicator/impl/gui/main/menus/AboutWindow.java @@ -15,6 +15,7 @@ import net.java.sip.communicator.impl.gui.*; import net.java.sip.communicator.impl.gui.i18n.*; import net.java.sip.communicator.impl.gui.utils.*; import net.java.sip.communicator.service.gui.*; +import net.java.sip.communicator.swing.*; public class AboutWindow extends JDialog diff --git a/src/net/java/sip/communicator/impl/gui/main/menus/ExtendedQuickMenu.java b/src/net/java/sip/communicator/impl/gui/main/menus/ExtendedQuickMenu.java index b37322b..18f4120 100644 --- a/src/net/java/sip/communicator/impl/gui/main/menus/ExtendedQuickMenu.java +++ b/src/net/java/sip/communicator/impl/gui/main/menus/ExtendedQuickMenu.java @@ -4,7 +4,6 @@ * Distributable under LGPL license. * See terms of license at gnu.org. */ - package net.java.sip.communicator.impl.gui.main.menus; import java.awt.*; @@ -28,6 +27,7 @@ import net.java.sip.communicator.service.contactlist.*; import net.java.sip.communicator.service.gui.*; import net.java.sip.communicator.service.gui.Container; import net.java.sip.communicator.service.protocol.*; +import net.java.sip.communicator.swing.*; import net.java.sip.communicator.util.*; import org.osgi.framework.*; diff --git a/src/net/java/sip/communicator/impl/gui/main/menus/FileMenu.java b/src/net/java/sip/communicator/impl/gui/main/menus/FileMenu.java index d845bcd..54203e9 100644 --- a/src/net/java/sip/communicator/impl/gui/main/menus/FileMenu.java +++ b/src/net/java/sip/communicator/impl/gui/main/menus/FileMenu.java @@ -4,7 +4,6 @@ * Distributable under LGPL license. * See terms of license at gnu.org. */ - package net.java.sip.communicator.impl.gui.main.menus; import java.awt.*; @@ -20,10 +19,11 @@ import net.java.sip.communicator.impl.gui.main.account.*; 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.addgroup.*; -import net.java.sip.communicator.impl.gui.utils.*; +import net.java.sip.communicator.swing.*; import net.java.sip.communicator.util.*; import org.osgi.framework.*; + /** * The FileMenu is a menu in the main application menu bar that * contains "New account". diff --git a/src/net/java/sip/communicator/impl/gui/main/menus/MainMenu.java b/src/net/java/sip/communicator/impl/gui/main/menus/MainMenu.java index f9a37b7..e693d64 100755 --- a/src/net/java/sip/communicator/impl/gui/main/menus/MainMenu.java +++ b/src/net/java/sip/communicator/impl/gui/main/menus/MainMenu.java @@ -4,7 +4,6 @@ * Distributable under LGPL license. * See terms of license at gnu.org. */ - package net.java.sip.communicator.impl.gui.main.menus; import java.awt.*; @@ -14,7 +13,7 @@ import javax.swing.*; import net.java.sip.communicator.impl.gui.*; import net.java.sip.communicator.impl.gui.i18n.*; import net.java.sip.communicator.impl.gui.main.*; -import net.java.sip.communicator.impl.gui.utils.*; +import net.java.sip.communicator.swing.*; /** * The main menu bar. This is the menu bar that appears on top of the main diff --git a/src/net/java/sip/communicator/impl/gui/main/menus/MoreButton.java b/src/net/java/sip/communicator/impl/gui/main/menus/MoreButton.java index b2802bf..5a4a8ce 100644 --- a/src/net/java/sip/communicator/impl/gui/main/menus/MoreButton.java +++ b/src/net/java/sip/communicator/impl/gui/main/menus/MoreButton.java @@ -13,10 +13,10 @@ import java.util.*; import javax.swing.*; import net.java.sip.communicator.impl.gui.i18n.*; -import net.java.sip.communicator.impl.gui.utils.*; import net.java.sip.communicator.service.contactlist.*; import net.java.sip.communicator.service.gui.*; import net.java.sip.communicator.service.gui.Container; +import net.java.sip.communicator.swing.*; public class MoreButton extends JLabel 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 3f28577..f1249de5 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 @@ -22,6 +22,7 @@ import net.java.sip.communicator.impl.gui.utils.*; import net.java.sip.communicator.service.configuration.*; import net.java.sip.communicator.service.protocol.*; import net.java.sip.communicator.service.systray.*; +import net.java.sip.communicator.swing.*; import net.java.sip.communicator.util.*; /** diff --git a/src/net/java/sip/communicator/impl/gui/main/presence/PresenceStatusMenu.java b/src/net/java/sip/communicator/impl/gui/main/presence/PresenceStatusMenu.java index 0dc66c0..4b9f4d5 100644 --- a/src/net/java/sip/communicator/impl/gui/main/presence/PresenceStatusMenu.java +++ b/src/net/java/sip/communicator/impl/gui/main/presence/PresenceStatusMenu.java @@ -3,7 +3,6 @@ * * Distributable under LGPL license. See terms of license at gnu.org. */ - package net.java.sip.communicator.impl.gui.main.presence; import java.awt.*; @@ -20,6 +19,7 @@ import net.java.sip.communicator.impl.gui.main.login.*; import net.java.sip.communicator.impl.gui.main.presence.message.*; import net.java.sip.communicator.impl.gui.utils.*; import net.java.sip.communicator.service.protocol.*; +import net.java.sip.communicator.swing.*; import net.java.sip.communicator.util.*; /** diff --git a/src/net/java/sip/communicator/impl/gui/main/presence/SimpleStatusMenu.java b/src/net/java/sip/communicator/impl/gui/main/presence/SimpleStatusMenu.java index 4856a8e..9f5cc28 100644 --- a/src/net/java/sip/communicator/impl/gui/main/presence/SimpleStatusMenu.java +++ b/src/net/java/sip/communicator/impl/gui/main/presence/SimpleStatusMenu.java @@ -4,7 +4,6 @@ * Distributable under LGPL license. * See terms of license at gnu.org. */ - package net.java.sip.communicator.impl.gui.main.presence; import java.awt.*; @@ -18,6 +17,7 @@ import net.java.sip.communicator.impl.gui.i18n.*; import net.java.sip.communicator.impl.gui.main.*; import net.java.sip.communicator.impl.gui.utils.*; import net.java.sip.communicator.service.protocol.*; +import net.java.sip.communicator.swing.*; import net.java.sip.communicator.util.*; /** diff --git a/src/net/java/sip/communicator/impl/gui/main/presence/message/NewStatusMessageDialog.java b/src/net/java/sip/communicator/impl/gui/main/presence/message/NewStatusMessageDialog.java index e1107fc..dcd3bb7 100644 --- a/src/net/java/sip/communicator/impl/gui/main/presence/message/NewStatusMessageDialog.java +++ b/src/net/java/sip/communicator/impl/gui/main/presence/message/NewStatusMessageDialog.java @@ -11,9 +11,11 @@ import java.awt.event.*; import javax.swing.*; +import net.java.sip.communicator.impl.gui.customcontrols.*; import net.java.sip.communicator.impl.gui.i18n.*; import net.java.sip.communicator.impl.gui.utils.*; import net.java.sip.communicator.service.protocol.*; +import net.java.sip.communicator.swing.*; import net.java.sip.communicator.util.*; /** @@ -23,19 +25,17 @@ import net.java.sip.communicator.util.*; * @author Yana Stamcheva */ public class NewStatusMessageDialog - extends JDialog + extends SIPCommDialog implements ActionListener { private Logger logger = Logger.getLogger(NewStatusMessageDialog.class); - private JPanel messagePanel = new JPanel(new BorderLayout()); - private JLabel messageLabel = new JLabel( Messages.getI18NString("newStatusMessage").getText()); private JTextField messageTextField = new JTextField(); - private JPanel dataPanel = new JPanel(new BorderLayout(5, 5)); + private JPanel dataPanel = new TransparentPanel(new BorderLayout(5, 5)); private JTextArea infoArea = new JTextArea( Messages.getI18NString("statusMessageInfo").getText()); @@ -43,12 +43,7 @@ public class NewStatusMessageDialog private JLabel infoTitleLabel = new JLabel( Messages.getI18NString("newStatusMessage").getText()); - private JLabel iconLabel = new JLabel(new ImageIcon( - ImageLoader.getImage(ImageLoader.RENAME_DIALOG_ICON))); - - private JPanel labelsPanel = new JPanel(new GridLayout(0, 1)); - - private JPanel rightPanel = new JPanel(new BorderLayout()); + private JPanel labelsPanel = new TransparentPanel(new GridLayout(0, 1)); private JButton okButton = new JButton(Messages.getI18NString("ok").getText()); @@ -56,9 +51,7 @@ public class NewStatusMessageDialog private JButton cancelButton = new JButton(Messages.getI18NString("cancel").getText()); - private JPanel buttonsPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT)); - - private JPanel mainPanel = new JPanel(new BorderLayout()); + private JPanel buttonsPanel = new TransparentPanel(new FlowLayout(FlowLayout.RIGHT)); private ProtocolProviderService protocolProvider; @@ -71,9 +64,8 @@ public class NewStatusMessageDialog { this.protocolProvider = protocolProvider; - this.setSize(new Dimension(520, 270)); - this.init(); + pack(); } /** @@ -88,8 +80,6 @@ public class NewStatusMessageDialog this.setPreferredSize(new Dimension(500, 200)); - this.iconLabel.setBorder(BorderFactory.createEmptyBorder(5, 0, 5, 10)); - this.infoArea.setEditable(false); this.infoArea.setLineWrap(true); this.infoArea.setWrapStyleWord(true); @@ -106,10 +96,25 @@ public class NewStatusMessageDialog this.labelsPanel.add(infoArea); this.labelsPanel.add(dataPanel); - this.rightPanel.add(labelsPanel, BorderLayout.NORTH); - - this.messagePanel.add(iconLabel, BorderLayout.WEST); - this.messagePanel.add(rightPanel, BorderLayout.CENTER); + JPanel messagePanel = new TransparentPanel(new GridBagLayout()); + GridBagConstraints messagePanelConstraints = new GridBagConstraints(); + messagePanelConstraints.anchor = GridBagConstraints.NORTHWEST; + messagePanelConstraints.fill = GridBagConstraints.NONE; + messagePanelConstraints.gridx = 0; + messagePanelConstraints.gridy = 0; + messagePanelConstraints.insets = new Insets(5, 0, 5, 10); + messagePanelConstraints.weightx = 0; + messagePanelConstraints.weighty = 0; + messagePanel + .add(new ImageCanvas(ImageLoader + .getImage(ImageLoader.RENAME_DIALOG_ICON)), + messagePanelConstraints); + messagePanelConstraints.anchor = GridBagConstraints.NORTH; + messagePanelConstraints.fill = GridBagConstraints.HORIZONTAL; + messagePanelConstraints.gridx = 1; + messagePanelConstraints.insets = new Insets(0, 0, 0, 0); + messagePanelConstraints.weightx = 1; + messagePanel.add(labelsPanel, messagePanelConstraints); this.okButton.setName("ok"); this.cancelButton.setName("cancel"); @@ -125,10 +130,23 @@ public class NewStatusMessageDialog this.buttonsPanel.add(okButton); this.buttonsPanel.add(cancelButton); - this.mainPanel.setBorder(BorderFactory.createEmptyBorder(5, 10, 0, 10)); - - this.mainPanel.add(messagePanel, BorderLayout.NORTH); - this.mainPanel.add(buttonsPanel, BorderLayout.SOUTH); + JPanel mainPanel = new TransparentPanel(new GridBagLayout()); + mainPanel.setBorder(BorderFactory.createEmptyBorder(5, 10, 0, 10)); + + GridBagConstraints mainPanelConstraints = new GridBagConstraints(); + mainPanelConstraints.anchor = GridBagConstraints.NORTH; + mainPanelConstraints.fill = GridBagConstraints.BOTH; + mainPanelConstraints.gridx = 0; + mainPanelConstraints.gridy = 0; + mainPanelConstraints.weightx = 1; + mainPanelConstraints.weighty = 1; + mainPanel.add(messagePanel, mainPanelConstraints); + mainPanelConstraints.anchor = GridBagConstraints.SOUTHEAST; + mainPanelConstraints.fill = GridBagConstraints.NONE; + mainPanelConstraints.gridy = 1; + mainPanelConstraints.weightx = 0; + mainPanelConstraints.weighty = 0; + mainPanel.add(buttonsPanel, mainPanelConstraints); this.getContentPane().add(mainPanel); } @@ -229,4 +247,9 @@ public class NewStatusMessageDialog } } } + + protected void close(boolean isEscaped) + { + cancelButton.doClick(); + } } diff --git a/src/net/java/sip/communicator/impl/gui/utils/AntialiasingManager.java b/src/net/java/sip/communicator/impl/gui/utils/AntialiasingManager.java deleted file mode 100644 index 17651af..0000000 --- a/src/net/java/sip/communicator/impl/gui/utils/AntialiasingManager.java +++ /dev/null @@ -1,33 +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.*; - -/** - * Through the AntialiasingManager the developer could activate the - * antialiasing mechanism when painting. The method that do the job is - * the activateAntialiasing method. It takes a Graphics - * object and activates the antialiasing for it. - * - * @author Yana Stamcheva - */ -public class AntialiasingManager { - - /** - * Activates the antialiasing mechanism for the given Graphics - * object. - * @param g The Graphics object. - */ - public static void activateAntialiasing(Graphics g) { - Graphics2D g2d = (Graphics2D) g; - - g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, - RenderingHints.VALUE_ANTIALIAS_ON); - } -} diff --git a/src/net/java/sip/communicator/impl/gui/utils/Constants.java b/src/net/java/sip/communicator/impl/gui/utils/Constants.java index ad318f6..12407dc 100755 --- a/src/net/java/sip/communicator/impl/gui/utils/Constants.java +++ b/src/net/java/sip/communicator/impl/gui/utils/Constants.java @@ -4,7 +4,6 @@ * Distributable under LGPL license. * See terms of license at gnu.org. */ - package net.java.sip.communicator.impl.gui.utils; import java.awt.*; @@ -17,6 +16,7 @@ import javax.swing.text.html.*; import net.java.sip.communicator.impl.gui.*; import net.java.sip.communicator.service.protocol.*; +import net.java.sip.communicator.swing.*; import net.java.sip.communicator.util.*; /** diff --git a/src/net/java/sip/communicator/impl/gui/utils/ImageLoader.java b/src/net/java/sip/communicator/impl/gui/utils/ImageLoader.java deleted file mode 100644 index b32e9f5..0000000 --- a/src/net/java/sip/communicator/impl/gui/utils/ImageLoader.java +++ /dev/null @@ -1,1316 +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 java.io.*; -import java.net.*; -import java.util.*; -import java.util.List; - -import javax.imageio.*; -import javax.imageio.stream.*; - -import net.java.sip.communicator.impl.gui.*; -import net.java.sip.communicator.service.resources.*; -import net.java.sip.communicator.util.*; - -/** - * Stores and loads images used throughout this ui implementation. - * - * @author Yana Stamcheva - * @author Lubomir Marinov - */ -public class ImageLoader { - - private static Logger log = Logger.getLogger(ImageLoader.class); - - /** - * Stores all already loaded images. - */ - private static Hashtable loadedImages = new Hashtable(); - - /** - * The SIP Communicator logo 16x16 icon. - */ - public static final ImageID SIP_COMMUNICATOR_LOGO - = new ImageID("service.gui.SIP_COMMUNICATOR_LOGO"); - - /*------------------------------------------------------------------------ - * =========================LOOK AND FEEL IMAGES========================== - * ----------------------------------------------------------------------- - */ - /** - * The background image of a button. - */ - public static final ImageID BUTTON - = new ImageID("service.gui.lookandfeel.BUTTON"); - - /** - * The rollover image of a button. - */ - public static final ImageID BUTTON_ROLLOVER - = new ImageID("service.gui.lookandfeel.BUTTON_ROLLOVER"); - - /** - * The pressed toggle button background image. - */ - public static final ImageID TOGGLE_BUTTON_PRESSED - = new ImageID("service.gui.lookandfeel.TOGGLE_BUTTON_PRESSED"); - - /** - * The toggle button background image. - */ - public static final ImageID TOGGLE_BUTTON - = new ImageID("service.gui.lookandfeel.TOGGLE_BUTTON"); - - /** - * The image used for a horizontal split. - */ - public static final ImageID SPLITPANE_HORIZONTAL - = new ImageID("service.gui.lookandfeel.SPLITPANE_HORIZONTAL"); - - /** - * The image used for a vertical split. - */ - public static final ImageID SPLITPANE_VERTICAL - = new ImageID("service.gui.lookandfeel.SPLITPANE_VERTICAL"); - - /** - * The image used for the "thumb" of a vertical scrollbar. - */ - public static final ImageID SCROLLBAR_THUMB_VERTICAL - = new ImageID("service.gui.lookandfeel.SCROLLBAR_VERTICAL"); - - /** - * The image used for the "thumb" of a horizontal scrollbar. - */ - public static final ImageID SCROLLBAR_THUMB_HORIZONTAL - = new ImageID("service.gui.lookandfeel.SCROLLBAR_HORIZONTAL"); - - /** - * The image used for the "thumb handle" of a horizontal scrollbar. - */ - public static final ImageID SCROLLBAR_THUMB_HANDLE_HORIZONTAL - = new ImageID("service.gui.lookandfeel.SCROLLBAR_THUMB_HORIZONTAL"); - - /** - * The image used for the "thumb handle" of a vertical scrollbar. - */ - public static final ImageID SCROLLBAR_THUMB_HANDLE_VERTICAL - = new ImageID("service.gui.lookandfeel.SCROLLBAR_THUMB_VERTICAL"); - - /** - * The image used in the SIPCommLookAndFeel to paint the background - * of a tab. - */ - public static final ImageID TAB_LEFT_BG - = new ImageID("service.gui.lookandfeel.TAB_LEFT_BG"); - - /** - * The image used in the SIPCommLookAndFeel to paint the background - * of a tab. - */ - public static final ImageID TAB_MIDDLE_BG - = new ImageID("service.gui.lookandfeel.TAB_MIDDLE_BG"); - - /** - * The image used in the SIPCommLookAndFeel to paint the background - * of a tab. - */ - public static final ImageID TAB_RIGHT_BG - = new ImageID("service.gui.lookandfeel.TAB_RIGHT_BG"); - - /** - * The image used in the SIPCommLookAndFeel to paint the background - * of a selected tab. - */ - public static final ImageID SELECTED_TAB_LEFT_BG - = new ImageID("service.gui.lookandfeel.SELECTED_TAB_LEFT_BG"); - - /** - * The image used in the SIPCommLookAndFeel to paint the background - * of a selected tab. - */ - public static final ImageID SELECTED_TAB_MIDDLE_BG - = new ImageID("service.gui.lookandfeel.SELECTED_TAB_MIDDLE_BG"); - - /** - * The image used in the SIPCommLookAndFeel to paint the background - * of a selected tab. - */ - public static final ImageID SELECTED_TAB_RIGHT_BG - = new ImageID("service.gui.lookandfeel.SELECTED_TAB_RIGHT_BG"); - - /** - * The image used in the SIPCommLookAndFeel to paint the background - * of a closable tab. - */ - public static final ImageID CLOSABLE_TAB_BG - = new ImageID("service.gui.lookandfeel.CLOSABLE_TAB_BG"); - - /** - * The image used in the SIPCommLookAndFeel to paint the background - * of a closable selected tab. - */ - public static final ImageID SELECTED_CLOSABLE_TAB_BG - = new ImageID("service.gui.lookandfeel.SELECTED_CLOSABLE_TAB_BG"); - - /** - * The image used in the SIPCommLookAndFeel to paint a close - * button on a tab. - */ - public static final ImageID CLOSE_TAB_ICON - = new ImageID("service.gui.lookandfeel.CLOSE_TAB_ICON"); - - /** - * The image used in the SIPCommLookAndFeel to paint a rollover - * close button on a tab. - */ - public static final ImageID CLOSE_TAB_SELECTED_ICON - = new ImageID("service.gui.lookandfeel.CLOSE_TAB_SELECTED_ICON"); - - /** - * The image used in the SIPCommLookAndFeel to paint the icon - * used to delete text in text fields and editable combo boxes. - */ - public static final ImageID DELETE_TEXT_ICON - = new ImageID("service.gui.lookandfeel.DELETE_TEXT_ICON"); - - /** - * The image used in the SIPCommLookAndFeel to paint the rollover - * icon used to delete text in text fields and editable combo boxes. - */ - public static final ImageID DELETE_TEXT_ROLLOVER_ICON - = new ImageID("service.gui.lookandfeel.DELETE_TEXT_ROLLOVER_ICON"); - - /////////////////////// OptionPane icons ///////////////////////////// - - /** - * The icon used in the SIPCommLookAndFeel to paint the icon - * of an option pane warning message. - */ - public static final ImageID WARNING_ICON - = new ImageID("service.gui.icons.WARNING_ICON"); - - /** - * The icon used in the SIPCommLookAndFeel to paint the icon - * of an option pane error message. - */ - public static final ImageID ERROR_ICON - = new ImageID("service.gui.icons.ERROR_ICON"); - - /** - * The icon used in the SIPCommLookAndFeel to paint the icon - * of an option pane info message. - */ - public static final ImageID INFO_ICON - = new ImageID("service.gui.icons.INFO_ICON"); - - /*------------------------------------------------------------------------ - * ============================APPLICATION ICONS ========================= - * ----------------------------------------------------------------------- - */ - - /** - * The background of the main window and chat window. - */ - public static final ImageID MAIN_WINDOW_BACKGROUND - = new ImageID("service.gui.MAIN_WINDOW_BACKGROUND"); - - /** - * The add icon used in some forms. - */ - public static final ImageID ADD_ICON - = new ImageID("service.gui.icons.ADD_ICON"); - - /** - * The background of the main window and chat window. - */ - public static final ImageID MORE_BUTTON - = new ImageID("service.gui.buttons.MORE_BUTTON"); - - /** - * Closed group icon. - */ - public static final ImageID RIGHT_ARROW_ICON - = new ImageID("service.gui.icons.RIGHT_ARROW_ICON"); - - /** - * The background of the main window and chat window. - */ - public static final ImageID DOWN_ARROW_ICON - = new ImageID("service.gui.icons.DOWN_ARROW_ICON"); - - /** - * The icon on the "Add contact" button in the QuickMenu. - */ - public static final ImageID ACCOUNT_ICON - = new ImageID("service.gui.icons.ACCOUNT_ICON"); - - /** - * The icon on the "Add contact" button in the QuickMenu. - */ - public static final ImageID QUICK_MENU_ADD_ICON - = new ImageID("service.gui.icons.QUICK_MENU_ADD_ICON"); - - /** - * The icon on the "Configure" button in the QuickMenu. - */ - public static final ImageID QUICK_MENU_CONFIGURE_ICON - = new ImageID("service.gui.icons.QUICK_MENU_CONFIGURE_ICON"); - - /** - * The icon on the "Hide/Show offline contacts" button in the - * QuickMenu. - */ - public static final ImageID QUICK_MENU_SHOW_OFFLINE_ICON - = new ImageID("service.gui.icons.QUICK_MENU_SHOW_OFFLINE_ICON"); - - /** - * The icon on the "Hide/Show offline contacts" button in the - * QuickMenu. - */ - public static final ImageID QUICK_MENU_HIDE_OFFLINE_ICON - = new ImageID("service.gui.icons.QUICK_MENU_HIDE_OFFLINE_ICON"); - - /** - * The icon on the "Info" button in the QuickMenu. - */ - public static final ImageID QUICK_MENU_INFO_ICON - = new ImageID("service.gui.icons.QUICK_MENU_INFO_ICON"); - - /** - * The icon on the "Sound" button in the QuickMenu. - */ - public static final ImageID QUICK_MENU_SOUND_ON_ICON - = new ImageID("service.gui.icons.QUICK_MENU_SOUND_ON_ICON"); - - /** - * The icon on the "Sound" button in the QuickMenu. - */ - public static final ImageID QUICK_MENU_SOUND_OFF_ICON - = new ImageID("service.gui.icons.QUICK_MENU_SOUND_OFF_ICON"); - - /** - * The background rollover image of a QuickMenu button. - */ - public static final ImageID QUICK_MENU_MY_CHAT_ROOMS_ICON - = new ImageID("service.gui.icons.QUICK_MENU_MY_CHAT_ROOMS_ICON"); - - /** - * The call button image. - */ - public static final ImageID CALL_BUTTON_BG - = new ImageID("service.gui.buttons.CALL_BUTTON_BG"); - - /** - * The hangup button image. - */ - public static final ImageID HANGUP_BUTTON_BG - = new ImageID("service.gui.buttons.HANGUP_BUTTON_BG"); - - /** - * The hangup button mouse over image. - */ - public static final ImageID HANGUP_ROLLOVER_BUTTON_BG - = new ImageID("service.gui.buttons.HANGUP_ROLLOVER_BUTTON_BG"); - - /** - * The hangup button pressed image. - */ - public static final ImageID CALL_BUTTON_PRESSED_BG - = new ImageID("service.gui.buttons.CALL_BUTTON_PRESSED_BG"); - - /** - * The hangup button pressed image. - */ - public static final ImageID HANGUP_BUTTON_PRESSED_BG - = new ImageID("service.gui.buttons.HANGUP_BUTTON_PRESSED_BG"); - - /** - * The background image for the StatusSelectorBox. - */ - public static final ImageID STATUS_SELECTOR_BOX - = new ImageID("service.gui.buttons.STATUS_SELECTOR_BOX"); - - /** - * A dial button icon. - */ - public static final ImageID ONE_DIAL_BUTTON - = new ImageID("service.gui.buttons.ONE_DIAL_BUTTON"); - - /** - * A dial button icon. - */ - public static final ImageID TWO_DIAL_BUTTON - = new ImageID("service.gui.buttons.TWO_DIAL_BUTTON"); - - /** - * A dial button icon. - */ - public static final ImageID THREE_DIAL_BUTTON - = new ImageID("service.gui.buttons.THREE_DIAL_BUTTON"); - - /** - * A dial button icon. - */ - public static final ImageID FOUR_DIAL_BUTTON - = new ImageID("service.gui.buttons.FOUR_DIAL_BUTTON"); - - /** - * A dial button icon. - */ - public static final ImageID FIVE_DIAL_BUTTON - = new ImageID("service.gui.buttons.FIVE_DIAL_BUTTON"); - - /** - * A dial button icon. - */ - public static final ImageID SIX_DIAL_BUTTON - = new ImageID("service.gui.buttons.SIX_DIAL_BUTTON"); - - /** - * A dial button icon. - */ - public static final ImageID SEVEN_DIAL_BUTTON - = new ImageID("service.gui.buttons.SEVEN_DIAL_BUTTON"); - - /** - * A dial button icon. - */ - public static final ImageID EIGHT_DIAL_BUTTON - = new ImageID("service.gui.buttons.EIGHT_DIAL_BUTTON"); - - /** - * A dial button icon. - */ - public static final ImageID NINE_DIAL_BUTTON - = new ImageID("service.gui.buttons.NINE_DIAL_BUTTON"); - - /** - * A dial button icon. - */ - public static final ImageID STAR_DIAL_BUTTON - = new ImageID("service.gui.buttons.STAR_DIAL_BUTTON"); - - /** - * A dial button icon. - */ - public static final ImageID ZERO_DIAL_BUTTON - = new ImageID("service.gui.buttons.ZERO_DIAL_BUTTON"); - - /** - * A dial button icon. - */ - public static final ImageID DIEZ_DIAL_BUTTON - = new ImageID("service.gui.buttons.DIEZ_DIAL_BUTTON"); - - /** - * A dial button icon. The icon shown in the CallParticipant panel. - */ - public static final ImageID DIAL_BUTTON - = new ImageID("service.gui.buttons.DIAL_BUTTON"); - - /** - * A put-on/off-hold button icon. The icon shown in the CallParticipant - * panel. - */ - public static final ImageID HOLD_BUTTON - = new ImageID("service.gui.buttons.HOLD_BUTTON"); - - /** - * A mute button icon. The icon shown in the CallParticipant panel. - */ - public static final ImageID MUTE_BUTTON - = new ImageID("service.gui.buttons.MUTE_BUTTON"); - - /** - * A call-transfer button icon. The icon shown in the CallParticipant panel. - */ - public static final ImageID TRANSFER_CALL_BUTTON = - new ImageID("service.gui.buttons.TRANSFER_CALL_BUTTON"); - - /** - * The secure button on icon. The icon shown in the CallParticipant panel. - */ - public static final ImageID SECURE_BUTTON_ON = - new ImageID("service.gui.buttons.SECURE_BUTTON_ON"); - - /** - * The secure button off icon. The icon shown in the CallParticipant panel. - */ - public static final ImageID SECURE_BUTTON_OFF = - new ImageID("service.gui.buttons.SECURE_BUTTON_OFF"); - - /** - * The security button: encryted and SAS verified, encrypted only, security off. - */ - public static final ImageID ENCR_VERIFIED = new ImageID( - "service.gui.buttons.ENCR_VERIFIED"); - - public static final ImageID ENCR = new ImageID("service.gui.buttons.ENCR"); - - public static final ImageID ENCR_DISABLED = new ImageID( - "service.gui.buttons.ENCR_DISABLED"); - - /** - * The button icon of the Enter Full Screen command. The icon shown in the - * CallParticipant panel. - */ - public static final ImageID ENTER_FULL_SCREEN_BUTTON = - new ImageID("service.gui.buttons.ENTER_FULL_SCREEN_BUTTON"); - - /** - * The button icon of the Exit Full Screen command. The icon shown in the - * CallParticipant panel. - */ - public static final ImageID EXIT_FULL_SCREEN_BUTTON = - new ImageID("service.gui.buttons.EXIT_FULL_SCREEN_BUTTON"); - - /** - * The image used, when a contact has no photo specified. - */ - public static final ImageID DEFAULT_USER_PHOTO - = new ImageID("service.gui.DEFAULT_USER_PHOTO"); - - /** - * The image used to draw a frame around the contact photo image. - */ - public static final ImageID USER_PHOTO_FRAME - = new ImageID("service.gui.USER_PHOTO_FRAME"); - - /** - * The image used to draw a shadow over the contact photo image. - */ - public static final ImageID USER_PHOTO_SHADOW - = new ImageID("service.gui.USER_PHOTO_SHADOW"); - - /** - * The minimize button icon in the CallPanel. - */ - public static final ImageID CALL_PANEL_MINIMIZE_BUTTON - = new ImageID("service.gui.buttons.CALL_PANEL_MINIMIZE_BUTTON"); - - /** - * The restore button icon in the CallPanel. - */ - public static final ImageID CALL_PANEL_RESTORE_BUTTON - = new ImageID("service.gui.buttons.CALL_PANEL_RESTORE_BUTTON"); - - /** - * The minimize rollover button icon in the CallPanel. - */ - public static final ImageID CALL_PANEL_MINIMIZE_ROLLOVER_BUTTON - = new ImageID("service.gui.buttons.CALL_PANEL_MINIMIZE_ROLLOVER_BUTTON"); - - /** - * The restore rollover button icon in the CallPanel. - */ - public static final ImageID CALL_PANEL_RESTORE_ROLLOVER_BUTTON - = new ImageID("service.gui.buttons.CALL_PANEL_RESTORE_ROLLOVER_BUTTON"); - - /** - * The icon image of the "Add contact to chat" button in the - * chat window. - */ - public static final ImageID ADD_TO_CHAT_ICON - = new ImageID("service.gui.icons.ADD_TO_CHAT_ICON"); - - /** - * The image used for decoration of the "Add contact" window. - */ - public static final ImageID ADD_CONTACT_WIZARD_ICON - = new ImageID("service.gui.icons.ADD_CONTACT_WIZARD_ICON"); - - /** - * The image used for decoration of the "Add group" window. - */ - public static final ImageID ADD_GROUP_ICON - = new ImageID("service.gui.icons.ADD_GROUP_ICON"); - - /** - * The image used for decoration of the "Rename contact" window. - */ - public static final ImageID RENAME_DIALOG_ICON - = new ImageID("service.gui.icons.RENAME_DIALOG_ICON"); - - /** - * The image used for decoration of the "reason" dialog. The "reason" dialog - * is used wherever user should specify a reason for the operation he's - * trying to do. - */ - public static final ImageID REASON_DIALOG_ICON - = new ImageID("service.gui.icons.REASON_DIALOG_ICON"); - - /** - * The image used for decoration of the "Open in browser" item in - * the right button click menu in chat window. - */ - public static final ImageID BROWSER_ICON - = new ImageID("service.gui.icons.BROWSER_ICON"); - - /** - * The image used for decoration of all windows concerning the process of - * authorization. - */ - public static final ImageID AUTHORIZATION_ICON - = new ImageID("service.gui.icons.AUTHORIZATION_ICON"); - - /** - * The image used for decoration of incoming calls in the call list panel. - */ - public static final ImageID INCOMING_CALL_ICON - = new ImageID("service.gui.icons.INCOMING_CALL"); - - /** - * The image used for decoration of outgoing calls in the call list panel. - */ - public static final ImageID OUTGOING_CALL_ICON - = new ImageID("service.gui.icons.OUTGOING_CALL"); - - /** - * The image used in the right button menu for the move contact item. - */ - public static final ImageID MOVE_CONTACT_ICON - = new ImageID("service.gui.icons.MOVE_CONTACT"); - - /** - * The image used for error messages in the chat window. - */ - public static final ImageID EXCLAMATION_MARK - = new ImageID("service.gui.icons.EXCLAMATION_MARK"); - - /** - * The image used for about window background. - */ - public static final ImageID ABOUT_WINDOW_BACKGROUND - = new ImageID("service.gui.ABOUT_WINDOW_BACKGROUND"); - - /** - * The image used for opened groups. - */ - public static final ImageID OPENED_GROUP - = new ImageID("service.gui.icons.OPENED_GROUP"); - - /** - * The image used for closed groups. - */ - public static final ImageID CLOSED_GROUP - = new ImageID("service.gui.icons.CLOSED_GROUP"); - - /** - * The image used for chat rooms. - */ - public static final ImageID CHAT_ROOM_16x16_ICON - = new ImageID("service.gui.icons.CHAT_ROOM_16x16_ICON"); - - /** - * The image used for multi user chat servers. - */ - public static final ImageID CHAT_SERVER_16x16_ICON - = new ImageID("service.gui.icons.CHAT_SERVER_16x16_ICON"); - - /** - * The image used to indicate in the contact list that a message is received - * from a certain contact. - */ - public static final ImageID MESSAGE_RECEIVED_ICON - = new ImageID("service.gui.icons.MESSAGE_RECEIVED_ICON"); - - /** - * The image used to set to the chat room "join" right button menu. - */ - public static final ImageID JOIN_ICON - = new ImageID("service.gui.icons.JOIN_ICON"); - - /** - * The image used to set to the chat room "join as" right button menu. - */ - public static final ImageID JOIN_AS_ICON - = new ImageID("service.gui.icons.JOIN_AS_ICON"); - - /** - * The image used to set to the chat room "leave" right button menu. - */ - public static final ImageID LEAVE_ICON - = new ImageID("service.gui.icons.LEAVE_ICON"); - - /** - * Background image of the dial button. - */ - public static final ImageID DIAL_BUTTON_BG - = new ImageID("service.gui.buttons.DIAL_BUTTON_BG"); - - /** - * Background image when rollover on the dial button. - */ - public static final ImageID DIAL_BUTTON_ROLLOVER_BG - = new ImageID("service.gui.buttons.DIAL_BUTTON_ROLLOVER_BG"); - - /** - * Icon used in the chat window for the "Send as SMS" option. - */ - public static final ImageID SEND_SMS_ICON - = new ImageID("service.gui.icons.SEND_SMS_ICON"); - - /** - * Tool bar background image. - */ - public static final ImageID TOOL_BAR_BACKGROUND - = new ImageID("service.gui.TOOL_BAR_BACKGROUND"); - - /** - * Main menu background image. - */ - public static final ImageID MENU_BACKGROUND - = new ImageID("service.gui.MENU_BACKGROUND"); - - /** - * Title bar background image. - */ - public static final ImageID WINDOW_TITLE_BAR - = new ImageID("service.gui.WINDOW_TITLE_BAR"); - - /** - * Title bar background image. - */ - public static final ImageID WINDOW_TITLE_BAR_BG - = new ImageID("service.gui.WINDOW_TITLE_BAR_BG"); - - /** - * Title bar background image. - */ - public static final ImageID QUICK_MENU_ABOUT_ICON - = new ImageID("QUICK_MENU_ABOUT_ICON"); - - /** - * Title bar background image. - */ - public static final ImageID QUICK_MENU_CREATE_GROUP_ICON - = new ImageID("QUICK_MENU_CREATE_GROUP_ICON"); - - /** - * More actions button. - */ - public static final ImageID MORE_ACTIONS_BUTTON - = new ImageID("service.gui.buttons.MORE_ACTIONS_BUTTON"); - - /** - * More actions button rollover state. - */ - public static final ImageID MORE_ACTIONS_ROLLOVER_BUTTON - = new ImageID("service.gui.buttons.MORE_ACTIONS_ROLLOVER_BUTTON"); - - /** - * More actions button. - */ - public static final ImageID HIDE_ACTIONS_BUTTON - = new ImageID("service.gui.buttons.HIDE_ACTIONS_BUTTON"); - - /** - * More actions button rollover state. - */ - public static final ImageID HIDE_ACTIONS_ROLLOVER_BUTTON - = new ImageID("service.gui.buttons.HIDE_ACTIONS_ROLLOVER_BUTTON"); - - // ///////////////////// Edit Text Toolbar icons ////////////////////////// - - /** - * Add not in contact list contact icon. - */ - public static final ImageID ADD_CONTACT_CHAT_ICON - = new ImageID("service.gui.icons.ADD_CONTACT_CHAT_ICON"); - - /////////////////////// Edit Text Toolbar icons ///////////////////////// - - /** - * "Bold" button image in the EditTextToolBar in the - * ChatWindow. - */ - public static final ImageID TEXT_BOLD_BUTTON - = new ImageID("service.gui.buttons.TEXT_BOLD_BUTTON"); - - /** - * "Italic" button image in the EditTextToolBar in the - * ChatWindow. - */ - public static final ImageID TEXT_ITALIC_BUTTON - = new ImageID("service.gui.buttons.TEXT_ITALIC_BUTTON"); - - /** - * "Underline" button image in the EditTextToolBar in the - * ChatWindow. - */ - public static final ImageID TEXT_UNDERLINED_BUTTON - = new ImageID("service.gui.buttons.TEXT_UNDERLINED_BUTTON"); - - /** - * Edit toolbar button background icon. - */ - public static final ImageID EDIT_TOOLBAR_BUTTON - = new ImageID("service.gui.buttons.EDIT_TOOLBAR_BUTTON"); - - /** - * Edit toolbar button background icon for toggled state. - */ - public static final ImageID EDIT_TOOLBAR_BUTTON_PRESSED - = new ImageID("service.gui.buttons.EDIT_TOOLBAR_BUTTON_PRESSED"); - - /** - * The icon shown in the invite dialog. - */ - public static final ImageID INVITE_DIALOG_ICON - = new ImageID("service.gui.icons.INVITE_DIALOG_ICON"); - - // ///////////////////////// Main Toolbar icons //////////////////////////// - - /** - * The background image of a button in one of the ChatWindow - * toolbars. - */ - public static final ImageID CHAT_TOOLBAR_BUTTON_BG - = new ImageID("MSG_TOOLBAR_BUTTON_BG"); - - /** - * The background rollover image of a button in one of the - * ChatWindow toolbars. - */ - public static final ImageID CHAT_TOOLBAR_ROLLOVER_BUTTON_BG - = new ImageID("MSG_TOOLBAR_ROLLOVER_BUTTON_BG"); - - /** - * Copy icon. - */ - public static final ImageID COPY_ICON - = new ImageID("service.gui.icons.COPY_ICON"); - - /** - * Cut icon. - */ - public static final ImageID CUT_ICON - = new ImageID("service.gui.icons.CUT_ICON"); - - /** - * Paste icon. - */ - public static final ImageID PASTE_ICON - = new ImageID("service.gui.icons.PASTE_ICON"); - - /** - * Smiley icon, used for the "Smiley" button in the MainToolBar. - */ - public static final ImageID SMILIES_ICON - = new ImageID("service.gui.icons.SMILIES_ICON"); - - /** - * Save icon. - */ - public static final ImageID SAVE_ICON - = new ImageID("service.gui.icons.SAVE_ICON"); - - /** - * Print icon. - */ - public static final ImageID PRINT_ICON - = new ImageID("service.gui.icons.PRINT_ICON"); - - /** - * Close icon. - */ - public static final ImageID CLOSE_ICON - = new ImageID("service.gui.icons.CLOSE_ICON"); - - /** - * Left flash icon. - */ - public static final ImageID PREVIOUS_ICON - = new ImageID("service.gui.icons.PREVIOUS_ICON"); - - /** - * Right flash icon. - */ - public static final ImageID NEXT_ICON - = new ImageID("service.gui.icons.NEXT_ICON"); - - /** - * Clock icon. - */ - public static final ImageID HISTORY_ICON - = new ImageID("service.gui.icons.HISTORY_ICON"); - - /** - * Send file icon. - */ - public static final ImageID SEND_FILE_ICON - = new ImageID("service.gui.icons.SEND_FILE_ICON"); - - /** - * Font icon. - */ - public static final ImageID FONT_ICON - = new ImageID("service.gui.icons.FONT_ICON"); - - // ///////////////////// Chat contact icons //////////////////////////////// - - /** - * A special "info" icon used in the ChatContactPanel. - */ - public static final ImageID CHAT_CONTACT_INFO_BUTTON - = new ImageID("service.gui.buttons.CHAT_CONTACT_INFO_BUTTON"); - - /** - * A special "info" rollover icon used in the ChatContactPanel. - */ - public static final ImageID CHAT_CONTACT_INFO_ROLLOVER_BUTTON - = new ImageID("service.gui.buttons.CHAT_CONTACT_INFO_ROLLOVER_BUTTON"); - - /** - * A special "call" icon used in the ChatContactPanel. - */ - public static final ImageID CHAT_CONTACT_CALL_BUTTON - = new ImageID("service.gui.buttons.CHAT_CONTACT_CALL_BUTTON"); - - /** - * A special "call" rollover icon used in the ChatContactPanel. - */ - public static final ImageID CHAT_CONTACT_CALL_ROLLOVER_BUTTON - = new ImageID("service.gui.buttons.CHAT_CONTACT_CALL_ROLLOVER_BUTTON"); - - /** - * A special "send file" icon used in the ChatContactPanel. - */ - public static final ImageID CHAT_CONTACT_SEND_FILE_BUTTON - = new ImageID("service.gui.buttons.CHAT_CONTACT_SEND_FILE_BUTTON"); - - /** - * A special "send file" rollover icon used in the - * ChatContactPanel. - */ - public static final ImageID CHAT_SEND_FILE_ROLLOVER_BUTTON - = new ImageID("service.gui.buttons.CHAT_SEND_FILE_ROLLOVER_BUTTON"); - - public static final ImageID CHAT_CONFIGURE_ICON - = new ImageID("service.gui.icons.CHAT_CONFIGURE_ICON"); - - ////////////////////////////// 16x16 icons //////////////////////////////// - /** - * Send message 16x16 image. - */ - public static final ImageID SEND_MESSAGE_16x16_ICON - = new ImageID("service.gui.icons.SEND_MESSAGE_16x16_ICON"); - - /** - * Call 16x16 image. - * //TODO : change to an appropriate logo - */ - public static final ImageID CALL_16x16_ICON - = new ImageID("service.gui.icons.CALL_16x16_ICON"); - - /** - * Delete 16x16 image. - */ - public static final ImageID DELETE_16x16_ICON - = new ImageID("service.gui.icons.DELETE_16x16_ICON"); - - /** - * History 16x16 image. - */ - public static final ImageID HISTORY_16x16_ICON - = new ImageID("service.gui.icons.HISTORY_16x16_ICON"); - - /** - * Send file 16x16 image. - */ - public static final ImageID SEND_FILE_16x16_ICON - = new ImageID("service.gui.icons.SEND_FILE_16x16_ICON"); - - /** - * Groups 16x16 image. - */ - public static final ImageID GROUPS_16x16_ICON - = new ImageID("service.gui.icons.GROUPS_16x16_ICON"); - - /** - * Add contact 16x16 image. - */ - public static final ImageID ADD_CONTACT_16x16_ICON - = new ImageID("service.gui.icons.ADD_CONTACT_16x16_ICON"); - - /** - * Rename 16x16 image. - */ - public static final ImageID RENAME_16x16_ICON - = new ImageID("service.gui.icons.RENAME_16x16_ICON"); - - /////////////////////////////////////////////////////////////////////////// - - /** - * Toolbar drag area icon. - */ - public static final ImageID TOOLBAR_DRAG_ICON = new ImageID( - "service.gui.icons.TOOLBAR_DRAG_ICON"); - - /** - * The background image of the AuthenticationWindow. - */ - public static final ImageID AUTH_WINDOW_BACKGROUND = new ImageID( - "service.gui.AUTH_WINDOW_BACKGROUND"); - - /** - * The icon used to indicate a search. - */ - public static final ImageID SEARCH_ICON - = new ImageID("service.gui.icons.SEARCH_ICON"); - - /** - * The icon used to indicate a search. - */ - public static final ImageID SEARCH_ICON_16x16 - = new ImageID("service.gui.icons.SEARCH_ICON_16x16"); - - /* - * ======================================================================= - * ------------------------ USERS' ICONS --------------------------------- - * ======================================================================= - */ - - /** - * Contact "online" icon. - */ - public static final ImageID USER_ONLINE_ICON - = new ImageID("service.gui.statusicons.USER_ONLINE_ICON"); - - /** - * Contact "offline" icon. - */ - public static final ImageID USER_OFFLINE_ICON - = new ImageID("service.gui.statusicons.USER_OFFLINE_ICON"); - - /** - * Contact "away" icon. - */ - public static final ImageID USER_AWAY_ICON - = new ImageID("service.gui.statusicons.USER_AWAY_ICON"); - - /** - * Contact "not available" icon. - */ - public static final ImageID USER_NA_ICON - = new ImageID("service.gui.statusicons.USER_NA_ICON"); - - /** - * Contact "free for chat" icon. - */ - public static final ImageID USER_FFC_ICON - = new ImageID("service.gui.statusicons.USER_FFC_ICON"); - - /** - * Contact "do not disturb" icon. - */ - public static final ImageID USER_DND_ICON - = new ImageID("service.gui.statusicons.USER_DND_ICON"); - - /** - * Contact "occupied" icon. - */ - public static final ImageID USER_OCCUPIED_ICON - = new ImageID("service.gui.statusicons.USER_OCCUPIED_ICON"); - - /* - * ===================================================================== - * ---------------------------- SMILIES -------------------------------- - * ===================================================================== - */ - - public static final ImageID SMILEY1 - = new ImageID("service.gui.smilies.SMILEY1"); - - public static final ImageID SMILEY2 - = new ImageID("service.gui.smilies.SMILEY2"); - - public static final ImageID SMILEY3 - = new ImageID("service.gui.smilies.SMILEY3"); - - public static final ImageID SMILEY4 - = new ImageID("service.gui.smilies.SMILEY4"); - - public static final ImageID SMILEY5 - = new ImageID("service.gui.smilies.SMILEY5"); - - public static final ImageID SMILEY6 - = new ImageID("service.gui.smilies.SMILEY6"); - - public static final ImageID SMILEY7 - = new ImageID("service.gui.smilies.SMILEY7"); - - public static final ImageID SMILEY8 - = new ImageID("service.gui.smilies.SMILEY8"); - - public static final ImageID SMILEY9 - = new ImageID("service.gui.smilies.SMILEY9"); - - public static final ImageID SMILEY10 - = new ImageID("service.gui.smilies.SMILEY10"); - - public static final ImageID SMILEY11 - = new ImageID("service.gui.smilies.SMILEY11"); - - public static final ImageID SMILEY12 - = new ImageID("service.gui.smilies.SMILEY12"); - - /** - * Load default smilies pack. - * - * @return the ArrayList of all smilies. - */ - public static Collection getDefaultSmiliesPack() { - List defaultPackList = new ArrayList(); - - defaultPackList.add(new Smiley(ImageLoader.SMILEY1, new String[] { - ";-(", ";(", ":'(", ":'-(", ":~-(", ":~(" })); - - defaultPackList.add(new Smiley(ImageLoader.SMILEY2, new String[] { - "B-)", "B)" })); - - defaultPackList.add(new Smiley(ImageLoader.SMILEY3, new String[] { - ":-*", ":*" })); - - defaultPackList.add(new Smiley(ImageLoader.SMILEY4, new String[] { - ":-0" })); - - defaultPackList.add(new Smiley(ImageLoader.SMILEY5, new String[] { - ":-((", ":((" })); - - defaultPackList.add(new Smiley(ImageLoader.SMILEY6, new String[] { - "(L)" , "(l)"})); - - defaultPackList.add(new Smiley(ImageLoader.SMILEY7, new String[] { - ":-|", ":|" })); - - defaultPackList.add(new Smiley(ImageLoader.SMILEY8, new String[] { - ":-P", ":P", ":-p", ":p" })); - - defaultPackList.add(new Smiley(ImageLoader.SMILEY9, new String[] { - ":-))", ":))" })); - - defaultPackList.add(new Smiley(ImageLoader.SMILEY10, new String[] { - ":-(", ":(" })); - - defaultPackList.add(new Smiley(ImageLoader.SMILEY11, new String[] { - ":-)", ":)" })); - - defaultPackList.add(new Smiley(ImageLoader.SMILEY12, new String[] { - ";-)", ";)" })); - - return defaultPackList; - } - - /** - * Returns a Smiley object for a given smiley string. - * @param smileyString One of :-), ;-), etc. - * @return A Smiley object for a given smiley string. - */ - public static Smiley getSmiley(String smileyString) { - Collection smilies = getDefaultSmiliesPack(); - - for (Smiley smiley : smilies) { - String[] smileyStrings = smiley.getSmileyStrings(); - - for (int j = 0; j < smileyStrings.length; j++) { - String srcString = smileyStrings[j]; - - if (srcString.equals(smileyString)) - return smiley; - } - } - return null; - } - - /** - * Loads an image from a given image identifier. - * - * @param imageID The identifier of the image. - * @return The image for the given identifier. - */ - public static BufferedImage getImage(ImageID imageID) - { - BufferedImage image = null; - - if (loadedImages.containsKey(imageID)) - { - image = (BufferedImage) loadedImages.get(imageID); - } - else - { - URL path = GuiActivator.getResources().getImageURL(imageID.getId()); - - if (path == null) - { - return null; - } - - try - { - image = ImageIO.read(path); - - loadedImages.put(imageID, image); - } - catch (Exception exc) - { - log.error("Failed to load image:" + path, exc); - } - } - - return image; - } - - /** - * Loads an image from a given path. - * - * @param path The path url of the image. - * @return The image for the given identifier. - */ - public static BufferedImage getImageFromUrl(String path) - { - BufferedImage image = null; - - try - { - URL imgUrl = new URL(path); - - image = ImageIO.read(imgUrl.openStream()); - } - catch (Exception exc) - { - log.error("Failed to load image:" + path, exc); - } - - return image; - } - - /** - * Loads an image from a given image identifier. - * @param imageID The identifier of the image. - * @return The image for the given identifier. - */ - public static byte[] getImageInBytes(ImageID imageID) - { - InputStream in = GuiActivator.getResources(). - getImageInputStream(imageID.getId()); - - if (in == null) - return null; - byte[] image = null; - try - { - image = new byte[in.available()]; - - in.read(image); - } catch (IOException e) - { - log.error("Failed to load image:" + imageID.getId(), e); - } - - return image; - } - - /** - * Loads an image from a given bytes array. - * @param imageBytes The bytes array to load the image from. - * @return The image for the given bytes array. - */ - public static Image getBytesInImage(byte[] imageBytes) - { - Image image = null; - try - { - image = ImageIO.read( - new ByteArrayInputStream(imageBytes)); - - } - catch (Exception e) - { - log.error("Failed to convert bytes to image.", e); - } - return image; - } - - /** - * Loads an animated gif image. - * @param animatedImage the animated image buffer - * @return a BufferedImage array containing the animated image. - */ - public static BufferedImage[] getAnimatedImage(byte[] animatedImage) - { - Iterator readers = ImageIO.getImageReadersBySuffix("gif"); - - ImageReader reader = (ImageReader) readers.next(); - - ImageInputStream iis; - - BufferedImage[] images = null; - - try { - iis = ImageIO.createImageInputStream( - new ByteArrayInputStream(animatedImage)); - - reader.setInput(iis); - - int numImages = reader.getNumImages(true); - - if(numImages == 0) - return null; - - images = new BufferedImage[numImages]; - - for (int i = 0; i < numImages; ++i) { - images[i] = reader.read(i); - } - - } catch (IOException e) { - log.error("Failed to load image.", e); - } finally { - log.logExit(); - } - return images; - } - - /** - * Returns the path string of an already loaded image, otherwise null. - * - * @param image - * The image wich path to return. - * @return The path string of an already loaded image, otherwise null. - */ - public static String getImagePath(Image image) - { - Iterator i = ImageLoader.loadedImages.entrySet().iterator(); - - while (i.hasNext()) { - Map.Entry entry = (Map.Entry) i.next(); - - if (entry.getValue().equals(image)) - { - String imageID = ((ImageID) entry.getKey()).getId(); - - try - { - return GuiActivator.getResources(). - getImageURL(imageID).toURI().toString(); - } - catch(URISyntaxException ex) - { - log.error("Failed to create path for image " + imageID); - } - } - } - - return null; - } -} diff --git a/src/net/java/sip/communicator/impl/gui/utils/Smiley.java b/src/net/java/sip/communicator/impl/gui/utils/Smiley.java deleted file mode 100644 index 955a475..0000000 --- a/src/net/java/sip/communicator/impl/gui/utils/Smiley.java +++ /dev/null @@ -1,91 +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.net.*; - -import net.java.sip.communicator.impl.gui.*; -import net.java.sip.communicator.service.resources.*; - -/** - * The Smiley is used to store a smiley. - * - * @author Yana Stamcheva - */ -public class Smiley { - - private ImageID imageID; - - private String[] smileyStrings; - - /** - * Creates an instance of Smily, by specifying the smily - * image identifier and the strings corresponding to it. - * @param imageID The image identifier of the smily icon. - * @param smileyStrings A set of strings corresponding to the smily - * icon. - */ - public Smiley(ImageID imageID, String[] smileyStrings) { - - this.imageID = imageID; - - this.setSmileyStrings(smileyStrings); - } - - /** - * Returns the set of Strings corresponding to this smily. - * @return the set of Strings corresponding to this smily. - */ - public String[] getSmileyStrings() { - - return smileyStrings; - } - - /** - * Sets the set of Strings corresponding to this smily. They could be - * ":-)", ":)", ":))" for example. - * @param smileyStrings the set of Strings corresponding to this smily. - */ - public void setSmileyStrings(String[] smileyStrings) { - - this.smileyStrings = smileyStrings; - } - - /** - * Returns the default String corresponding for this smily. For example - * ":-)". - * @return the default String corresponding for this smily. - */ - public String getDefaultString() { - - return this.smileyStrings[0]; - } - - /** - * Returns the identifier of the image corresponding to this smily. - * @return the identifier of the image corresponding to this smily. - */ - public ImageID getImageID() { - - return this.imageID; - } - - /** - * Returns the path of the image corresponding to this smily. - * @return the path of the image corresponding to this smily. - */ - public String getImagePath() - { - URL url = GuiActivator.getResources(). - getImageURL(this.getImageID().getId()); - - if(url == null) - return null; - - return url.toString(); - } -} diff --git a/src/net/java/sip/communicator/swing/AntialiasingManager.java b/src/net/java/sip/communicator/swing/AntialiasingManager.java new file mode 100644 index 0000000..1577159 --- /dev/null +++ b/src/net/java/sip/communicator/swing/AntialiasingManager.java @@ -0,0 +1,32 @@ +/* + * 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.swing; + +import java.awt.*; + +/** + * Through the AntialiasingManager the developer could activate the + * antialiasing mechanism when painting. The method that do the job is + * the activateAntialiasing method. It takes a Graphics + * object and activates the antialiasing for it. + * + * @author Yana Stamcheva + */ +public class AntialiasingManager { + + /** + * Activates the antialiasing mechanism for the given Graphics + * object. + * @param g The Graphics object. + */ + public static void activateAntialiasing(Graphics g) { + Graphics2D g2d = (Graphics2D) g; + + g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, + RenderingHints.VALUE_ANTIALIAS_ON); + } +} diff --git a/src/net/java/sip/communicator/swing/ImageCanvas.java b/src/net/java/sip/communicator/swing/ImageCanvas.java new file mode 100644 index 0000000..6c90c79 --- /dev/null +++ b/src/net/java/sip/communicator/swing/ImageCanvas.java @@ -0,0 +1,72 @@ +/* + * 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.swing; + +import java.awt.*; + +import javax.swing.*; + +/** + * @author Lubomir Marinov + */ +public class ImageCanvas + extends TransparentPanel +{ + private final ImageIcon icon; + + public ImageCanvas(Image image) + { + icon = (image == null) ? null : new ImageIcon(image); + + if (icon != null) + { + final int preferredWidth = icon.getIconWidth(); + final int preferredHeight = icon.getIconHeight(); + setMinimumSize(new Dimension(preferredWidth / 2, + preferredHeight / 2)); + setPreferredSize(new Dimension(preferredWidth, preferredHeight)); + } + } + + protected void paintComponent(Graphics g) + { + super.paintComponent(g); + + if (icon == null) + return; + + int imageWidth = icon.getIconWidth(); + if (imageWidth < 1) + return; + int imageHeight = icon.getIconHeight(); + if (imageHeight < 1) + return; + + int width = getWidth(); + boolean scale = false; + float scaleFactor = 1; + if (imageWidth > width) + { + scale = true; + scaleFactor = width / (float) imageWidth; + } + int height = getHeight(); + if (imageHeight > height) + { + scale = true; + scaleFactor = Math.min(scaleFactor, height / (float) imageHeight); + } + if (scale) + { + imageWidth = Math.round(imageWidth * scaleFactor); + imageHeight = Math.round(imageHeight * scaleFactor); + } + + g.drawImage(icon.getImage(), (width - imageWidth) / 2, + (height - imageHeight) / 2, imageWidth, imageHeight, null); + } +} diff --git a/src/net/java/sip/communicator/swing/ImageLoader.java b/src/net/java/sip/communicator/swing/ImageLoader.java new file mode 100644 index 0000000..e6ccb20 --- /dev/null +++ b/src/net/java/sip/communicator/swing/ImageLoader.java @@ -0,0 +1,1318 @@ +/* + * 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.swing; + +import java.awt.*; +import java.awt.image.*; +import java.io.*; +import java.net.*; +import java.util.*; +import java.util.List; + +import javax.imageio.*; +import javax.imageio.stream.*; + +import net.java.sip.communicator.service.resources.*; +import net.java.sip.communicator.util.*; + +/** + * Stores and loads images used throughout this ui implementation. + * + * @author Yana Stamcheva + * @author Lubomir Marinov + */ +public class ImageLoader { + + private static Logger log = Logger.getLogger(ImageLoader.class); + + /** + * Stores all already loaded images. + */ + private static Hashtable loadedImages = new Hashtable(); + + /** + * The SIP Communicator logo 16x16 icon. + */ + public static final ImageID SIP_COMMUNICATOR_LOGO + = new ImageID("service.gui.SIP_COMMUNICATOR_LOGO"); + + /*------------------------------------------------------------------------ + * =========================LOOK AND FEEL IMAGES========================== + * ----------------------------------------------------------------------- + */ + /** + * The background image of a button. + */ + public static final ImageID BUTTON + = new ImageID("service.gui.lookandfeel.BUTTON"); + + /** + * The rollover image of a button. + */ + public static final ImageID BUTTON_ROLLOVER + = new ImageID("service.gui.lookandfeel.BUTTON_ROLLOVER"); + + /** + * The pressed toggle button background image. + */ + public static final ImageID TOGGLE_BUTTON_PRESSED + = new ImageID("service.gui.lookandfeel.TOGGLE_BUTTON_PRESSED"); + + /** + * The toggle button background image. + */ + public static final ImageID TOGGLE_BUTTON + = new ImageID("service.gui.lookandfeel.TOGGLE_BUTTON"); + + /** + * The image used for a horizontal split. + */ + public static final ImageID SPLITPANE_HORIZONTAL + = new ImageID("service.gui.lookandfeel.SPLITPANE_HORIZONTAL"); + + /** + * The image used for a vertical split. + */ + public static final ImageID SPLITPANE_VERTICAL + = new ImageID("service.gui.lookandfeel.SPLITPANE_VERTICAL"); + + /** + * The image used for the "thumb" of a vertical scrollbar. + */ + public static final ImageID SCROLLBAR_THUMB_VERTICAL + = new ImageID("service.gui.lookandfeel.SCROLLBAR_VERTICAL"); + + /** + * The image used for the "thumb" of a horizontal scrollbar. + */ + public static final ImageID SCROLLBAR_THUMB_HORIZONTAL + = new ImageID("service.gui.lookandfeel.SCROLLBAR_HORIZONTAL"); + + /** + * The image used for the "thumb handle" of a horizontal scrollbar. + */ + public static final ImageID SCROLLBAR_THUMB_HANDLE_HORIZONTAL + = new ImageID("service.gui.lookandfeel.SCROLLBAR_THUMB_HORIZONTAL"); + + /** + * The image used for the "thumb handle" of a vertical scrollbar. + */ + public static final ImageID SCROLLBAR_THUMB_HANDLE_VERTICAL + = new ImageID("service.gui.lookandfeel.SCROLLBAR_THUMB_VERTICAL"); + + /** + * The image used in the SIPCommLookAndFeel to paint the background + * of a tab. + */ + public static final ImageID TAB_LEFT_BG + = new ImageID("service.gui.lookandfeel.TAB_LEFT_BG"); + + /** + * The image used in the SIPCommLookAndFeel to paint the background + * of a tab. + */ + public static final ImageID TAB_MIDDLE_BG + = new ImageID("service.gui.lookandfeel.TAB_MIDDLE_BG"); + + /** + * The image used in the SIPCommLookAndFeel to paint the background + * of a tab. + */ + public static final ImageID TAB_RIGHT_BG + = new ImageID("service.gui.lookandfeel.TAB_RIGHT_BG"); + + /** + * The image used in the SIPCommLookAndFeel to paint the background + * of a selected tab. + */ + public static final ImageID SELECTED_TAB_LEFT_BG + = new ImageID("service.gui.lookandfeel.SELECTED_TAB_LEFT_BG"); + + /** + * The image used in the SIPCommLookAndFeel to paint the background + * of a selected tab. + */ + public static final ImageID SELECTED_TAB_MIDDLE_BG + = new ImageID("service.gui.lookandfeel.SELECTED_TAB_MIDDLE_BG"); + + /** + * The image used in the SIPCommLookAndFeel to paint the background + * of a selected tab. + */ + public static final ImageID SELECTED_TAB_RIGHT_BG + = new ImageID("service.gui.lookandfeel.SELECTED_TAB_RIGHT_BG"); + + /** + * The image used in the SIPCommLookAndFeel to paint the background + * of a closable tab. + */ + public static final ImageID CLOSABLE_TAB_BG + = new ImageID("service.gui.lookandfeel.CLOSABLE_TAB_BG"); + + /** + * The image used in the SIPCommLookAndFeel to paint the background + * of a closable selected tab. + */ + public static final ImageID SELECTED_CLOSABLE_TAB_BG + = new ImageID("service.gui.lookandfeel.SELECTED_CLOSABLE_TAB_BG"); + + /** + * The image used in the SIPCommLookAndFeel to paint a close + * button on a tab. + */ + public static final ImageID CLOSE_TAB_ICON + = new ImageID("service.gui.lookandfeel.CLOSE_TAB_ICON"); + + /** + * The image used in the SIPCommLookAndFeel to paint a rollover + * close button on a tab. + */ + public static final ImageID CLOSE_TAB_SELECTED_ICON + = new ImageID("service.gui.lookandfeel.CLOSE_TAB_SELECTED_ICON"); + + /** + * The image used in the SIPCommLookAndFeel to paint the icon + * used to delete text in text fields and editable combo boxes. + */ + public static final ImageID DELETE_TEXT_ICON + = new ImageID("service.gui.lookandfeel.DELETE_TEXT_ICON"); + + /** + * The image used in the SIPCommLookAndFeel to paint the rollover + * icon used to delete text in text fields and editable combo boxes. + */ + public static final ImageID DELETE_TEXT_ROLLOVER_ICON + = new ImageID("service.gui.lookandfeel.DELETE_TEXT_ROLLOVER_ICON"); + + /////////////////////// OptionPane icons ///////////////////////////// + + /** + * The icon used in the SIPCommLookAndFeel to paint the icon + * of an option pane warning message. + */ + public static final ImageID WARNING_ICON + = new ImageID("service.gui.icons.WARNING_ICON"); + + /** + * The icon used in the SIPCommLookAndFeel to paint the icon + * of an option pane error message. + */ + public static final ImageID ERROR_ICON + = new ImageID("service.gui.icons.ERROR_ICON"); + + /** + * The icon used in the SIPCommLookAndFeel to paint the icon + * of an option pane info message. + */ + public static final ImageID INFO_ICON + = new ImageID("service.gui.icons.INFO_ICON"); + + /*------------------------------------------------------------------------ + * ============================APPLICATION ICONS ========================= + * ----------------------------------------------------------------------- + */ + + /** + * The background of the main window and chat window. + */ + public static final ImageID MAIN_WINDOW_BACKGROUND + = new ImageID("service.gui.MAIN_WINDOW_BACKGROUND"); + + /** + * The add icon used in some forms. + */ + public static final ImageID ADD_ICON + = new ImageID("service.gui.icons.ADD_ICON"); + + /** + * The background of the main window and chat window. + */ + public static final ImageID MORE_BUTTON + = new ImageID("service.gui.buttons.MORE_BUTTON"); + + /** + * Closed group icon. + */ + public static final ImageID RIGHT_ARROW_ICON + = new ImageID("service.gui.icons.RIGHT_ARROW_ICON"); + + /** + * The background of the main window and chat window. + */ + public static final ImageID DOWN_ARROW_ICON + = new ImageID("service.gui.icons.DOWN_ARROW_ICON"); + + /** + * The icon on the "Add contact" button in the QuickMenu. + */ + public static final ImageID ACCOUNT_ICON + = new ImageID("service.gui.icons.ACCOUNT_ICON"); + + /** + * The icon on the "Add contact" button in the QuickMenu. + */ + public static final ImageID QUICK_MENU_ADD_ICON + = new ImageID("service.gui.icons.QUICK_MENU_ADD_ICON"); + + /** + * The icon on the "Configure" button in the QuickMenu. + */ + public static final ImageID QUICK_MENU_CONFIGURE_ICON + = new ImageID("service.gui.icons.QUICK_MENU_CONFIGURE_ICON"); + + /** + * The icon on the "Hide/Show offline contacts" button in the + * QuickMenu. + */ + public static final ImageID QUICK_MENU_SHOW_OFFLINE_ICON + = new ImageID("service.gui.icons.QUICK_MENU_SHOW_OFFLINE_ICON"); + + /** + * The icon on the "Hide/Show offline contacts" button in the + * QuickMenu. + */ + public static final ImageID QUICK_MENU_HIDE_OFFLINE_ICON + = new ImageID("service.gui.icons.QUICK_MENU_HIDE_OFFLINE_ICON"); + + /** + * The icon on the "Info" button in the QuickMenu. + */ + public static final ImageID QUICK_MENU_INFO_ICON + = new ImageID("service.gui.icons.QUICK_MENU_INFO_ICON"); + + /** + * The icon on the "Sound" button in the QuickMenu. + */ + public static final ImageID QUICK_MENU_SOUND_ON_ICON + = new ImageID("service.gui.icons.QUICK_MENU_SOUND_ON_ICON"); + + /** + * The icon on the "Sound" button in the QuickMenu. + */ + public static final ImageID QUICK_MENU_SOUND_OFF_ICON + = new ImageID("service.gui.icons.QUICK_MENU_SOUND_OFF_ICON"); + + /** + * The background rollover image of a QuickMenu button. + */ + public static final ImageID QUICK_MENU_MY_CHAT_ROOMS_ICON + = new ImageID("service.gui.icons.QUICK_MENU_MY_CHAT_ROOMS_ICON"); + + /** + * The call button image. + */ + public static final ImageID CALL_BUTTON_BG + = new ImageID("service.gui.buttons.CALL_BUTTON_BG"); + + /** + * The hangup button image. + */ + public static final ImageID HANGUP_BUTTON_BG + = new ImageID("service.gui.buttons.HANGUP_BUTTON_BG"); + + /** + * The hangup button mouse over image. + */ + public static final ImageID HANGUP_ROLLOVER_BUTTON_BG + = new ImageID("service.gui.buttons.HANGUP_ROLLOVER_BUTTON_BG"); + + /** + * The hangup button pressed image. + */ + public static final ImageID CALL_BUTTON_PRESSED_BG + = new ImageID("service.gui.buttons.CALL_BUTTON_PRESSED_BG"); + + /** + * The hangup button pressed image. + */ + public static final ImageID HANGUP_BUTTON_PRESSED_BG + = new ImageID("service.gui.buttons.HANGUP_BUTTON_PRESSED_BG"); + + /** + * The background image for the StatusSelectorBox. + */ + public static final ImageID STATUS_SELECTOR_BOX + = new ImageID("service.gui.buttons.STATUS_SELECTOR_BOX"); + + /** + * A dial button icon. + */ + public static final ImageID ONE_DIAL_BUTTON + = new ImageID("service.gui.buttons.ONE_DIAL_BUTTON"); + + /** + * A dial button icon. + */ + public static final ImageID TWO_DIAL_BUTTON + = new ImageID("service.gui.buttons.TWO_DIAL_BUTTON"); + + /** + * A dial button icon. + */ + public static final ImageID THREE_DIAL_BUTTON + = new ImageID("service.gui.buttons.THREE_DIAL_BUTTON"); + + /** + * A dial button icon. + */ + public static final ImageID FOUR_DIAL_BUTTON + = new ImageID("service.gui.buttons.FOUR_DIAL_BUTTON"); + + /** + * A dial button icon. + */ + public static final ImageID FIVE_DIAL_BUTTON + = new ImageID("service.gui.buttons.FIVE_DIAL_BUTTON"); + + /** + * A dial button icon. + */ + public static final ImageID SIX_DIAL_BUTTON + = new ImageID("service.gui.buttons.SIX_DIAL_BUTTON"); + + /** + * A dial button icon. + */ + public static final ImageID SEVEN_DIAL_BUTTON + = new ImageID("service.gui.buttons.SEVEN_DIAL_BUTTON"); + + /** + * A dial button icon. + */ + public static final ImageID EIGHT_DIAL_BUTTON + = new ImageID("service.gui.buttons.EIGHT_DIAL_BUTTON"); + + /** + * A dial button icon. + */ + public static final ImageID NINE_DIAL_BUTTON + = new ImageID("service.gui.buttons.NINE_DIAL_BUTTON"); + + /** + * A dial button icon. + */ + public static final ImageID STAR_DIAL_BUTTON + = new ImageID("service.gui.buttons.STAR_DIAL_BUTTON"); + + /** + * A dial button icon. + */ + public static final ImageID ZERO_DIAL_BUTTON + = new ImageID("service.gui.buttons.ZERO_DIAL_BUTTON"); + + /** + * A dial button icon. + */ + public static final ImageID DIEZ_DIAL_BUTTON + = new ImageID("service.gui.buttons.DIEZ_DIAL_BUTTON"); + + /** + * A dial button icon. The icon shown in the CallParticipant panel. + */ + public static final ImageID DIAL_BUTTON + = new ImageID("service.gui.buttons.DIAL_BUTTON"); + + /** + * A put-on/off-hold button icon. The icon shown in the CallParticipant + * panel. + */ + public static final ImageID HOLD_BUTTON + = new ImageID("service.gui.buttons.HOLD_BUTTON"); + + /** + * A mute button icon. The icon shown in the CallParticipant panel. + */ + public static final ImageID MUTE_BUTTON + = new ImageID("service.gui.buttons.MUTE_BUTTON"); + + /** + * A call-transfer button icon. The icon shown in the CallParticipant panel. + */ + public static final ImageID TRANSFER_CALL_BUTTON = + new ImageID("service.gui.buttons.TRANSFER_CALL_BUTTON"); + + /** + * The secure button on icon. The icon shown in the CallParticipant panel. + */ + public static final ImageID SECURE_BUTTON_ON = + new ImageID("service.gui.buttons.SECURE_BUTTON_ON"); + + /** + * The secure button off icon. The icon shown in the CallParticipant panel. + */ + public static final ImageID SECURE_BUTTON_OFF = + new ImageID("service.gui.buttons.SECURE_BUTTON_OFF"); + + /** + * The security button: encryted and SAS verified, encrypted only, security off. + */ + public static final ImageID ENCR_VERIFIED = new ImageID( + "service.gui.buttons.ENCR_VERIFIED"); + + public static final ImageID ENCR = new ImageID("service.gui.buttons.ENCR"); + + public static final ImageID ENCR_DISABLED = new ImageID( + "service.gui.buttons.ENCR_DISABLED"); + + /** + * The button icon of the Enter Full Screen command. The icon shown in the + * CallParticipant panel. + */ + public static final ImageID ENTER_FULL_SCREEN_BUTTON = + new ImageID("service.gui.buttons.ENTER_FULL_SCREEN_BUTTON"); + + /** + * The button icon of the Exit Full Screen command. The icon shown in the + * CallParticipant panel. + */ + public static final ImageID EXIT_FULL_SCREEN_BUTTON = + new ImageID("service.gui.buttons.EXIT_FULL_SCREEN_BUTTON"); + + /** + * The image used, when a contact has no photo specified. + */ + public static final ImageID DEFAULT_USER_PHOTO + = new ImageID("service.gui.DEFAULT_USER_PHOTO"); + + /** + * The image used to draw a frame around the contact photo image. + */ + public static final ImageID USER_PHOTO_FRAME + = new ImageID("service.gui.USER_PHOTO_FRAME"); + + /** + * The image used to draw a shadow over the contact photo image. + */ + public static final ImageID USER_PHOTO_SHADOW + = new ImageID("service.gui.USER_PHOTO_SHADOW"); + + /** + * The minimize button icon in the CallPanel. + */ + public static final ImageID CALL_PANEL_MINIMIZE_BUTTON + = new ImageID("service.gui.buttons.CALL_PANEL_MINIMIZE_BUTTON"); + + /** + * The restore button icon in the CallPanel. + */ + public static final ImageID CALL_PANEL_RESTORE_BUTTON + = new ImageID("service.gui.buttons.CALL_PANEL_RESTORE_BUTTON"); + + /** + * The minimize rollover button icon in the CallPanel. + */ + public static final ImageID CALL_PANEL_MINIMIZE_ROLLOVER_BUTTON + = new ImageID("service.gui.buttons.CALL_PANEL_MINIMIZE_ROLLOVER_BUTTON"); + + /** + * The restore rollover button icon in the CallPanel. + */ + public static final ImageID CALL_PANEL_RESTORE_ROLLOVER_BUTTON + = new ImageID("service.gui.buttons.CALL_PANEL_RESTORE_ROLLOVER_BUTTON"); + + /** + * The icon image of the "Add contact to chat" button in the + * chat window. + */ + public static final ImageID ADD_TO_CHAT_ICON + = new ImageID("service.gui.icons.ADD_TO_CHAT_ICON"); + + /** + * The image used for decoration of the "Add contact" window. + */ + public static final ImageID ADD_CONTACT_WIZARD_ICON + = new ImageID("service.gui.icons.ADD_CONTACT_WIZARD_ICON"); + + /** + * The image used for decoration of the "Add group" window. + */ + public static final ImageID ADD_GROUP_ICON + = new ImageID("service.gui.icons.ADD_GROUP_ICON"); + + /** + * The image used for decoration of the "Rename contact" window. + */ + public static final ImageID RENAME_DIALOG_ICON + = new ImageID("service.gui.icons.RENAME_DIALOG_ICON"); + + /** + * The image used for decoration of the "reason" dialog. The "reason" dialog + * is used wherever user should specify a reason for the operation he's + * trying to do. + */ + public static final ImageID REASON_DIALOG_ICON + = new ImageID("service.gui.icons.REASON_DIALOG_ICON"); + + /** + * The image used for decoration of the "Open in browser" item in + * the right button click menu in chat window. + */ + public static final ImageID BROWSER_ICON + = new ImageID("service.gui.icons.BROWSER_ICON"); + + /** + * The image used for decoration of all windows concerning the process of + * authorization. + */ + public static final ImageID AUTHORIZATION_ICON + = new ImageID("service.gui.icons.AUTHORIZATION_ICON"); + + /** + * The image used for decoration of incoming calls in the call list panel. + */ + public static final ImageID INCOMING_CALL_ICON + = new ImageID("service.gui.icons.INCOMING_CALL"); + + /** + * The image used for decoration of outgoing calls in the call list panel. + */ + public static final ImageID OUTGOING_CALL_ICON + = new ImageID("service.gui.icons.OUTGOING_CALL"); + + /** + * The image used in the right button menu for the move contact item. + */ + public static final ImageID MOVE_CONTACT_ICON + = new ImageID("service.gui.icons.MOVE_CONTACT"); + + /** + * The image used for error messages in the chat window. + */ + public static final ImageID EXCLAMATION_MARK + = new ImageID("service.gui.icons.EXCLAMATION_MARK"); + + /** + * The image used for about window background. + */ + public static final ImageID ABOUT_WINDOW_BACKGROUND + = new ImageID("service.gui.ABOUT_WINDOW_BACKGROUND"); + + /** + * The image used for opened groups. + */ + public static final ImageID OPENED_GROUP + = new ImageID("service.gui.icons.OPENED_GROUP"); + + /** + * The image used for closed groups. + */ + public static final ImageID CLOSED_GROUP + = new ImageID("service.gui.icons.CLOSED_GROUP"); + + /** + * The image used for chat rooms. + */ + public static final ImageID CHAT_ROOM_16x16_ICON + = new ImageID("service.gui.icons.CHAT_ROOM_16x16_ICON"); + + /** + * The image used for multi user chat servers. + */ + public static final ImageID CHAT_SERVER_16x16_ICON + = new ImageID("service.gui.icons.CHAT_SERVER_16x16_ICON"); + + /** + * The image used to indicate in the contact list that a message is received + * from a certain contact. + */ + public static final ImageID MESSAGE_RECEIVED_ICON + = new ImageID("service.gui.icons.MESSAGE_RECEIVED_ICON"); + + /** + * The image used to set to the chat room "join" right button menu. + */ + public static final ImageID JOIN_ICON + = new ImageID("service.gui.icons.JOIN_ICON"); + + /** + * The image used to set to the chat room "join as" right button menu. + */ + public static final ImageID JOIN_AS_ICON + = new ImageID("service.gui.icons.JOIN_AS_ICON"); + + /** + * The image used to set to the chat room "leave" right button menu. + */ + public static final ImageID LEAVE_ICON + = new ImageID("service.gui.icons.LEAVE_ICON"); + + /** + * Background image of the dial button. + */ + public static final ImageID DIAL_BUTTON_BG + = new ImageID("service.gui.buttons.DIAL_BUTTON_BG"); + + /** + * Background image when rollover on the dial button. + */ + public static final ImageID DIAL_BUTTON_ROLLOVER_BG + = new ImageID("service.gui.buttons.DIAL_BUTTON_ROLLOVER_BG"); + + /** + * Icon used in the chat window for the "Send as SMS" option. + */ + public static final ImageID SEND_SMS_ICON + = new ImageID("service.gui.icons.SEND_SMS_ICON"); + + /** + * Tool bar background image. + */ + public static final ImageID TOOL_BAR_BACKGROUND + = new ImageID("service.gui.TOOL_BAR_BACKGROUND"); + + /** + * Main menu background image. + */ + public static final ImageID MENU_BACKGROUND + = new ImageID("service.gui.MENU_BACKGROUND"); + + /** + * Title bar background image. + */ + public static final ImageID WINDOW_TITLE_BAR + = new ImageID("service.gui.WINDOW_TITLE_BAR"); + + /** + * Title bar background image. + */ + public static final ImageID WINDOW_TITLE_BAR_BG + = new ImageID("service.gui.WINDOW_TITLE_BAR_BG"); + + /** + * Title bar background image. + */ + public static final ImageID QUICK_MENU_ABOUT_ICON + = new ImageID("QUICK_MENU_ABOUT_ICON"); + + /** + * Title bar background image. + */ + public static final ImageID QUICK_MENU_CREATE_GROUP_ICON + = new ImageID("QUICK_MENU_CREATE_GROUP_ICON"); + + /** + * More actions button. + */ + public static final ImageID MORE_ACTIONS_BUTTON + = new ImageID("service.gui.buttons.MORE_ACTIONS_BUTTON"); + + /** + * More actions button rollover state. + */ + public static final ImageID MORE_ACTIONS_ROLLOVER_BUTTON + = new ImageID("service.gui.buttons.MORE_ACTIONS_ROLLOVER_BUTTON"); + + /** + * More actions button. + */ + public static final ImageID HIDE_ACTIONS_BUTTON + = new ImageID("service.gui.buttons.HIDE_ACTIONS_BUTTON"); + + /** + * More actions button rollover state. + */ + public static final ImageID HIDE_ACTIONS_ROLLOVER_BUTTON + = new ImageID("service.gui.buttons.HIDE_ACTIONS_ROLLOVER_BUTTON"); + + // ///////////////////// Edit Text Toolbar icons ////////////////////////// + + /** + * Add not in contact list contact icon. + */ + public static final ImageID ADD_CONTACT_CHAT_ICON + = new ImageID("service.gui.icons.ADD_CONTACT_CHAT_ICON"); + + /////////////////////// Edit Text Toolbar icons ///////////////////////// + + /** + * "Bold" button image in the EditTextToolBar in the + * ChatWindow. + */ + public static final ImageID TEXT_BOLD_BUTTON + = new ImageID("service.gui.buttons.TEXT_BOLD_BUTTON"); + + /** + * "Italic" button image in the EditTextToolBar in the + * ChatWindow. + */ + public static final ImageID TEXT_ITALIC_BUTTON + = new ImageID("service.gui.buttons.TEXT_ITALIC_BUTTON"); + + /** + * "Underline" button image in the EditTextToolBar in the + * ChatWindow. + */ + public static final ImageID TEXT_UNDERLINED_BUTTON + = new ImageID("service.gui.buttons.TEXT_UNDERLINED_BUTTON"); + + /** + * Edit toolbar button background icon. + */ + public static final ImageID EDIT_TOOLBAR_BUTTON + = new ImageID("service.gui.buttons.EDIT_TOOLBAR_BUTTON"); + + /** + * Edit toolbar button background icon for toggled state. + */ + public static final ImageID EDIT_TOOLBAR_BUTTON_PRESSED + = new ImageID("service.gui.buttons.EDIT_TOOLBAR_BUTTON_PRESSED"); + + /** + * The icon shown in the invite dialog. + */ + public static final ImageID INVITE_DIALOG_ICON + = new ImageID("service.gui.icons.INVITE_DIALOG_ICON"); + + // ///////////////////////// Main Toolbar icons //////////////////////////// + + /** + * The background image of a button in one of the ChatWindow + * toolbars. + */ + public static final ImageID CHAT_TOOLBAR_BUTTON_BG + = new ImageID("MSG_TOOLBAR_BUTTON_BG"); + + /** + * The background rollover image of a button in one of the + * ChatWindow toolbars. + */ + public static final ImageID CHAT_TOOLBAR_ROLLOVER_BUTTON_BG + = new ImageID("MSG_TOOLBAR_ROLLOVER_BUTTON_BG"); + + /** + * Copy icon. + */ + public static final ImageID COPY_ICON + = new ImageID("service.gui.icons.COPY_ICON"); + + /** + * Cut icon. + */ + public static final ImageID CUT_ICON + = new ImageID("service.gui.icons.CUT_ICON"); + + /** + * Paste icon. + */ + public static final ImageID PASTE_ICON + = new ImageID("service.gui.icons.PASTE_ICON"); + + /** + * Smiley icon, used for the "Smiley" button in the MainToolBar. + */ + public static final ImageID SMILIES_ICON + = new ImageID("service.gui.icons.SMILIES_ICON"); + + /** + * Save icon. + */ + public static final ImageID SAVE_ICON + = new ImageID("service.gui.icons.SAVE_ICON"); + + /** + * Print icon. + */ + public static final ImageID PRINT_ICON + = new ImageID("service.gui.icons.PRINT_ICON"); + + /** + * Close icon. + */ + public static final ImageID CLOSE_ICON + = new ImageID("service.gui.icons.CLOSE_ICON"); + + /** + * Left flash icon. + */ + public static final ImageID PREVIOUS_ICON + = new ImageID("service.gui.icons.PREVIOUS_ICON"); + + /** + * Right flash icon. + */ + public static final ImageID NEXT_ICON + = new ImageID("service.gui.icons.NEXT_ICON"); + + /** + * Clock icon. + */ + public static final ImageID HISTORY_ICON + = new ImageID("service.gui.icons.HISTORY_ICON"); + + /** + * Send file icon. + */ + public static final ImageID SEND_FILE_ICON + = new ImageID("service.gui.icons.SEND_FILE_ICON"); + + /** + * Font icon. + */ + public static final ImageID FONT_ICON + = new ImageID("service.gui.icons.FONT_ICON"); + + // ///////////////////// Chat contact icons //////////////////////////////// + + /** + * A special "info" icon used in the ChatContactPanel. + */ + public static final ImageID CHAT_CONTACT_INFO_BUTTON + = new ImageID("service.gui.buttons.CHAT_CONTACT_INFO_BUTTON"); + + /** + * A special "info" rollover icon used in the ChatContactPanel. + */ + public static final ImageID CHAT_CONTACT_INFO_ROLLOVER_BUTTON + = new ImageID("service.gui.buttons.CHAT_CONTACT_INFO_ROLLOVER_BUTTON"); + + /** + * A special "call" icon used in the ChatContactPanel. + */ + public static final ImageID CHAT_CONTACT_CALL_BUTTON + = new ImageID("service.gui.buttons.CHAT_CONTACT_CALL_BUTTON"); + + /** + * A special "call" rollover icon used in the ChatContactPanel. + */ + public static final ImageID CHAT_CONTACT_CALL_ROLLOVER_BUTTON + = new ImageID("service.gui.buttons.CHAT_CONTACT_CALL_ROLLOVER_BUTTON"); + + /** + * A special "send file" icon used in the ChatContactPanel. + */ + public static final ImageID CHAT_CONTACT_SEND_FILE_BUTTON + = new ImageID("service.gui.buttons.CHAT_CONTACT_SEND_FILE_BUTTON"); + + /** + * A special "send file" rollover icon used in the + * ChatContactPanel. + */ + public static final ImageID CHAT_SEND_FILE_ROLLOVER_BUTTON + = new ImageID("service.gui.buttons.CHAT_SEND_FILE_ROLLOVER_BUTTON"); + + public static final ImageID CHAT_CONFIGURE_ICON + = new ImageID("service.gui.icons.CHAT_CONFIGURE_ICON"); + + ////////////////////////////// 16x16 icons //////////////////////////////// + /** + * Send message 16x16 image. + */ + public static final ImageID SEND_MESSAGE_16x16_ICON + = new ImageID("service.gui.icons.SEND_MESSAGE_16x16_ICON"); + + /** + * Call 16x16 image. + * //TODO : change to an appropriate logo + */ + public static final ImageID CALL_16x16_ICON + = new ImageID("service.gui.icons.CALL_16x16_ICON"); + + /** + * Delete 16x16 image. + */ + public static final ImageID DELETE_16x16_ICON + = new ImageID("service.gui.icons.DELETE_16x16_ICON"); + + /** + * History 16x16 image. + */ + public static final ImageID HISTORY_16x16_ICON + = new ImageID("service.gui.icons.HISTORY_16x16_ICON"); + + /** + * Send file 16x16 image. + */ + public static final ImageID SEND_FILE_16x16_ICON + = new ImageID("service.gui.icons.SEND_FILE_16x16_ICON"); + + /** + * Groups 16x16 image. + */ + public static final ImageID GROUPS_16x16_ICON + = new ImageID("service.gui.icons.GROUPS_16x16_ICON"); + + /** + * Add contact 16x16 image. + */ + public static final ImageID ADD_CONTACT_16x16_ICON + = new ImageID("service.gui.icons.ADD_CONTACT_16x16_ICON"); + + /** + * Rename 16x16 image. + */ + public static final ImageID RENAME_16x16_ICON + = new ImageID("service.gui.icons.RENAME_16x16_ICON"); + + /////////////////////////////////////////////////////////////////////////// + + /** + * Toolbar drag area icon. + */ + public static final ImageID TOOLBAR_DRAG_ICON = new ImageID( + "service.gui.icons.TOOLBAR_DRAG_ICON"); + + /** + * The background image of the AuthenticationWindow. + */ + public static final ImageID AUTH_WINDOW_BACKGROUND = new ImageID( + "service.gui.AUTH_WINDOW_BACKGROUND"); + + /** + * The icon used to indicate a search. + */ + public static final ImageID SEARCH_ICON + = new ImageID("service.gui.icons.SEARCH_ICON"); + + /** + * The icon used to indicate a search. + */ + public static final ImageID SEARCH_ICON_16x16 + = new ImageID("service.gui.icons.SEARCH_ICON_16x16"); + + /* + * ======================================================================= + * ------------------------ USERS' ICONS --------------------------------- + * ======================================================================= + */ + + /** + * Contact "online" icon. + */ + public static final ImageID USER_ONLINE_ICON + = new ImageID("service.gui.statusicons.USER_ONLINE_ICON"); + + /** + * Contact "offline" icon. + */ + public static final ImageID USER_OFFLINE_ICON + = new ImageID("service.gui.statusicons.USER_OFFLINE_ICON"); + + /** + * Contact "away" icon. + */ + public static final ImageID USER_AWAY_ICON + = new ImageID("service.gui.statusicons.USER_AWAY_ICON"); + + /** + * Contact "not available" icon. + */ + public static final ImageID USER_NA_ICON + = new ImageID("service.gui.statusicons.USER_NA_ICON"); + + /** + * Contact "free for chat" icon. + */ + public static final ImageID USER_FFC_ICON + = new ImageID("service.gui.statusicons.USER_FFC_ICON"); + + /** + * Contact "do not disturb" icon. + */ + public static final ImageID USER_DND_ICON + = new ImageID("service.gui.statusicons.USER_DND_ICON"); + + /** + * Contact "occupied" icon. + */ + public static final ImageID USER_OCCUPIED_ICON + = new ImageID("service.gui.statusicons.USER_OCCUPIED_ICON"); + + /* + * ===================================================================== + * ---------------------------- SMILIES -------------------------------- + * ===================================================================== + */ + + public static final ImageID SMILEY1 + = new ImageID("service.gui.smilies.SMILEY1"); + + public static final ImageID SMILEY2 + = new ImageID("service.gui.smilies.SMILEY2"); + + public static final ImageID SMILEY3 + = new ImageID("service.gui.smilies.SMILEY3"); + + public static final ImageID SMILEY4 + = new ImageID("service.gui.smilies.SMILEY4"); + + public static final ImageID SMILEY5 + = new ImageID("service.gui.smilies.SMILEY5"); + + public static final ImageID SMILEY6 + = new ImageID("service.gui.smilies.SMILEY6"); + + public static final ImageID SMILEY7 + = new ImageID("service.gui.smilies.SMILEY7"); + + public static final ImageID SMILEY8 + = new ImageID("service.gui.smilies.SMILEY8"); + + public static final ImageID SMILEY9 + = new ImageID("service.gui.smilies.SMILEY9"); + + public static final ImageID SMILEY10 + = new ImageID("service.gui.smilies.SMILEY10"); + + public static final ImageID SMILEY11 + = new ImageID("service.gui.smilies.SMILEY11"); + + public static final ImageID SMILEY12 + = new ImageID("service.gui.smilies.SMILEY12"); + + /** + * Load default smilies pack. + * + * @return the ArrayList of all smilies. + */ + public static Collection getDefaultSmiliesPack() { + List defaultPackList = new ArrayList(); + + defaultPackList.add(new Smiley(ImageLoader.SMILEY1, new String[] { + ";-(", ";(", ":'(", ":'-(", ":~-(", ":~(" })); + + defaultPackList.add(new Smiley(ImageLoader.SMILEY2, new String[] { + "B-)", "B)" })); + + defaultPackList.add(new Smiley(ImageLoader.SMILEY3, new String[] { + ":-*", ":*" })); + + defaultPackList.add(new Smiley(ImageLoader.SMILEY4, new String[] { + ":-0" })); + + defaultPackList.add(new Smiley(ImageLoader.SMILEY5, new String[] { + ":-((", ":((" })); + + defaultPackList.add(new Smiley(ImageLoader.SMILEY6, new String[] { + "(L)" , "(l)"})); + + defaultPackList.add(new Smiley(ImageLoader.SMILEY7, new String[] { + ":-|", ":|" })); + + defaultPackList.add(new Smiley(ImageLoader.SMILEY8, new String[] { + ":-P", ":P", ":-p", ":p" })); + + defaultPackList.add(new Smiley(ImageLoader.SMILEY9, new String[] { + ":-))", ":))" })); + + defaultPackList.add(new Smiley(ImageLoader.SMILEY10, new String[] { + ":-(", ":(" })); + + defaultPackList.add(new Smiley(ImageLoader.SMILEY11, new String[] { + ":-)", ":)" })); + + defaultPackList.add(new Smiley(ImageLoader.SMILEY12, new String[] { + ";-)", ";)" })); + + return defaultPackList; + } + + /** + * Returns a Smiley object for a given smiley string. + * @param smileyString One of :-), ;-), etc. + * @return A Smiley object for a given smiley string. + */ + public static Smiley getSmiley(String smileyString) { + Collection smilies = getDefaultSmiliesPack(); + + for (Smiley smiley : smilies) { + String[] smileyStrings = smiley.getSmileyStrings(); + + for (int j = 0; j < smileyStrings.length; j++) { + String srcString = smileyStrings[j]; + + if (srcString.equals(smileyString)) + return smiley; + } + } + return null; + } + + /** + * Loads an image from a given image identifier. + * + * @param imageID The identifier of the image. + * @return The image for the given identifier. + */ + public static BufferedImage getImage(ImageID imageID) + { + BufferedImage image = null; + + if (loadedImages.containsKey(imageID)) + { + image = (BufferedImage) loadedImages.get(imageID); + } + else + { + URL path = + SwingCommonActivator.getResources() + .getImageURL(imageID.getId()); + + if (path == null) + { + return null; + } + + try + { + image = ImageIO.read(path); + + loadedImages.put(imageID, image); + } + catch (Exception exc) + { + log.error("Failed to load image:" + path, exc); + } + } + + return image; + } + + /** + * Loads an image from a given path. + * + * @param path The path url of the image. + * @return The image for the given identifier. + */ + public static BufferedImage getImageFromUrl(String path) + { + BufferedImage image = null; + + try + { + URL imgUrl = new URL(path); + + image = ImageIO.read(imgUrl.openStream()); + } + catch (Exception exc) + { + log.error("Failed to load image:" + path, exc); + } + + return image; + } + + /** + * Loads an image from a given image identifier. + * @param imageID The identifier of the image. + * @return The image for the given identifier. + */ + public static byte[] getImageInBytes(ImageID imageID) + { + InputStream in = + SwingCommonActivator.getResources().getImageInputStream( + imageID.getId()); + + if (in == null) + return null; + byte[] image = null; + try + { + image = new byte[in.available()]; + + in.read(image); + } catch (IOException e) + { + log.error("Failed to load image:" + imageID.getId(), e); + } + + return image; + } + + /** + * Loads an image from a given bytes array. + * @param imageBytes The bytes array to load the image from. + * @return The image for the given bytes array. + */ + public static Image getBytesInImage(byte[] imageBytes) + { + Image image = null; + try + { + image = ImageIO.read( + new ByteArrayInputStream(imageBytes)); + + } + catch (Exception e) + { + log.error("Failed to convert bytes to image.", e); + } + return image; + } + + /** + * Loads an animated gif image. + * @param animatedImage the animated image buffer + * @return a BufferedImage array containing the animated image. + */ + public static BufferedImage[] getAnimatedImage(byte[] animatedImage) + { + Iterator readers = ImageIO.getImageReadersBySuffix("gif"); + + ImageReader reader = (ImageReader) readers.next(); + + ImageInputStream iis; + + BufferedImage[] images = null; + + try { + iis = ImageIO.createImageInputStream( + new ByteArrayInputStream(animatedImage)); + + reader.setInput(iis); + + int numImages = reader.getNumImages(true); + + if(numImages == 0) + return null; + + images = new BufferedImage[numImages]; + + for (int i = 0; i < numImages; ++i) { + images[i] = reader.read(i); + } + + } catch (IOException e) { + log.error("Failed to load image.", e); + } finally { + log.logExit(); + } + return images; + } + + /** + * Returns the path string of an already loaded image, otherwise null. + * + * @param image + * The image wich path to return. + * @return The path string of an already loaded image, otherwise null. + */ + public static String getImagePath(Image image) + { + Iterator i = ImageLoader.loadedImages.entrySet().iterator(); + + while (i.hasNext()) { + Map.Entry entry = (Map.Entry) i.next(); + + if (entry.getValue().equals(image)) + { + String imageID = ((ImageID) entry.getKey()).getId(); + + try + { + return SwingCommonActivator.getResources().getImageURL( + imageID).toURI().toString(); + } + catch(URISyntaxException ex) + { + log.error("Failed to create path for image " + imageID); + } + } + } + + return null; + } +} diff --git a/src/net/java/sip/communicator/swing/SIPCommFrame.java b/src/net/java/sip/communicator/swing/SIPCommFrame.java new file mode 100644 index 0000000..7967ef0 --- /dev/null +++ b/src/net/java/sip/communicator/swing/SIPCommFrame.java @@ -0,0 +1,504 @@ +/* + * 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.swing; + +import java.awt.*; +import java.awt.event.*; +import java.awt.geom.*; +import java.util.*; + +import javax.swing.*; + +import net.java.sip.communicator.service.configuration.*; +import net.java.sip.communicator.service.keybindings.*; +import net.java.sip.communicator.service.resources.*; +import net.java.sip.communicator.util.*; + +/** + * A custom frame that remembers its size and location and could have a semi + * transparent background. + * + * @author Yana Stamcheva + */ +public abstract class SIPCommFrame + extends JFrame + implements Observer +{ + private final Logger logger = Logger.getLogger(SIPCommFrame.class); + + private final ActionMap amap; + + private final InputMap imap; + + private KeybindingSet bindings = null; + + public SIPCommFrame() + { + this.setContentPane(new MainContentPane()); + + Image scLogo = ImageLoader.getImage(ImageLoader.SIP_COMMUNICATOR_LOGO); + this.setIconImage(scLogo); + + // In order to have the same icon when using option panes + JOptionPane.getRootFrame().setIconImage(scLogo); + + this.addWindowListener(new FrameWindowAdapter()); + + JRootPane rootPane = getRootPane(); + amap = rootPane.getActionMap(); + amap.put("close", new CloseAction()); + + imap = + rootPane.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT); + } + + /** + * The action invoked when user presses Escape key. + */ + private class CloseAction + extends AbstractAction + { + public void actionPerformed(ActionEvent e) + { + saveSizeAndLocation(); + close(true); + } + } + + /** + * Sets the input map to utilize a given category of keybindings. The frame + * is updated to reflect the new bindings when they change. This replaces + * any previous bindings that have been added. + * + * @param category set of keybindings to be utilized + */ + protected void setKeybindingInput(KeybindingSet.Category category) + { + // Removes old binding set + if (this.bindings != null) + { + this.bindings.deleteObserver(this); + resetInputMap(); + } + + // Adds new bindings to input map + this.bindings = + SwingCommonActivator.getKeybindingsService().getBindings(category); + + for (Map.Entry key2action : this.bindings + .getBindings().entrySet()) + { + imap.put(key2action.getKey(), key2action.getValue()); + } + + this.bindings.addObserver(this); + } + + /** + * Bindings the string representation for a keybinding to the action that + * will be executed. + * + * @param binding string representation of action used by input map + * @param action the action which will be executed when user presses the + * given key combination + */ + protected void addKeybindingAction(String binding, Action action) + { + amap.put(binding, action); + } + + /** + * Before closing the application window saves the current size and position + * through the ConfigurationService. + */ + public class FrameWindowAdapter + extends WindowAdapter + { + public void windowClosing(WindowEvent e) + { + saveSizeAndLocation(); + + close(false); + } + } + + /** + * Saves the size and the location of this frame through the + * ConfigurationService. + */ + private void saveSizeAndLocation() + { + ConfigurationService configService = + SwingCommonActivator.getConfigurationService(); + + String className = this.getClass().getName(); + + try + { + configService.setProperty(className + ".width", new Integer( + getWidth())); + + configService.setProperty(className + ".height", new Integer( + getHeight())); + + configService.setProperty(className + ".x", new Integer(getX())); + + configService.setProperty(className + ".y", new Integer(getY())); + } + catch (PropertyVetoException e1) + { + logger.error("The proposed property change " + + "represents an unacceptable value"); + } + } + + /** + * Sets window size and position. + */ + public void setSizeAndLocation() + { + ConfigurationService configService = + SwingCommonActivator.getConfigurationService(); + + String className = this.getClass().getName(); + + String widthString = configService.getString(className + ".width"); + + String heightString = configService.getString(className + ".height"); + + String xString = configService.getString(className + ".x"); + + String yString = configService.getString(className + ".y"); + + int width = 0; + int height = 0; + + if (widthString != null && heightString != null) + { + width = new Integer(widthString).intValue(); + height = new Integer(heightString).intValue(); + + if (width > 0 && height > 0) + { + Dimension screenSize = + Toolkit.getDefaultToolkit().getScreenSize(); + if (width <= screenSize.width && height <= screenSize.height) + this.setSize(width, height); + } + } + + int x = 0; + int y = 0; + + if (xString != null && yString != null) + { + x = new Integer(xString).intValue(); + y = new Integer(yString).intValue(); + + this.setLocation(x, y); + } + else + { + this.setCenterLocation(); + } + } + + /** + * Positions this window in the center of the screen. + */ + private void setCenterLocation() + { + Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); + this.setLocation(screenSize.width / 2 - this.getWidth() / 2, + screenSize.height / 2 - this.getHeight() / 2); + } + + /** + * Checks whether the current component will exceeds the screen size and if + * it do will set a default size + */ + private void ensureOnScreenLocationAndSize() + { + int x = this.getX(); + int y = this.getY(); + + int width = this.getWidth(); + int height = this.getHeight(); + + Rectangle virtualBounds = ScreenInformation.getScreenBounds(); + + // the default distance to the screen border + final int borderDistance = 10; + + // in case any of the sizes exceeds the screen size + // we set default one + // get the left upper point of the window + if (!(virtualBounds.contains(x, y))) + { + // top left exceeds screen bounds + if (x < virtualBounds.x) + { + // window is too far to the left + // move it to the right + x = virtualBounds.x + borderDistance; + } + else if (x > virtualBounds.x) + { + // window is too far to the right + // can only occour, when screen resolution is + // changed or displayed are disconnected + + // move the window in the bounds to the very right + x = + virtualBounds.x + virtualBounds.width - width + - borderDistance; + if (x < virtualBounds.x + borderDistance) + { + x = virtualBounds.x + borderDistance; + } + } + + // top left exceeds screen bounds + if (y < virtualBounds.y) + { + // window is too far to the top + // move it to the bottom + y = virtualBounds.y + borderDistance; + } + else if (y > virtualBounds.y) + { + // window is too far to the bottom + // can only occour, when screen resolution is + // changed or displayed are disconnected + + // move the window in the bounds to the very bottom + y = + virtualBounds.y + virtualBounds.height - height + - borderDistance; + if (y < virtualBounds.y + borderDistance) + { + y = virtualBounds.y + borderDistance; + } + } + this.setLocation(x, y); + } + + // check the lower right corder + if (!(virtualBounds.contains(x + width, y + height))) + { + + if (x + width > virtualBounds.x + virtualBounds.width) + { + // location of window is too far to the right, its right + // border is out of bounds + + // calculate a new horizontal position + // move the whole window to the left + x = + virtualBounds.x + virtualBounds.width - width + - borderDistance; + if (x < virtualBounds.x + borderDistance) + { + // window is already on left side, it is too wide. + x = virtualBounds.x + borderDistance; + // reduce the width, so it surely fits + width = virtualBounds.width - 2 * borderDistance; + } + } + if (y + height > virtualBounds.y + virtualBounds.height) + { + // location of window is too far to the bottom, its bottom + // border is out of bounds + + // calculate a new vertical position + // move the whole window to the top + y = + virtualBounds.y + virtualBounds.height - height + - borderDistance; + if (y < virtualBounds.y + borderDistance) + { + // window is already on top, it is too high. + y = virtualBounds.y + borderDistance; + // reduce the width, so it surely fits + height = virtualBounds.height - 2 * borderDistance; + } + } + this.setPreferredSize(new Dimension(width, height)); + this.setSize(width, height); + this.setLocation(x, y); + } + } + + /** + * Overwrites the setVisible method in order to set the size and the + * position of this window before showing it. + */ + public void setVisible(boolean isVisible) + { + if (isVisible) + { + this.setSizeAndLocation(); + + this.ensureOnScreenLocationAndSize(); + } + + super.setVisible(isVisible); + } + + /** + * Overwrites the dispose method in order to save the size and the position + * of this window before closing it. + */ + public void dispose() + { + this.saveSizeAndLocation(); + + /* + * The keybinding service will outlive us so don't let us retain our + * memory. + */ + if (bindings != null) + bindings.deleteObserver(this); + + super.dispose(); + } + + private void resetInputMap() + { + imap.clear(); + imap.put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), "close"); + } + + /** + * Listens for changes in binding sets so they can be reflected in the input + * map + */ + public void update(Observable obs, Object arg) + { + if (obs instanceof KeybindingSet) + { + KeybindingSet changedBindings = (KeybindingSet) obs; + + resetInputMap(); + for (Map.Entry key2action : changedBindings + .getBindings().entrySet()) + { + imap.put(key2action.getKey(), key2action.getValue()); + } + } + } + + private static class MainContentPane + extends JPanel + { + private final boolean isColorBgEnabled; + + private final Color bgStartColor; + + private final Color bgEndColor; + + public MainContentPane() + { + super(new BorderLayout()); + + ResourceManagementService resources = + SwingCommonActivator.getResources(); + + isColorBgEnabled = + new Boolean(resources.getSettingsString( + "impl.gui.IS_WINDOW_COLOR_BACKGROUND_ENABLED")) + .booleanValue(); + if (isColorBgEnabled) + { + bgStartColor = + new Color(resources.getColor("service.gui.MAIN_BACKGROUND")); + bgEndColor = + new Color(resources + .getColor("service.gui.MAIN_BACKGROUND_GRADIENT")); + + int borderSize = + resources + .getSettingsInt("impl.gui.MAIN_WINDOW_BORDER_SIZE"); + this.setBorder(BorderFactory.createEmptyBorder(borderSize, + borderSize, borderSize, borderSize)); + } + else + { + bgStartColor = null; + bgEndColor = null; + } + } + + public void paintComponent(Graphics g) + { + super.paintComponent(g); + + // If the custom color window background is not enabled we have + // nothing to do here. + if (!isColorBgEnabled) + return; + + g = g.create(); + try + { + internalPaintComponent(g); + } + finally + { + g.dispose(); + } + } + + private void internalPaintComponent(Graphics g) + { + AntialiasingManager.activateAntialiasing(g); + + Graphics2D g2 = (Graphics2D) g; + int width = getWidth(); + int height = getHeight(); + + GradientPaint bgGradientColor = + new GradientPaint(width / 2, 0, bgStartColor, width / 2, 80, + bgEndColor); + + g2.setPaint(bgGradientColor); + g2.fillRect(0, 0, width, 80); + + g2.setColor(bgEndColor); + g2.fillRect(0, 78, width, height); + + GradientPaint curveShadow = + new GradientPaint(0, 0, new Color(255, 255, 255, 150), width, + height, new Color(255, 255, 255, 50)); + + g2.setPaint(curveShadow); + g2.setStroke(new BasicStroke(1f)); + CubicCurve2D curve1 = + new CubicCurve2D.Float(50, -1, 250, 30, 50, 150, 0, 300); + + g2.draw(curve1); + + CubicCurve2D curve2 = + new CubicCurve2D.Float(width - 20, 0, width, 100, width / 2, + 100, 0, 150); + + g2.draw(curve2); + + CubicCurve2D curve3 = + new CubicCurve2D.Float(0, 90, width / 3, 60, 2 * width / 3, 60, + width, 90); + + g2.draw(curve3); + } + } + + /** + * All functions implemented in this method will be invoked when user + * presses the Escape key. + */ + protected abstract void close(boolean isEscaped); +} diff --git a/src/net/java/sip/communicator/swing/ScreenInformation.java b/src/net/java/sip/communicator/swing/ScreenInformation.java new file mode 100644 index 0000000..f8cd6ee --- /dev/null +++ b/src/net/java/sip/communicator/swing/ScreenInformation.java @@ -0,0 +1,90 @@ +/* + * 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.swing; + +import java.awt.*; + +/** + * A class which reads the screen bounds once and provides this information + * + * @author Thomas Hofer + * + */ +public class ScreenInformation +{ + private static Rectangle screenBounds = null; + + public static synchronized void init() + { + if (screenBounds == null) + { + final GraphicsEnvironment ge = GraphicsEnvironment + .getLocalGraphicsEnvironment(); + final GraphicsDevice[] gs = ge.getScreenDevices(); + + screenBounds = new Rectangle(); + + if (gs.length > 1) + { + + // create a thread for each display, as the query is very slow + Thread thread[] = new Thread[gs.length]; + for (int j = 0; j < gs.length; j++) + { + final int j1 = j; + thread[j] = new Thread(new Runnable() + { + public void run() + { + Rectangle screenDeviceBounds = new Rectangle(); + GraphicsDevice gd = gs[j1]; + GraphicsConfiguration[] gc = gd.getConfigurations(); + for (int i = 0; i < gc.length; i++) + { + screenDeviceBounds = screenDeviceBounds + .union(gc[i].getBounds()); + } + screenBounds.setBounds(screenBounds + .union(screenDeviceBounds)); + + } + }); + thread[j].start(); + } + for (int j = 0; j < gs.length; j++) + { + // wait for all threads here + try + { + thread[j].join(); + } catch (InterruptedException e) + { + } + } + } else + { + // only one display, get the screen size directy. this method + // is much faster, but can only handle the primary display + Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); + screenBounds.setBounds(0, 0, dim.width, dim.height); + } + + } + } + + public static synchronized Rectangle getScreenBounds() + { + // the initialization needs a moment + // prevent a concurrent initalization + if (screenBounds == null) + { + init(); + } + + return screenBounds; + } +} diff --git a/src/net/java/sip/communicator/swing/Smiley.java b/src/net/java/sip/communicator/swing/Smiley.java new file mode 100644 index 0000000..c84ccfe --- /dev/null +++ b/src/net/java/sip/communicator/swing/Smiley.java @@ -0,0 +1,90 @@ +/* + * 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.swing; + +import java.net.*; + +import net.java.sip.communicator.service.resources.*; + +/** + * The Smiley is used to store a smiley. + * + * @author Yana Stamcheva + */ +public class Smiley { + + private ImageID imageID; + + private String[] smileyStrings; + + /** + * Creates an instance of Smily, by specifying the smily + * image identifier and the strings corresponding to it. + * @param imageID The image identifier of the smily icon. + * @param smileyStrings A set of strings corresponding to the smily + * icon. + */ + public Smiley(ImageID imageID, String[] smileyStrings) { + + this.imageID = imageID; + + this.setSmileyStrings(smileyStrings); + } + + /** + * Returns the set of Strings corresponding to this smily. + * @return the set of Strings corresponding to this smily. + */ + public String[] getSmileyStrings() { + + return smileyStrings; + } + + /** + * Sets the set of Strings corresponding to this smily. They could be + * ":-)", ":)", ":))" for example. + * @param smileyStrings the set of Strings corresponding to this smily. + */ + public void setSmileyStrings(String[] smileyStrings) { + + this.smileyStrings = smileyStrings; + } + + /** + * Returns the default String corresponding for this smily. For example + * ":-)". + * @return the default String corresponding for this smily. + */ + public String getDefaultString() { + + return this.smileyStrings[0]; + } + + /** + * Returns the identifier of the image corresponding to this smily. + * @return the identifier of the image corresponding to this smily. + */ + public ImageID getImageID() { + + return this.imageID; + } + + /** + * Returns the path of the image corresponding to this smily. + * @return the path of the image corresponding to this smily. + */ + public String getImagePath() + { + URL url = SwingCommonActivator.getResources(). + getImageURL(this.getImageID().getId()); + + if(url == null) + return null; + + return url.toString(); + } +} diff --git a/src/net/java/sip/communicator/swing/SwingCommonActivator.java b/src/net/java/sip/communicator/swing/SwingCommonActivator.java new file mode 100644 index 0000000..2ff0296 --- /dev/null +++ b/src/net/java/sip/communicator/swing/SwingCommonActivator.java @@ -0,0 +1,76 @@ +/* + * 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.swing; + +import net.java.sip.communicator.service.configuration.*; +import net.java.sip.communicator.service.keybindings.*; +import net.java.sip.communicator.service.resources.*; + +import org.osgi.framework.*; + +public class SwingCommonActivator + implements BundleActivator +{ + private static BundleContext bundleContext; + + private static ConfigurationService configurationService; + + private static KeybindingsService keybindingsService; + + private static ResourceManagementService resources; + + public static ConfigurationService getConfigurationService() + { + if (configurationService == null) + { + ServiceReference serviceReference = + bundleContext.getServiceReference(ConfigurationService.class + .getName()); + + if (serviceReference != null) + configurationService = + (ConfigurationService) bundleContext + .getService(serviceReference); + } + return configurationService; + } + + public static KeybindingsService getKeybindingsService() + { + if (keybindingsService == null) + { + ServiceReference serviceReference = + bundleContext.getServiceReference(KeybindingsService.class + .getName()); + + if (serviceReference != null) + keybindingsService = + (KeybindingsService) bundleContext + .getService(serviceReference); + } + return keybindingsService; + } + + public static ResourceManagementService getResources() + { + if (resources == null) + resources = + ResourceManagementServiceUtils.getService(bundleContext); + return resources; + } + + public void start(BundleContext bundleContext) + { + SwingCommonActivator.bundleContext = bundleContext; + } + + public void stop(BundleContext bundleContext) + { + if (SwingCommonActivator.bundleContext == bundleContext) + SwingCommonActivator.bundleContext = null; + } +} diff --git a/src/net/java/sip/communicator/swing/swing.common.manifest.mf b/src/net/java/sip/communicator/swing/swing.common.manifest.mf index f98555e..2f500d6 100644 --- a/src/net/java/sip/communicator/swing/swing.common.manifest.mf +++ b/src/net/java/sip/communicator/swing/swing.common.manifest.mf @@ -1,6 +1,13 @@ +Bundle-Activator: net.java.sip.communicator.swing.SwingCommonActivator Bundle-Name: Swing Common Bundle-Description: Common/generic Swing additions not specific to SIP Communicator Bundle-Vendor: sip-communicator.org Bundle-Version: 0.0.1 -Import-Package: javax.swing +Import-Package: javax.imageio, + javax.swing, + net.java.sip.communicator.service.configuration, + net.java.sip.communicator.service.keybindings, + net.java.sip.communicator.service.resources, + net.java.sip.communicator.util, + org.osgi.framework Export-Package: net.java.sip.communicator.swing -- cgit v1.1