diff options
author | Lyubomir Marinov <lyubomir.marinov@jitsi.org> | 2008-12-20 00:08:53 +0000 |
---|---|---|
committer | Lyubomir Marinov <lyubomir.marinov@jitsi.org> | 2008-12-20 00:08:53 +0000 |
commit | 2e83c45aa27145fe587fceae1dfa3f1ac2f77046 (patch) | |
tree | 4becc08475cce8174f76f87e6d9c73f474fe98a9 /src/net | |
parent | 3c911f558fd4f557323cbd9fdb2f10fb3d037a5c (diff) | |
download | jitsi-2e83c45aa27145fe587fceae1dfa3f1ac2f77046.zip jitsi-2e83c45aa27145fe587fceae1dfa3f1ac2f77046.tar.gz jitsi-2e83c45aa27145fe587fceae1dfa3f1ac2f77046.tar.bz2 |
- Delays the creation of the Options dialog and the loading of the ConfigurationForm implementations (which get listed in the Options dialog).
- Spares a couple of ImageIcon allocations.
- Removes unused fields and fixes raw-type warnings in the files touched by the other changes.
Diffstat (limited to 'src/net')
44 files changed, 451 insertions, 923 deletions
diff --git a/src/net/java/sip/communicator/impl/gui/UIServiceImpl.java b/src/net/java/sip/communicator/impl/gui/UIServiceImpl.java index fa88287..cd4d0d0 100644 --- a/src/net/java/sip/communicator/impl/gui/UIServiceImpl.java +++ b/src/net/java/sip/communicator/impl/gui/UIServiceImpl.java @@ -130,8 +130,6 @@ public class UIServiceImpl this.wizardContainer = new AccountRegWizardContainerImpl(mainFrame); - this.configurationFrame = new ConfigurationFrame(mainFrame); - if (ConfigurationManager.isTransparentWindowEnabled()) { try @@ -385,7 +383,6 @@ public class UIServiceImpl */ public void initExportedWindows() { - registerExportedWindow(configurationFrame); registerExportedWindow(new AddContactWizardExportedWindow(mainFrame)); } @@ -984,4 +981,11 @@ public class UIServiceImpl } } } + + public void setConfigurationWindowVisible(boolean visible) + { + if (configurationFrame == null) + configurationFrame = new ConfigurationFrame(mainFrame); + configurationFrame.setVisible(visible); + } } 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..ddce652 100644 --- a/src/net/java/sip/communicator/impl/gui/customcontrols/FramedImage.java +++ b/src/net/java/sip/communicator/impl/gui/customcontrols/FramedImage.java @@ -22,15 +22,15 @@ import net.java.sip.communicator.util.*; public class FramedImage extends JComponent { - private ImageIcon shadowIcon; + private final Image shadowImage; - private ImageIcon frameIcon; + private final Image frameImage; - private ImageIcon imageIcon; + private Image image; - private int width; + private final int width; - private int height; + private final int height; /** * Creates a ContactPhotoLabel by specifying the width and the height of the @@ -42,27 +42,17 @@ public class FramedImage */ public FramedImage(ImageIcon imageIcon, int width, int height) { - super(); - this.width = width; - this.height = height; this.setPreferredSize(new Dimension(width, height)); - Image photoFrameImage - = ImageLoader.getImage(ImageLoader.USER_PHOTO_FRAME); - - this.frameIcon - = ImageUtils.scaleIconWithinBounds( photoFrameImage, - width, - height); - - this.shadowIcon - = ImageUtils.scaleIconWithinBounds( - ImageLoader.getImage(ImageLoader.USER_PHOTO_SHADOW), - width, - height); + this.frameImage = + ImageUtils.scaleImageWithinBounds(ImageLoader + .getImage(ImageLoader.USER_PHOTO_FRAME), width, height); + this.shadowImage = + ImageUtils.scaleImageWithinBounds(ImageLoader + .getImage(ImageLoader.USER_PHOTO_SHADOW), width, height); if (imageIcon != null) { @@ -75,34 +65,25 @@ public class FramedImage this(null, width, height); } - public ImageIcon getImageIcon() - { - return imageIcon; - } - public void setImageIcon(ImageIcon imageIcon) { - this.imageIcon - = ImageUtils.getScaledRoundedImage( imageIcon.getImage(), - width - 2, - height - 2); + this.image = + ImageUtils.getScaledRoundedImage(imageIcon.getImage(), width - 2, + height - 2); } - /** + /* * Overrides {@link JComponent#paintComponent(Graphics)}. */ public void paintComponent(Graphics g) { - g.drawImage(imageIcon.getImage(), - width/2 - imageIcon.getIconWidth()/2, - height/2 - imageIcon.getIconHeight()/2, null); + g.drawImage(image, width / 2 - image.getWidth(null) / 2, height / 2 + - image.getHeight(null) / 2, null); - g.drawImage(frameIcon.getImage(), - width/2 - frameIcon.getIconWidth()/2, - height/2 - frameIcon.getIconHeight()/2, null); + g.drawImage(frameImage, width / 2 - frameImage.getWidth(null) / 2, + height / 2 - frameImage.getHeight(null) / 2, null); - g.drawImage(shadowIcon.getImage(), - width/2 - shadowIcon.getIconWidth()/2, - 1, null); + g.drawImage(shadowImage, width / 2 - shadowImage.getWidth(null) / 2, 1, + null); } } diff --git a/src/net/java/sip/communicator/impl/gui/main/account/AccountsConfigurationForm.java b/src/net/java/sip/communicator/impl/gui/main/account/AccountsConfigurationForm.java deleted file mode 100644 index 4cfaaa1..0000000 --- a/src/net/java/sip/communicator/impl/gui/main/account/AccountsConfigurationForm.java +++ /dev/null @@ -1,65 +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.main.account; - -import net.java.sip.communicator.impl.gui.*; -import net.java.sip.communicator.impl.gui.utils.*; -import net.java.sip.communicator.service.gui.*; - -/** - * The <tt>AccountsConfigurationForm</tt> is the form where the user could - * create, modify or delete an account. - * - * @author Yana Stamcheva - */ -public class AccountsConfigurationForm - extends AbstractConfigurationForm -{ - private Object form; - - /** - * Returns the form of this configuration form. - * - * @return the form of this configuration form. - */ - public Object getForm() - { - if (form == null) - form = super.getForm(); - return form; - } - - protected String getFormClassName() - { - return "net.java.sip.communicator.impl.gui.main.account.AccountsConfigurationPanel"; - } - - /** - * Returns the icon of this configuration form. - * - * @return the icon of this configuration form. - */ - public byte[] getIcon() - { - return ImageLoader.getImageInBytes(ImageLoader.ACCOUNT_ICON); - } - - public int getIndex() - { - return 1; - } - - /** - * Returns the title of this configuration form. - * - * @return the title of this configuration form. - */ - public String getTitle() - { - return GuiActivator.getResources() - .getI18NString("service.gui.ACCOUNTS"); - } -} diff --git a/src/net/java/sip/communicator/impl/gui/main/call/ReceivedCallDialog.java b/src/net/java/sip/communicator/impl/gui/main/call/ReceivedCallDialog.java index 5ceb010..7e0c18c 100644 --- a/src/net/java/sip/communicator/impl/gui/main/call/ReceivedCallDialog.java +++ b/src/net/java/sip/communicator/impl/gui/main/call/ReceivedCallDialog.java @@ -129,9 +129,9 @@ public class ReceivedCallDialog boolean hasMoreParticipants = false; String text = ""; - ImageIcon imageIcon = ImageUtils.getScaledRoundedImage( - ImageLoader.getImage(ImageLoader.DEFAULT_USER_PHOTO), - 40, 45); + ImageIcon imageIcon = + ImageUtils.getScaledRoundedIcon(ImageLoader + .getImage(ImageLoader.DEFAULT_USER_PHOTO), 40, 45); while (participantsIter.hasNext()) { diff --git a/src/net/java/sip/communicator/impl/gui/main/chat/toolBars/ExtendedMainToolBar.java b/src/net/java/sip/communicator/impl/gui/main/chat/toolBars/ExtendedMainToolBar.java index 22a053f..524c5d3 100644 --- a/src/net/java/sip/communicator/impl/gui/main/chat/toolBars/ExtendedMainToolBar.java +++ b/src/net/java/sip/communicator/impl/gui/main/chat/toolBars/ExtendedMainToolBar.java @@ -492,10 +492,7 @@ public class ExtendedMainToolBar } else if (buttonText.equalsIgnoreCase("settings")) { - ExportedWindow configDialog = GuiActivator.getUIService() - .getExportedWindow(ExportedWindow.CONFIGURATION_WINDOW); - - configDialog.setVisible(true); + GuiActivator.getUIService().setConfigurationWindowVisible(true); } } diff --git a/src/net/java/sip/communicator/impl/gui/main/chat/toolBars/MainToolBar.java b/src/net/java/sip/communicator/impl/gui/main/chat/toolBars/MainToolBar.java index 614236b..2634e67 100644 --- a/src/net/java/sip/communicator/impl/gui/main/chat/toolBars/MainToolBar.java +++ b/src/net/java/sip/communicator/impl/gui/main/chat/toolBars/MainToolBar.java @@ -20,7 +20,6 @@ import net.java.sip.communicator.impl.gui.main.chat.history.*; 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.util.*; import net.java.sip.communicator.util.swing.*; @@ -58,8 +57,6 @@ public class MainToolBar private ChatWindow messageWindow; - private Contact currentChatContact = null; - /** * Empty constructor to be used from inheritors. */ @@ -192,10 +189,7 @@ public class MainToolBar } else if (buttonText.equals("options")) { - ExportedWindow optionsDialog = GuiActivator.getUIService() - .getExportedWindow(ExportedWindow.CONFIGURATION_WINDOW); - - optionsDialog.setVisible(true); + GuiActivator.getUIService().setConfigurationWindowVisible(true); } } 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..88d7506 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 @@ -29,7 +29,9 @@ public class ConfigFormDescriptor private final ConfigurationForm configForm; private ImageIcon configFormIcon; - + + private Component configFormPanel; + private String configFormTitle; /** @@ -76,14 +78,18 @@ public class ConfigFormDescriptor */ public Component getConfigFormPanel() { - Object form = configForm.getForm(); - if ((form instanceof Component) == false) + if (configFormPanel == null) { - throw new ClassCastException("ConfigurationFrame :" - + form.getClass() - + " is not a class supported by this ui implementation"); + Object form = configForm.getForm(); + if ((form instanceof Component) == false) + { + throw new ClassCastException("ConfigurationFrame :" + + form.getClass() + + " is not a class supported by this ui implementation"); + } + configFormPanel = (Component) form; } - return (Component) form; + return configFormPanel; } /** diff --git a/src/net/java/sip/communicator/impl/gui/main/configforms/ConfigFormList.java b/src/net/java/sip/communicator/impl/gui/main/configforms/ConfigFormList.java index fa7e6ea..aefcbaf 100644 --- a/src/net/java/sip/communicator/impl/gui/main/configforms/ConfigFormList.java +++ b/src/net/java/sip/communicator/impl/gui/main/configforms/ConfigFormList.java @@ -4,7 +4,6 @@ * Distributable under LGPL license. * See terms of license at gnu.org. */ - package net.java.sip.communicator.impl.gui.main.configforms; import javax.swing.*; @@ -22,9 +21,9 @@ public class ConfigFormList extends JList implements ListSelectionListener { - private DefaultListModel listModel = new DefaultListModel(); + private final DefaultListModel listModel = new DefaultListModel(); - private ConfigurationFrame configFrame; + private final ConfigurationFrame configFrame; /** * Creates an instance of <tt>ConfigFormList</tt> diff --git a/src/net/java/sip/communicator/impl/gui/main/configforms/ConfigurationFrame.java b/src/net/java/sip/communicator/impl/gui/main/configforms/ConfigurationFrame.java index 96c375f..3f6f5b9 100644 --- a/src/net/java/sip/communicator/impl/gui/main/configforms/ConfigurationFrame.java +++ b/src/net/java/sip/communicator/impl/gui/main/configforms/ConfigurationFrame.java @@ -12,7 +12,6 @@ import javax.swing.*; import net.java.sip.communicator.impl.gui.*; import net.java.sip.communicator.impl.gui.customcontrols.*; import net.java.sip.communicator.impl.gui.main.*; -import net.java.sip.communicator.impl.gui.main.account.*; import net.java.sip.communicator.impl.gui.utils.Constants; import net.java.sip.communicator.service.gui.*; import net.java.sip.communicator.util.*; @@ -27,24 +26,16 @@ import org.osgi.framework.*; */ public class ConfigurationFrame extends SIPCommDialog - implements ExportedWindow, ServiceListener + implements ServiceListener { - private Logger logger = Logger.getLogger(ConfigurationFrame.class); + private final Logger logger = Logger.getLogger(ConfigurationFrame.class); - private ConfigFormList configList; + private final ConfigFormList configList; - private SCScrollPane configScrollList; + private final TitlePanel titlePanel = new TitlePanel(); - private TitlePanel titlePanel = new TitlePanel(); - - private TransparentPanel mainPanel - = new TransparentPanel(new BorderLayout(5, 5)); - - private TransparentPanel centerPanel - = new TransparentPanel(new BorderLayout(5, 5)); - - private TransparentPanel buttonsPanel - = new TransparentPanel(new FlowLayout(FlowLayout.RIGHT)); + private final JPanel centerPanel = + new TransparentPanel(new BorderLayout(5, 5)); /** * Creates an instance of <tt>ConfigurationManagerImpl</tt>. @@ -55,14 +46,18 @@ public class ConfigurationFrame { super(mainFrame); + JPanel mainPanel = new TransparentPanel(new BorderLayout(5, 5)); + JPanel buttonsPanel = + new TransparentPanel(new FlowLayout(FlowLayout.RIGHT)); + this.configList = new ConfigFormList(this); - this.configScrollList = new SCScrollPane(); + SCScrollPane configScrollList = new SCScrollPane(); - this.configScrollList.setHorizontalScrollBarPolicy( + configScrollList.setHorizontalScrollBarPolicy( JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); - this.configScrollList.setViewportView(configList); + configScrollList.setViewportView(configList); this.setTitle(GuiActivator.getResources() .getI18NString("service.gui.SETTINGS")); @@ -71,16 +66,16 @@ public class ConfigurationFrame this.addDefaultForms(); - this.mainPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); + mainPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); - this.mainPanel.add(centerPanel, BorderLayout.CENTER); + mainPanel.add(centerPanel, BorderLayout.CENTER); - this.mainPanel.add(configScrollList, BorderLayout.WEST); + mainPanel.add(configScrollList, BorderLayout.WEST); buttonsPanel.setBorder(BorderFactory.createMatteBorder(1, 0, 0, 0, Constants.BORDER_COLOR)); - this.mainPanel.add(buttonsPanel, BorderLayout.SOUTH); + mainPanel.add(buttonsPanel, BorderLayout.SOUTH); this.getContentPane().add(mainPanel); @@ -116,7 +111,11 @@ public class ConfigurationFrame */ public void addDefaultForms() { - this.addConfigurationForm(new AccountsConfigurationForm()); + this + .addConfigurationForm(new LazyConfigurationForm( + "net.java.sip.communicator.impl.gui.main.account.AccountsConfigurationPanel", + getClass().getClassLoader(), "service.gui.icons.ACCOUNT_ICON", + "service.gui.ACCOUNTS", 1)); } /** @@ -162,24 +161,6 @@ public class ConfigurationFrame } /** - * Implements <code>ApplicationWindow.minimizeWindow</code> method. - * - * @see net.java.sip.communicator.service.gui.ExportedWindow#minimize() - */ - public void minimize() - { - } - - /** - * Implements <code>ApplicationWindow.maximizeWindow</code> method. - * - * @see net.java.sip.communicator.service.gui.ExportedWindow#maximize() - */ - public void maximize() - { - } - - /** * Implements <tt>SIPCommFrame.close()</tt> method. Performs a click on * the close button. * @@ -191,36 +172,6 @@ public class ConfigurationFrame } /** - * Returns the identifier of this <tt>ExportedWindow</tt>. - * - * @return a reference to the <tt>WindowID</tt> instance representing this - * frame. - */ - public WindowID getIdentifier() - { - return ExportedWindow.CONFIGURATION_WINDOW; - } - - /** - * Implements the <tt>ExportedWindow.bringToFront</tt> method. Brings this - * window to front. - */ - public void bringToFront() - { - this.toFront(); - } - - /** - * The source of the window - * - * @return the source of the window - */ - public Object getSource() - { - return this; - } - - /** * Handles registration of a new configuration form. */ public void serviceChanged(ServiceEvent event) @@ -289,9 +240,4 @@ public class ConfigurationFrame { this.configList.removeConfigForm(configForm); } - - /** - * Implementation of {@link ExportedWindow#setParams(Object[])}. - */ - public void setParams(Object[] windowParams) {} } diff --git a/src/net/java/sip/communicator/impl/gui/main/contactlist/ActionMenuPanel.java b/src/net/java/sip/communicator/impl/gui/main/contactlist/ActionMenuPanel.java index 03a2715..ac403e0 100644 --- a/src/net/java/sip/communicator/impl/gui/main/contactlist/ActionMenuPanel.java +++ b/src/net/java/sip/communicator/impl/gui/main/contactlist/ActionMenuPanel.java @@ -202,10 +202,7 @@ public class ActionMenuPanel } else if (buttonName.equals("options")) { - ExportedWindow optionsDialog = GuiActivator.getUIService() - .getExportedWindow(ExportedWindow.CONFIGURATION_WINDOW); - - optionsDialog.setVisible(true); + GuiActivator.getUIService().setConfigurationWindowVisible(true); } else if (buttonName.equals("showOffline")) { 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 98f6259..a67c031 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 @@ -92,15 +92,13 @@ public class ExtendedQuickMenu private MoreButton moreButton = new MoreButton(); - private ExportedWindow configDialog; - private MainFrame mainFrame; - private int movedDownButtons = 0; - - private Hashtable pluginsTable = new Hashtable(); + private final Map<PluginComponent, Component> pluginsTable = + new Hashtable<PluginComponent, Component>(); - private LinkedList components = new LinkedList(); + private final java.util.List<Component> components = + new LinkedList<Component>(); /** * Create an instance of the <tt>QuickMenu</tt>. @@ -273,17 +271,7 @@ public class ExtendedQuickMenu wizard.setVisible(true); } } - - private class ConfigAction extends AbstractAction - { - public void actionPerformed(ActionEvent arg0) - { - configDialog = GuiActivator.getUIService() - .getExportedWindow(ExportedWindow.CONFIGURATION_WINDOW); - configDialog.setVisible(true); - } - } /** * Handles the <tt>ActionEvent</tt> triggered when user clicks on one of * the buttons in this toolbar. @@ -379,14 +367,14 @@ public class ExtendedQuickMenu */ public void componentMoved(ComponentEvent e) { - int compCount = this.components.size(); - int maxWidth = this.toolBar.getWidth(); int width = 0; - for (int i = 0; i < compCount; i ++) + for (Component component : components) { - JComponent c = (JComponent) this.components.get(i); + if (!(component instanceof JComponent)) + continue; + JComponent c = (JComponent) component; width += c.getWidth() + 10; @@ -420,12 +408,8 @@ public class ExtendedQuickMenu { if((e.getFirstIndex() != -1 || e.getLastIndex() != -1)) { - Enumeration plugins = pluginsTable.keys(); - - while (plugins.hasMoreElements()) + for (PluginComponent plugin : pluginsTable.keySet()) { - PluginComponent plugin = (PluginComponent) plugins.nextElement(); - Object selectedValue = mainFrame.getContactListPanel() .getContactList().getSelectedValue(); @@ -457,8 +441,6 @@ public class ExtendedQuickMenu private class ToolBarButton extends JLabel { - private Image iconImage; - private boolean isMouseOver = false; private boolean isMousePressed = false; @@ -554,10 +536,7 @@ public class ExtendedQuickMenu } else if (buttonName.equals("config")) { - configDialog = GuiActivator.getUIService() - .getExportedWindow(ExportedWindow.CONFIGURATION_WINDOW); - - configDialog.setVisible(true); + GuiActivator.getUIService().setConfigurationWindowVisible(true); } else if (buttonName.equals("search")) { @@ -635,12 +614,12 @@ public class ExtendedQuickMenu (MetaContact) selectedValue; OperationSetWebContactInfo wContactInfo = null; - - Iterator protocolContacts = selectedMetaContact.getContacts(); - - while(protocolContacts.hasNext()) + + Iterator<Contact> protocolContacts = selectedMetaContact.getContacts(); + + while (protocolContacts.hasNext()) { - Contact protoContact = (Contact) protocolContacts.next(); + Contact protoContact = protocolContacts.next(); wContactInfo = mainFrame.getWebContactInfoOpSet( protoContact.getProtocolProvider()); diff --git a/src/net/java/sip/communicator/impl/gui/main/menus/ToolsMenu.java b/src/net/java/sip/communicator/impl/gui/main/menus/ToolsMenu.java index 6190ecb..50741fd 100644 --- a/src/net/java/sip/communicator/impl/gui/main/menus/ToolsMenu.java +++ b/src/net/java/sip/communicator/impl/gui/main/menus/ToolsMenu.java @@ -35,10 +35,6 @@ public class ToolsMenu { private final Logger logger = Logger.getLogger(ToolsMenu.class); - private MainFrame parentWindow; - - private ExportedWindow configDialog; - /** * Creates an instance of <tt>FileMenu</tt>. * @param parentWindow The parent <tt>ChatWindow</tt>. @@ -114,11 +110,7 @@ public class ToolsMenu void configActionPerformed() { - ExportedWindow configDialog = - GuiActivator.getUIService().getExportedWindow( - ExportedWindow.CONFIGURATION_WINDOW); - - configDialog.setVisible(true); + GuiActivator.getUIService().setConfigurationWindowVisible(true); } public void pluginComponentAdded(PluginComponentEvent event) diff --git a/src/net/java/sip/communicator/impl/gui/utils/ImageLoader.java b/src/net/java/sip/communicator/impl/gui/utils/ImageLoader.java index 17cea7c..ab7ae5e 100644 --- a/src/net/java/sip/communicator/impl/gui/utils/ImageLoader.java +++ b/src/net/java/sip/communicator/impl/gui/utils/ImageLoader.java @@ -28,12 +28,13 @@ import net.java.sip.communicator.util.*; */ public class ImageLoader { - private static Logger log = Logger.getLogger(ImageLoader.class); + private static final Logger log = Logger.getLogger(ImageLoader.class); /** * Stores all already loaded images. */ - private static Hashtable loadedImages = new Hashtable(); + private static final Map<ImageID, BufferedImage> loadedImages = + new Hashtable<ImageID, BufferedImage>(); /** * The SIP Communicator logo 16x16 icon. @@ -194,12 +195,6 @@ public class ImageLoader { /** * The icon on the "Add contact" button in the <tt>QuickMenu</tt>. */ - public static final ImageID ACCOUNT_ICON - = new ImageID("service.gui.icons.ACCOUNT_ICON"); - - /** - * The icon on the "Add contact" button in the <tt>QuickMenu</tt>. - */ public static final ImageID QUICK_MENU_ADD_ICON = new ImageID("service.gui.icons.QUICK_MENU_ADD_ICON"); @@ -1088,7 +1083,7 @@ public class ImageLoader { if (loadedImages.containsKey(imageID)) { - image = (BufferedImage) loadedImages.get(imageID); + image = loadedImages.get(imageID); } else { @@ -1192,9 +1187,7 @@ public class ImageLoader { */ public static BufferedImage[] getAnimatedImage(byte[] animatedImage) { - Iterator readers = ImageIO.getImageReadersBySuffix("gif"); - - ImageReader reader = (ImageReader) readers.next(); + ImageReader reader = ImageIO.getImageReadersBySuffix("gif").next(); ImageInputStream iis; @@ -1234,14 +1227,10 @@ public class ImageLoader { */ public static String getImagePath(Image image) { - Iterator i = ImageLoader.loadedImages.entrySet().iterator(); - - while (i.hasNext()) { - Map.Entry entry = (Map.Entry) i.next(); - + for (Map.Entry<ImageID, BufferedImage> entry : loadedImages.entrySet()) { if (entry.getValue().equals(image)) { - String imageID = ((ImageID) entry.getKey()).getId(); + String imageID = entry.getKey().getId(); try { diff --git a/src/net/java/sip/communicator/impl/media/MediaActivator.java b/src/net/java/sip/communicator/impl/media/MediaActivator.java index 3599aa3..8cdee40 100644 --- a/src/net/java/sip/communicator/impl/media/MediaActivator.java +++ b/src/net/java/sip/communicator/impl/media/MediaActivator.java @@ -8,7 +8,7 @@ package net.java.sip.communicator.impl.media; import net.java.sip.communicator.service.configuration.*; import net.java.sip.communicator.service.fileaccess.*; -import net.java.sip.communicator.service.gui.ConfigurationForm; +import net.java.sip.communicator.service.gui.*; import net.java.sip.communicator.service.media.*; import net.java.sip.communicator.service.netaddr.*; import net.java.sip.communicator.service.resources.*; @@ -67,7 +67,10 @@ public class MediaActivator // MediaConfigurationForm context.registerService(ConfigurationForm.class.getName(), - new MediaConfigurationForm(), null); + new LazyConfigurationForm( + "net.java.sip.communicator.impl.media.MediaConfigurationPanel", + getClass().getClassLoader(), "plugin.mediaconfig.PLUGIN_ICON", + "impl.media.configform.TITLE"), null); } /** diff --git a/src/net/java/sip/communicator/impl/media/MediaConfigurationForm.java b/src/net/java/sip/communicator/impl/media/MediaConfigurationForm.java deleted file mode 100644 index b2ce67e..0000000 --- a/src/net/java/sip/communicator/impl/media/MediaConfigurationForm.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.media;
-
-import net.java.sip.communicator.service.gui.*;
-
-/**
- * @author Lubomir Marinov
- */
-public class MediaConfigurationForm
- extends AbstractConfigurationForm
-{
- protected String getFormClassName()
- {
- return "net.java.sip.communicator.impl.media.MediaConfigurationPanel";
- }
-
- public byte[] getIcon()
- {
- return MediaActivator.getResources().getImageInBytes(
- "plugin.mediaconfig.PLUGIN_ICON");
- }
-
- public String getTitle()
- {
- return MediaActivator.getResources().getI18NString(
- "impl.media.configform.TITLE");
- }
-}
diff --git a/src/net/java/sip/communicator/impl/media/codec/EncodingConfiguration.java b/src/net/java/sip/communicator/impl/media/codec/EncodingConfiguration.java index f7cc5b5..b2582d1 100644 --- a/src/net/java/sip/communicator/impl/media/codec/EncodingConfiguration.java +++ b/src/net/java/sip/communicator/impl/media/codec/EncodingConfiguration.java @@ -300,7 +300,7 @@ public class EncodingConfiguration .getSupportedOutputFormats(null), PlugInManager.CODEC); logger.debug("Codec : " + className - + " is succsefully registered : " + result); + + " is successfully registered : " + result); } catch (Throwable ex) { diff --git a/src/net/java/sip/communicator/impl/notification/NotificationActivator.java b/src/net/java/sip/communicator/impl/notification/NotificationActivator.java index 45095ae..a98ca6b 100644 --- a/src/net/java/sip/communicator/impl/notification/NotificationActivator.java +++ b/src/net/java/sip/communicator/impl/notification/NotificationActivator.java @@ -23,13 +23,11 @@ import org.osgi.framework.*; public class NotificationActivator implements BundleActivator { - private Logger logger = Logger.getLogger(NotificationActivator.class); - + private final Logger logger = Logger.getLogger(NotificationActivator.class); + private static BundleContext bundleContext; private static ConfigurationService configService; - - private NotificationServiceImpl notificationService; private static AudioNotifierService audioNotifierService; @@ -41,15 +39,14 @@ public class NotificationActivator try { // Create the notification service implementation - this.notificationService = new NotificationServiceImpl(); + NotificationService notificationService = + new NotificationServiceImpl(); logger.info("Notification Service...[ STARTED ]"); - bundleContext.registerService( - NotificationService.class.getName(), - this.notificationService, - null); - + bundleContext.registerService(NotificationService.class.getName(), + notificationService, null); + logger.info("Notification Service ...[REGISTERED]"); logger.logEntry(); diff --git a/src/net/java/sip/communicator/impl/notification/NotificationServiceImpl.java b/src/net/java/sip/communicator/impl/notification/NotificationServiceImpl.java index d968cf7..d93e387 100644 --- a/src/net/java/sip/communicator/impl/notification/NotificationServiceImpl.java +++ b/src/net/java/sip/communicator/impl/notification/NotificationServiceImpl.java @@ -25,7 +25,7 @@ public class NotificationServiceImpl private final Logger logger = Logger.getLogger(NotificationServiceImpl.class); - private static String NOTIFICATIONS_PREFIX = + private static final String NOTIFICATIONS_PREFIX = "net.java.sip.communicator.impl.notifications"; /** @@ -37,23 +37,24 @@ public class NotificationServiceImpl /** * A set of all registered event notifications. */ - private Hashtable defaultNotificationsTable = new Hashtable(); + private final Map<String, EventNotification> defaultNotificationsTable = + new Hashtable<String, EventNotification>(); /** * A list of all registered <tt>NotificationChangeListener</tt>s. */ - private Vector changeListeners = new Vector(); - - private ConfigurationService configService = null; + private final List<NotificationChangeListener> changeListeners = + new Vector<NotificationChangeListener>(); + private final ConfigurationService configService = + NotificationActivator.getConfigurationService(); + /** * Creates an instance of <tt>NotificationServiceImpl</tt> by loading all * previously saved notifications. */ public NotificationServiceImpl() { - configService = NotificationActivator.getConfigurationService(); - // Load all previously saved notifications. this.loadNotifications(); } @@ -753,13 +754,9 @@ public class NotificationServiceImpl NotificationEventTypeEvent event = new NotificationEventTypeEvent(this, eventType, sourceEventType); - - NotificationChangeListener listener; - - for (int i = 0 ; i < changeListeners.size(); i ++) + + for (NotificationChangeListener listener : changeListeners) { - listener = (NotificationChangeListener) changeListeners.get(i); - if (eventType.equals(NotificationEventTypeEvent.EVENT_TYPE_ADDED)) { listener.eventTypeAdded(event); @@ -911,29 +908,17 @@ public class NotificationServiceImpl // We fire the appropriate event depending on whether this is an // already existing actionType or a new one. - if (!isNew) - { - fireNotificationActionTypeEvent( - NotificationActionTypeEvent.ACTION_CHANGED, - eventType, - actionType, - handler); - } - else - { - fireNotificationActionTypeEvent( - NotificationActionTypeEvent.ACTION_ADDED, - eventType, - actionType, - handler); - } + fireNotificationActionTypeEvent( + isNew ? NotificationActionTypeEvent.ACTION_ADDED + : NotificationActionTypeEvent.ACTION_CHANGED, eventType, + actionType, handler); } // now store this default events if we want to retore them EventNotification notification = null; if(defaultNotificationsTable.containsKey(eventType)) - notification = (EventNotification) defaultNotificationsTable.get(eventType); + notification = defaultNotificationsTable.get(eventType); else { notification = new EventNotification(eventType); @@ -1016,29 +1001,17 @@ public class NotificationServiceImpl // We fire the appropriate event depending on whether this is an // already existing actionType or a new one. - if (!isNew) - { - fireNotificationActionTypeEvent( - NotificationActionTypeEvent.ACTION_CHANGED, - eventType, - actionType, - handler); - } - else - { - fireNotificationActionTypeEvent( - NotificationActionTypeEvent.ACTION_ADDED, - eventType, - actionType, - handler); - } + fireNotificationActionTypeEvent( + isNew ? NotificationActionTypeEvent.ACTION_ADDED + : NotificationActionTypeEvent.ACTION_CHANGED, eventType, + actionType, handler); } - // now store this default events if we want to retore them + // now store this default events if we want to restore them EventNotification notification = null; if(defaultNotificationsTable.containsKey(eventType)) - notification = (EventNotification) defaultNotificationsTable.get(eventType); + notification = defaultNotificationsTable.get(eventType); else { notification = new EventNotification(eventType); @@ -1075,16 +1048,14 @@ public class NotificationServiceImpl */ public void restoreDefaults() { - Iterator iter = - ((Hashtable)notificationsTable.clone()).keySet().iterator(); - - while (iter.hasNext()) + Set<String> eventTypes = + ((Hashtable<String, EventNotification>) notificationsTable.clone()) + .keySet(); + + for (String eventType : eventTypes) { - String eventType = (String)iter.next(); - - EventNotification notification - = (EventNotification) notificationsTable.get(eventType); - + EventNotification notification = notificationsTable.get(eventType); + Vector actionsToRemove = new Vector(notification.getActions().keySet()); Iterator actionIter = actionsToRemove.iterator(); while (actionIter.hasNext()) @@ -1096,16 +1067,12 @@ public class NotificationServiceImpl removeEventNotification(eventType); } - - iter = defaultNotificationsTable.keySet().iterator(); - - while (iter.hasNext()) + + for (Map.Entry<String, EventNotification> entry : defaultNotificationsTable.entrySet()) { - String eventType = (String)iter.next(); - - EventNotification notification - = (EventNotification) defaultNotificationsTable.get(eventType); - + String eventType = entry.getKey(); + EventNotification notification = entry.getValue(); + Iterator actionIter = notification.getActions().keySet().iterator(); while (actionIter.hasNext()) { diff --git a/src/net/java/sip/communicator/impl/protocol/ssh/SSHContactInfo.java b/src/net/java/sip/communicator/impl/protocol/ssh/SSHContactInfo.java index 7fcd1b1..0e38a3a 100644 --- a/src/net/java/sip/communicator/impl/protocol/ssh/SSHContactInfo.java +++ b/src/net/java/sip/communicator/impl/protocol/ssh/SSHContactInfo.java @@ -18,15 +18,12 @@ import java.text.ParseException; import javax.swing.*; import javax.swing.text.*; -import net.java.sip.communicator.service.gui.*; import net.java.sip.communicator.util.swing.*; /** - * * @author Shobhit Jindal */ -class SSHContactInfo extends SIPCommDialog - implements ConfigurationForm { +class SSHContactInfo extends SIPCommDialog { private ContactSSH sshContact; private JPanel mainPanel = new TransparentPanel(); @@ -210,15 +207,7 @@ class SSHContactInfo extends SIPCommDialog public byte[] getIcon() { return Resources.getImage(Resources.SSH_LOGO); } - - /** - * Return the main panel - * - * @return the main panel - */ - public Object getForm() { - return mainPanel; - } + // // public void setContactGroup(ContactGroup contactGroup) // { @@ -338,11 +327,6 @@ class SSHContactInfo extends SIPCommDialog this.portField.setText(port); } - public int getIndex() - { - return -1; - } - protected void close(boolean isEscaped) { } diff --git a/src/net/java/sip/communicator/impl/systray/jdic/TrayMenuFactory.java b/src/net/java/sip/communicator/impl/systray/jdic/TrayMenuFactory.java index 94b7ce1..249cbea 100644 --- a/src/net/java/sip/communicator/impl/systray/jdic/TrayMenuFactory.java +++ b/src/net/java/sip/communicator/impl/systray/jdic/TrayMenuFactory.java @@ -47,11 +47,7 @@ public final class TrayMenuFactory if (itemName.equals("settings")) { - ExportedWindow configWindow = - SystrayActivator.getUIService().getExportedWindow( - ExportedWindow.CONFIGURATION_WINDOW); - - configWindow.setVisible(true); + SystrayActivator.getUIService().setConfigurationWindowVisible(true); } else if (itemName.equals("service.gui.CLOSE")) { diff --git a/src/net/java/sip/communicator/plugin/accountinfo/AccountInfoActivator.java b/src/net/java/sip/communicator/plugin/accountinfo/AccountInfoActivator.java index 814f727..acb2ed0 100644 --- a/src/net/java/sip/communicator/plugin/accountinfo/AccountInfoActivator.java +++ b/src/net/java/sip/communicator/plugin/accountinfo/AccountInfoActivator.java @@ -4,16 +4,13 @@ * Distributable under LGPL license.
* See terms of license at gnu.org.
*/
-
package net.java.sip.communicator.plugin.accountinfo;
-import java.util.Hashtable;
-import java.util.Map;
+import java.util.*;
import net.java.sip.communicator.service.browserlauncher.*;
-import net.java.sip.communicator.service.gui.*;
import net.java.sip.communicator.service.protocol.*;
-import net.java.sip.communicator.util.Logger;
+import net.java.sip.communicator.util.*;
import org.osgi.framework.*;
@@ -25,27 +22,21 @@ import org.osgi.framework.*; public class AccountInfoActivator
implements BundleActivator
{
- private static Logger logger =
- Logger.getLogger(AccountInfoActivator.class.getName());
+ private static final Logger logger =
+ Logger.getLogger(AccountInfoActivator.class);
public static BundleContext bundleContext;
- private static Map providerFactoriesMap = new Hashtable();
-
private static BrowserLauncherService browserLauncherService;
public void start(BundleContext bc) throws Exception
{
AccountInfoActivator.bundleContext = bc;
- ServiceReference uiServiceRef =
- bc.getServiceReference(UIService.class.getName());
-
- UIService uiService = (UIService) bc.getService(uiServiceRef);
-
- ExportedWindow configWindow
- = uiService.getExportedWindow(ExportedWindow.CONFIGURATION_WINDOW);
-// configWindow.addConfigurationForm(new AccountInfoForm());
+// new LazyConfigurationForm(
+// "net.java.sip.communicator.plugin.accountinfo.AccountInfoPanel",
+// getClass().getClassLoader(), "plugin.accountinfo.PLUGIN_ICON",
+// "plugin.accountinfo.TITLE");
}
public void stop(BundleContext bc) throws Exception
@@ -59,8 +50,10 @@ public class AccountInfoActivator * @return all <tt>ProtocolProviderFactory</tt>s obtained from the bundle
* context
*/
- public static Map getProtocolProviderFactories()
+ public static Map<Object, ProtocolProviderFactory> getProtocolProviderFactories()
{
+ Map<Object, ProtocolProviderFactory> providerFactoriesMap =
+ new Hashtable<Object, ProtocolProviderFactory>();
ServiceReference[] serRefs = null;
try
@@ -105,4 +98,4 @@ public class AccountInfoActivator return browserLauncherService;
}
-}
\ No newline at end of file +}
diff --git a/src/net/java/sip/communicator/plugin/accountinfo/AccountInfoForm.java b/src/net/java/sip/communicator/plugin/accountinfo/AccountInfoPanel.java index 8b0bee9..02e4b0a 100644 --- a/src/net/java/sip/communicator/plugin/accountinfo/AccountInfoForm.java +++ b/src/net/java/sip/communicator/plugin/accountinfo/AccountInfoPanel.java @@ -10,7 +10,6 @@ import java.util.*; import javax.swing.*;
-import net.java.sip.communicator.service.gui.*;
import net.java.sip.communicator.service.protocol.*;
import net.java.sip.communicator.service.protocol.event.*;
import net.java.sip.communicator.util.swing.*;
@@ -23,9 +22,8 @@ import org.osgi.framework.*; *
* @author Adam Goldstein
*/
-public class AccountInfoForm
+public class AccountInfoPanel
extends TransparentPanel
- implements ConfigurationForm
{
/**
* The right side of the AccountInfo frame that contains protocol specific
@@ -33,10 +31,8 @@ public class AccountInfoForm */
private AccountDetailsPanel detailsPanel;
- private JTabbedPane accountsTabbedPane = new SIPCommTabbedPane(false, false);
-
- private Hashtable<ProtocolProviderService, AccountDetailsPanel>
- accountsTable = new Hashtable();
+ private final Map<ProtocolProviderService, AccountDetailsPanel> accountsTable =
+ new Hashtable<ProtocolProviderService, AccountDetailsPanel>();
/**
* Constructs a frame with an AccuontInfoAccountPanel to display all
@@ -45,39 +41,23 @@ public class AccountInfoForm *
* @param metaContact
*/
- public AccountInfoForm()
+ public AccountInfoPanel()
{
super(new BorderLayout());
- Set set = AccountInfoActivator.getProtocolProviderFactories().entrySet();
- Iterator iter = set.iterator();
-
- boolean hasRegisteredAccounts = false;
+ JTabbedPane accountsTabbedPane = new SIPCommTabbedPane(false, false);
- while (iter.hasNext())
+ for (ProtocolProviderFactory providerFactory : AccountInfoActivator
+ .getProtocolProviderFactories().values())
{
- Map.Entry entry = (Map.Entry) iter.next();
-
- ProtocolProviderFactory providerFactory
- = (ProtocolProviderFactory) entry.getValue();
-
- ArrayList accountsList = providerFactory.getRegisteredAccounts();
+ ArrayList<AccountID> accountsList =
+ providerFactory.getRegisteredAccounts();
- AccountID accountID;
ServiceReference serRef;
ProtocolProviderService protocolProvider;
- for (int i = 0; i < accountsList.size(); i++)
+ for (AccountID accountID : accountsList)
{
- accountID = (AccountID) accountsList.get(i);
-
- boolean isHidden =
- accountID
- .getAccountProperty(ProtocolProviderFactory.IS_PROTOCOL_HIDDEN) != null;
-
- if(!isHidden)
- hasRegisteredAccounts = true;
-
serRef = providerFactory.getProviderForAccount(accountID);
protocolProvider = (ProtocolProviderService) AccountInfoActivator
@@ -90,7 +70,7 @@ public class AccountInfoForm protocolProvider.addRegistrationStateChangeListener(
new RegistrationStateChangeListenerImpl());
- this.accountsTabbedPane.addTab(
+ accountsTabbedPane.addTab(
accountID.getUserID(), detailsPanel);
}
}
@@ -98,36 +78,6 @@ public class AccountInfoForm this.add(accountsTabbedPane, BorderLayout.CENTER);
}
- /**
- * Returns the title of this configuration form.
- *
- * @return the icon of this configuration form.
- */
- public String getTitle()
- {
- return Resources.getString("plugin.accountinfo.TITLE");
- }
-
- /**
- * Returns the icon of this configuration form.
- *
- * @return the icon of this configuration form.
- */
- public byte[] getIcon()
- {
- return Resources.getImageInBytes("plugin.accountinfo.PLUGIN_ICON");
- }
-
- /**
- * Returns the form of this configuration form.
- *
- * @return the form of this configuration form.
- */
- public Object getForm()
- {
- return this;
- }
-
private class RegistrationStateChangeListenerImpl
implements RegistrationStateChangeListener
{
@@ -150,9 +100,4 @@ public class AccountInfoForm }
}
}
-
- public int getIndex()
- {
- return -1;
- }
-}
\ No newline at end of file +}
diff --git a/src/net/java/sip/communicator/plugin/autoaway/AutoAwayActivator.java b/src/net/java/sip/communicator/plugin/autoaway/AutoAwayActivator.java index 0fb670b..721acb8 100644 --- a/src/net/java/sip/communicator/plugin/autoaway/AutoAwayActivator.java +++ b/src/net/java/sip/communicator/plugin/autoaway/AutoAwayActivator.java @@ -44,15 +44,16 @@ public class AutoAwayActivator implements BundleActivator public void start(BundleContext bc) throws Exception { bundleContext = bc; - - // Set config form - AutoAwayConfigForm statusCF = new AutoAwayConfigForm(); - bundleContext.registerService(ConfigurationForm.class.getName(), - statusCF, - null); - + bundleContext + .registerService( + ConfigurationForm.class.getName(), + new LazyConfigurationForm( + "net.java.sip.communicator.plugin.autoaway.AutoAwayConfigurationPanel", + getClass().getClassLoader(), "plugin.autoaway.PLUGIN_ICON", + "plugin.autoaway.AUTO_STATUS"), null); + new Thread(new Runnable() { diff --git a/src/net/java/sip/communicator/plugin/autoaway/AutoAwayConfigForm.java b/src/net/java/sip/communicator/plugin/autoaway/AutoAwayConfigurationPanel.java index ff0ce14..591de6f 100644 --- a/src/net/java/sip/communicator/plugin/autoaway/AutoAwayConfigForm.java +++ b/src/net/java/sip/communicator/plugin/autoaway/AutoAwayConfigurationPanel.java @@ -14,7 +14,6 @@ import javax.swing.*; import javax.swing.event.*; import net.java.sip.communicator.service.configuration.*; -import net.java.sip.communicator.service.gui.*; import net.java.sip.communicator.util.swing.*; /** @@ -23,9 +22,8 @@ import net.java.sip.communicator.util.swing.*; * * @author Damien Roth */ -public class AutoAwayConfigForm +public class AutoAwayConfigurationPanel extends TransparentPanel - implements ConfigurationForm { private JCheckBox enable; private JSpinner timer; @@ -33,7 +31,7 @@ public class AutoAwayConfigForm /** * Create an instance of <tt>StatusConfigForm</tt> */ - public AutoAwayConfigForm() + public AutoAwayConfigurationPanel() { super(new BorderLayout(10, 10)); @@ -155,42 +153,4 @@ public class AutoAwayConfigForm Integer interval = (Integer) timer.getValue(); configService.setProperty(Preferences.TIMER, interval); } - - /** - * Implements the <tt>ConfigurationForm.getForm()</tt> method. Returns the - * component corresponding to this configuration form. - */ - public Object getForm() - { - return this; - } - - /** - * Implements the <tt>ConfigurationForm.getIcon()</tt> method. Returns the - * icon of this configuration form. - */ - public byte[] getIcon() - { - return AutoAwayActivator.getResources() - .getImageInBytes("plugin.autoaway.PLUGIN_ICON"); - } - - /** - * Implements the <tt>ConfigurationForm.getIndex()</tt> method. - */ - public int getIndex() - { - return -1; - } - - /** - * Implements the <tt>ConfigurationForm.getIcon()</tt> method. Returns the - * icon of this configuration form. - */ - public String getTitle() - { - return AutoAwayActivator.getResources() - .getI18NString("plugin.autoaway.AUTO_STATUS"); - } - } diff --git a/src/net/java/sip/communicator/plugin/contactinfo/ContactInfoDetailsPanel.java b/src/net/java/sip/communicator/plugin/contactinfo/ContactInfoDetailsPanel.java index 02f3dcf..ad71846 100644 --- a/src/net/java/sip/communicator/plugin/contactinfo/ContactInfoDetailsPanel.java +++ b/src/net/java/sip/communicator/plugin/contactinfo/ContactInfoDetailsPanel.java @@ -191,11 +191,10 @@ public class ContactInfoDetailsPanel );
}
else
- scaledImage = ImageUtils.getScaledRoundedImage(
- Resources.getImage("service.gui.DEFAULT_USER_PHOTO"),
- AVATAR_AREA_WIDTH,
- AVATAR_AREA_HEIGHT
- );
+ scaledImage =
+ ImageUtils.getScaledRoundedIcon(Resources
+ .getImage("service.gui.DEFAULT_USER_PHOTO"),
+ AVATAR_AREA_WIDTH, AVATAR_AREA_HEIGHT);
JLabel label = new JLabel(scaledImage);
label.setVerticalAlignment(JLabel.CENTER);
diff --git a/src/net/java/sip/communicator/plugin/generalconfig/GeneralConfigPluginActivator.java b/src/net/java/sip/communicator/plugin/generalconfig/GeneralConfigPluginActivator.java index 1eeea2d..94f870a 100644 --- a/src/net/java/sip/communicator/plugin/generalconfig/GeneralConfigPluginActivator.java +++ b/src/net/java/sip/communicator/plugin/generalconfig/GeneralConfigPluginActivator.java @@ -33,12 +33,14 @@ public class GeneralConfigPluginActivator implements BundleActivator ConfigurationManager.loadGuiConfigurations(); - GeneralConfigurationForm preferencesForm - = new GeneralConfigurationForm(); - - bundleContext.registerService( ConfigurationForm.class.getName(), - preferencesForm, - null); + bundleContext + .registerService( + ConfigurationForm.class.getName(), + new LazyConfigurationForm( + "net.java.sip.communicator.plugin.generalconfig.GeneralConfigurationPanel", + getClass().getClassLoader(), + "plugin.generalconfig.PLUGIN_ICON", "service.gui.GENERAL", + 0), null); logger.info("PREFERENCES PLUGIN... [REGISTERED]"); } diff --git a/src/net/java/sip/communicator/plugin/generalconfig/GeneralConfigurationForm.java b/src/net/java/sip/communicator/plugin/generalconfig/GeneralConfigurationPanel.java index 0519d78..31c4e10 100644 --- a/src/net/java/sip/communicator/plugin/generalconfig/GeneralConfigurationForm.java +++ b/src/net/java/sip/communicator/plugin/generalconfig/GeneralConfigurationPanel.java @@ -22,12 +22,11 @@ import com.izforge.izpack.util.os.*; /** * @author Yana Stamcheva */ -public class GeneralConfigurationForm - extends javax.swing.JPanel - implements ConfigurationForm, - ActionListener +public class GeneralConfigurationPanel + extends JPanel + implements ActionListener { - private Logger logger = Logger.getLogger(GeneralConfigurationForm.class); + private final Logger logger = Logger.getLogger(GeneralConfigurationPanel.class); private JPanel mainPanel; private JCheckBox bringToFrontCheckBox; @@ -43,9 +42,8 @@ public class GeneralConfigurationForm private JCheckBox showHistoryCheckBox; private JPanel logHistoryPanel; - public GeneralConfigurationForm() + public GeneralConfigurationPanel() { - super(); initGUI(); initDefaults(); } @@ -317,26 +315,6 @@ public class GeneralConfigurationForm return Resources.getSettingsString("service.gui.APPLICATION_NAME"); } - public Object getForm() - { - return this; - } - - public byte[] getIcon() - { - return Resources.getImage("plugin.generalconfig.PLUGIN_ICON"); - } - - public String getTitle() - { - return Resources.getString("service.gui.GENERAL"); - } - - public int getIndex() - { - return 0; - } - public void actionPerformed(ActionEvent event) { Object sourceObject = event.getSource(); diff --git a/src/net/java/sip/communicator/plugin/keybindingchooser/KeybindingChooserActivator.java b/src/net/java/sip/communicator/plugin/keybindingchooser/KeybindingChooserActivator.java index d22c29b..778fa9f 100644 --- a/src/net/java/sip/communicator/plugin/keybindingchooser/KeybindingChooserActivator.java +++ b/src/net/java/sip/communicator/plugin/keybindingchooser/KeybindingChooserActivator.java @@ -38,8 +38,14 @@ public class KeybindingChooserActivator logger.debug("Service Impl: " + getClass().getName() + " [ STARTED ]"); - context.registerService(ConfigurationForm.class.getName(), - new KeybindingsConfigForm(), null); + context + .registerService( + ConfigurationForm.class.getName(), + new LazyConfigurationForm( + "net.java.sip.communicator.plugin.keybindingchooser.KeybindingsConfigPanel", + getClass().getClassLoader(), + "plugin.keybinding.PLUGIN_ICON", + "plugin.keybindings.PLUGIN_NAME"), null); } /** diff --git a/src/net/java/sip/communicator/plugin/keybindingchooser/KeybindingsConfigForm.java b/src/net/java/sip/communicator/plugin/keybindingchooser/KeybindingsConfigForm.java deleted file mode 100644 index 323f88e..0000000 --- a/src/net/java/sip/communicator/plugin/keybindingchooser/KeybindingsConfigForm.java +++ /dev/null @@ -1,45 +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.plugin.keybindingchooser; - -import net.java.sip.communicator.service.gui.*; - -/** - * The <tt>ConfigurationForm</tt> that would be added to the settings - * configuration to configure the application keybindings. - * - * @author Damian Johnson - * @author Lubomir Marinov - */ -public class KeybindingsConfigForm - extends AbstractConfigurationForm -{ - /** - * Implements the <tt>ConfigurationForm.getTitle()</tt> method. Returns the - * title of this configuration form. - */ - public String getTitle() - { - return KeybindingChooserActivator.getResources().getI18NString( - "plugin.keybindings.PLUGIN_NAME"); - } - - /** - * Implements the <tt>ConfigurationForm.getIcon()</tt> method. Returns the - * icon of this configuration form. - */ - public byte[] getIcon() - { - return KeybindingChooserActivator.getResources().getImageInBytes( - "plugin.keybinding.PLUGIN_ICON"); - } - - protected String getFormClassName() - { - return "net.java.sip.communicator.plugin.keybindingchooser.KeybindingsConfigPanel"; - } -} diff --git a/src/net/java/sip/communicator/plugin/mailbox/MailboxActivator.java b/src/net/java/sip/communicator/plugin/mailbox/MailboxActivator.java index 2903215..9834916 100644 --- a/src/net/java/sip/communicator/plugin/mailbox/MailboxActivator.java +++ b/src/net/java/sip/communicator/plugin/mailbox/MailboxActivator.java @@ -23,7 +23,7 @@ import net.java.sip.communicator.util.*; public class MailboxActivator implements BundleActivator { - private static Logger logger = + private static final Logger logger = Logger.getLogger(BundleActivator.class); /** @@ -74,12 +74,13 @@ public class MailboxActivator mailbox = new Mailbox(); mailbox.start(bundleContext); - MailboxConfigurationForm mailboxForm - = new MailboxConfigurationForm(); - - bundleContext.registerService( ConfigurationForm.class.getName(), - mailboxForm, - null); + bundleContext + .registerService( + ConfigurationForm.class.getName(), + new LazyConfigurationForm( + "net.java.sip.communicator.plugin.mailbox.MailboxConfigurationPanel", + getClass().getClassLoader(), "plugin.mailbox.PLUGIN_ICON", + "plugin.mailbox.MAILBOX"), null); logger.info("Mailbox plug-in...[STARTED]"); } diff --git a/src/net/java/sip/communicator/plugin/mailbox/MailboxConfigurationForm.java b/src/net/java/sip/communicator/plugin/mailbox/MailboxConfigurationPanel.java index bfdd83c..48aeaa7 100644 --- a/src/net/java/sip/communicator/plugin/mailbox/MailboxConfigurationForm.java +++ b/src/net/java/sip/communicator/plugin/mailbox/MailboxConfigurationPanel.java @@ -13,19 +13,18 @@ import java.io.*; import javax.swing.*; import net.java.sip.communicator.service.configuration.*; -import net.java.sip.communicator.service.gui.*; - import net.java.sip.communicator.util.swing.*; /** * The <tt>ConfigurationForm</tt> that would be added in the user interface - * configuration window. It allows the user to change parameters in the - * mailbox configuration + * configuration window. It allows the user to change parameters in the mailbox + * configuration + * * @author Ryan Ricard */ -public class MailboxConfigurationForm +public class MailboxConfigurationPanel extends TransparentPanel - implements ConfigurationForm, ActionListener + implements ActionListener { private JLabel jlblOutgoingMessage = new JLabel(Resources.getString("plugin.mailbox.OUTGOING")); @@ -85,10 +84,10 @@ public class MailboxConfigurationForm private JPanel jpConfirmDefault = new TransparentPanel(); ConfigurationService config; - public MailboxConfigurationForm() + public MailboxConfigurationPanel() { - super(new GridLayout(5,1)); + config = MailboxActivator.getConfigurationService(); //get our outgoing file panel set up jtfOutgoingMessage.setText(Mailbox.getOutgoingMessageFileLocation() @@ -220,36 +219,4 @@ public class MailboxConfigurationForm } } - - /** - * Implements the <tt>ConfigurationForm.getTitle()</tt> method. Returns the - * title of this configuration form. - */ - public String getTitle() - { - return Resources.getString("plugin.mailbox.MAILBOX"); - } - - /** - * Implements the <tt>ConfigurationForm.getIcon()</tt> method. Returns the - * icon of this configuration form. - */ - public byte[] getIcon() - { - return Resources.getImageInBytes("plugin.mailbox.PLUGIN_ICON"); - } - - /** - * Implements the <tt>ConfigurationForm.getForm()</tt> method. Returns the - * component corresponding to this configuration form. - */ - public Object getForm() - { - return this; - } - - public int getIndex() - { - return -1; - } -}
\ No newline at end of file +} diff --git a/src/net/java/sip/communicator/plugin/notificationconfiguration/NotificationConfigurationActivator.java b/src/net/java/sip/communicator/plugin/notificationconfiguration/NotificationConfigurationActivator.java index 8bdd004..05f468a 100644 --- a/src/net/java/sip/communicator/plugin/notificationconfiguration/NotificationConfigurationActivator.java +++ b/src/net/java/sip/communicator/plugin/notificationconfiguration/NotificationConfigurationActivator.java @@ -7,8 +7,8 @@ package net.java.sip.communicator.plugin.notificationconfiguration; import net.java.sip.communicator.service.audionotifier.*; -import net.java.sip.communicator.service.notification.*; import net.java.sip.communicator.service.gui.*; +import net.java.sip.communicator.service.notification.*; import net.java.sip.communicator.util.*; import org.osgi.framework.*; @@ -35,9 +35,14 @@ public class NotificationConfigurationActivator implements BundleActivator { bundleContext = bc; - bundleContext.registerService( ConfigurationForm.class.getName(), - new NotificationConfigurationForm(), - null); + bundleContext + .registerService( + ConfigurationForm.class.getName(), + new LazyConfigurationForm( + "net.java.sip.communicator.plugin.notificationconfiguration.NotificationConfigurationPanel", + getClass().getClassLoader(), + "plugin.notificationconfig.PLUGIN_ICON", + "service.gui.NOTIFICATIONS"), null); logger.trace("Notification Configuration: [ STARTED ]"); } diff --git a/src/net/java/sip/communicator/plugin/notificationconfiguration/NotificationConfigurationForm.java b/src/net/java/sip/communicator/plugin/notificationconfiguration/NotificationConfigurationForm.java deleted file mode 100644 index fae6a07..0000000 --- a/src/net/java/sip/communicator/plugin/notificationconfiguration/NotificationConfigurationForm.java +++ /dev/null @@ -1,57 +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.plugin.notificationconfiguration; - -import net.java.sip.communicator.service.gui.*; - -/** - * Implements the <code>ConfigurationForm</code> interface in order to allow - * integrating the UI of this plug-in into the configuration UI. - * <p> - * The interface implementation in question is separated from the very UI - * implementation in order to allow the <code>ConfigurationForm</code> to be - * loaded at startup without creating and loading the very UI implementation. - * </p> - * - * @author Lubomir Marinov - */ -public class NotificationConfigurationForm - implements ConfigurationForm -{ - - /** - * Implements the <tt>ConfigurationForm.getForm()</tt> method. Returns the - * component corresponding to this configuration form. - */ - public Object getForm() - { - return new NotificationConfigurationPanel(); - } - - /** - * Implements the <tt>ConfigurationForm.getIcon()</tt> method. Returns the - * icon of this configuration form. - */ - public byte[] getIcon() - { - return Resources.getImageInBytes("plugin.notificationconfig.PLUGIN_ICON"); - } - - public int getIndex() - { - return -1; - } - - /** - * Implements the <tt>ConfigurationForm.getTitle()</tt> method. Returns the - * title of this configuration form. - */ - public String getTitle() - { - return Resources.getString("service.gui.NOTIFICATIONS"); - } -}
\ No newline at end of file diff --git a/src/net/java/sip/communicator/plugin/notificationconfiguration/NotificationConfigurationPanel.java b/src/net/java/sip/communicator/plugin/notificationconfiguration/NotificationConfigurationPanel.java index 72d93a4..c4e01b6 100644 --- a/src/net/java/sip/communicator/plugin/notificationconfiguration/NotificationConfigurationPanel.java +++ b/src/net/java/sip/communicator/plugin/notificationconfiguration/NotificationConfigurationPanel.java @@ -82,8 +82,6 @@ public class NotificationConfigurationPanel public NotificationConfigurationPanel() { - super(); - JPanel actions = new TransparentPanel(); GridBagLayout actionsLayout = new GridBagLayout(); JPanel applyPanel = new TransparentPanel(); diff --git a/src/net/java/sip/communicator/plugin/pluginmanager/PluginManagerActivator.java b/src/net/java/sip/communicator/plugin/pluginmanager/PluginManagerActivator.java index 8b41029..af2d081 100644 --- a/src/net/java/sip/communicator/plugin/pluginmanager/PluginManagerActivator.java +++ b/src/net/java/sip/communicator/plugin/pluginmanager/PluginManagerActivator.java @@ -33,10 +33,14 @@ public class PluginManagerActivator { bundleContext = bc; - PluginManagerConfigForm pluginManager = new PluginManagerConfigForm(); - - bundleContext.registerService(ConfigurationForm.class.getName(), - pluginManager, null); + bundleContext + .registerService( + ConfigurationForm.class.getName(), + new LazyConfigurationForm( + "net.java.sip.communicator.plugin.pluginmanager.PluginManagerPanel", + getClass().getClassLoader(), + "plugin.pluginmanager.PLUGIN_ICON", + "plugin.pluginmanager.PLUGINS"), null); } /** diff --git a/src/net/java/sip/communicator/plugin/pluginmanager/PluginManagerConfigForm.java b/src/net/java/sip/communicator/plugin/pluginmanager/PluginManagerConfigForm.java deleted file mode 100644 index 56ee79d..0000000 --- a/src/net/java/sip/communicator/plugin/pluginmanager/PluginManagerConfigForm.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * SIP Communicator, the OpenSource Java VoIP and Instant Messaging client. - * - * Distributable under LGPL license. - * See terms of license at gnu.org. - */ -package net.java.sip.communicator.plugin.pluginmanager; - -import net.java.sip.communicator.service.gui.*; - -/** - * The <tt>ConfigurationForm</tt> that would be added in the user interface - * configuration window. It contains a list of all installed plug-ins. Allows - * installing new plugins and managing the existing ones. - * - * @author Yana Stamcheva - * @author Lubomir Marinov - */ -public class PluginManagerConfigForm - extends AbstractConfigurationForm -{ - - /** - * Implements the <tt>ConfigurationForm.getTitle()</tt> method. Returns the - * title of this configuration form. - */ - public String getTitle() - { - return Resources.getString("plugin.pluginmanager.PLUGINS"); - } - - /** - * Implements the <tt>ConfigurationForm.getIcon()</tt> method. Returns the - * icon of this configuration form. - */ - public byte[] getIcon() - { - return Resources.getResources().getImageInBytes( - "plugin.pluginmanager.PLUGIN_ICON"); - } - - protected String getFormClassName() - { - return "net.java.sip.communicator.plugin.pluginmanager.PluginManagerPanel"; - } -} diff --git a/src/net/java/sip/communicator/plugin/simpleaccreg/InitialAccountRegistrationFrame.java b/src/net/java/sip/communicator/plugin/simpleaccreg/InitialAccountRegistrationFrame.java index afe47ec..29afc33 100644 --- a/src/net/java/sip/communicator/plugin/simpleaccreg/InitialAccountRegistrationFrame.java +++ b/src/net/java/sip/communicator/plugin/simpleaccreg/InitialAccountRegistrationFrame.java @@ -29,6 +29,7 @@ import org.osgi.framework.*; * accounts are found. * * @author Yana Stamcheva + * @author Lubomir Marinov */ public class InitialAccountRegistrationFrame extends JFrame @@ -179,10 +180,9 @@ public class InitialAccountRegistrationFrame } } - private class AccountRegistrationPanel extends JPanel + private class AccountRegistrationPanel + extends JPanel { - private JLabel protocolLabel = new JLabel(); - private JLabel usernameLabel = new JLabel(Resources.getString("service.gui.LOGIN")); @@ -204,20 +204,8 @@ public class InitialAccountRegistrationFrame private JPanel iconDescriptionPanel = new JPanel(new BorderLayout()); - private JPanel inputRegisterPanel = new JPanel(new BorderLayout()); - private JTextArea descriptionArea = new JTextArea(); - private JLabel signupLabel - = new JLabel("<html><a href=''>" - + Resources.getString("plugin.simpleaccregwizz.SIGNUP") - + "</a></html>", JLabel.RIGHT); - - private JLabel specialSignupLabel - = new JLabel("<html><a href=''>" - + Resources.getString("plugin.simpleaccregwizz.SPECIAL_SIGNUP") - + "</a></html>", JLabel.RIGHT); - private final AccountRegistrationWizard wizard; public AccountRegistrationPanel( @@ -228,6 +216,9 @@ public class InitialAccountRegistrationFrame this.wizard = accountWizard; + JLabel protocolLabel = new JLabel(); + JPanel inputRegisterPanel = new JPanel(new BorderLayout()); + this.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); this.setPreferredSize(new Dimension(230, 150)); @@ -238,71 +229,54 @@ public class InitialAccountRegistrationFrame this.labelsPanel.setOpaque(false); this.fieldsPanel.setOpaque(false); this.emptyPanel.setOpaque(false); - this.inputRegisterPanel.setOpaque(false); + inputRegisterPanel.setOpaque(false); this.iconDescriptionPanel.setOpaque(false); this.add(inputRegisterPanel, BorderLayout.CENTER); - this.inputRegisterPanel.add(inputPanel, BorderLayout.NORTH); + inputRegisterPanel.add(inputPanel, BorderLayout.NORTH); if (wizard.isWebSignupSupported()) { - if (isPreferredWizard) + String textKey = + isPreferredWizard ? "plugin.simpleaccregwizz.SPECIAL_SIGNUP" + : "plugin.simpleaccregwizz.SIGNUP"; + JLabel signupLabel = + new JLabel("<html><a href=''>" + + Resources.getString(textKey) + "</a></html>", + JLabel.RIGHT); + + signupLabel.setFont(signupLabel.getFont().deriveFont(10f)); + signupLabel.addMouseListener(new MouseAdapter() { - this.inputRegisterPanel.add( - specialSignupLabel, BorderLayout.SOUTH); - } - else - { - this.inputRegisterPanel.add( - signupLabel, BorderLayout.SOUTH); - } - } - - this.inputPanel.add(labelsPanel, BorderLayout.WEST); - - this.inputPanel.add(fieldsPanel, BorderLayout.CENTER); - - this.iconDescriptionPanel.add( - protocolLabel, BorderLayout.NORTH); - - this.signupLabel.setFont(signupLabel.getFont().deriveFont(10f)); - this.signupLabel.addMouseListener(new MouseAdapter() - { - public void mousePressed(MouseEvent arg0) + public void mousePressed(MouseEvent e) { try { wizard.webSignup(); } - catch (UnsupportedOperationException e) + catch (UnsupportedOperationException ex) { // This should not happen, because we check if the - // operation is supported, before adding the sign up. - logger.error("The web sign up is not supported.", e); + // operation is supported, before adding the sign + // up. + logger.error("The web sign up is not supported.", + ex); } } }); - this.specialSignupLabel.setFont(signupLabel.getFont().deriveFont(10f)); - this.specialSignupLabel.addMouseListener(new MouseAdapter() - { - public void mousePressed(MouseEvent arg0) - { - try - { - wizard.webSignup(); - } - catch (UnsupportedOperationException e) - { - // This should not happen, because we check if the - // operation is supported, before adding the sign up. - logger.error("The web sign up is not supported.", e); - } - } - }); + inputRegisterPanel.add(signupLabel, BorderLayout.SOUTH); + } + + this.inputPanel.add(labelsPanel, BorderLayout.WEST); + + this.inputPanel.add(fieldsPanel, BorderLayout.CENTER); + + this.iconDescriptionPanel.add( + protocolLabel, BorderLayout.NORTH); - this.protocolLabel.setFont( + protocolLabel.setFont( protocolLabel.getFont().deriveFont(Font.BOLD, 14f)); this.usernameExampleLabel.setForeground(Color.DARK_GRAY); this.usernameExampleLabel.setFont( @@ -319,7 +293,7 @@ public class InitialAccountRegistrationFrame this.usernameExampleLabel.setText(wizard.getUserNameExample()); - this.protocolLabel.setText(wizard.getProtocolName()); + protocolLabel.setText(wizard.getProtocolName()); Image image = null; try @@ -418,7 +392,7 @@ public class InitialAccountRegistrationFrame if (event.getType() == ServiceEvent.REGISTERED) { - this.addAccountRegistrationForm(wizard); + this.addAccountRegistrationForm(wizard); } } diff --git a/src/net/java/sip/communicator/service/gui/AbstractConfigurationForm.java b/src/net/java/sip/communicator/service/gui/AbstractConfigurationForm.java deleted file mode 100644 index d4213d6..0000000 --- a/src/net/java/sip/communicator/service/gui/AbstractConfigurationForm.java +++ /dev/null @@ -1,45 +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.service.gui;
-
-import java.lang.reflect.*;
-
-/**
- * @author Lubomir Marinov
- */
-public abstract class AbstractConfigurationForm
- implements ConfigurationForm
-{
- public Object getForm()
- {
- Exception exception;
- try
- {
- return Class.forName(getFormClassName(), true,
- getClass().getClassLoader()).newInstance();
- }
- catch (ClassNotFoundException ex)
- {
- exception = ex;
- }
- catch (IllegalAccessException ex)
- {
- exception = ex;
- }
- catch (InstantiationException ex)
- {
- exception = ex;
- }
- throw new UndeclaredThrowableException(exception);
- }
-
- protected abstract String getFormClassName();
-
- public int getIndex()
- {
- return -1;
- }
-}
diff --git a/src/net/java/sip/communicator/service/gui/ExportedWindow.java b/src/net/java/sip/communicator/service/gui/ExportedWindow.java index c2a4080..87b9168 100644 --- a/src/net/java/sip/communicator/service/gui/ExportedWindow.java +++ b/src/net/java/sip/communicator/service/gui/ExportedWindow.java @@ -27,9 +27,6 @@ public interface ExportedWindow public static final WindowID CHAT_WINDOW = new WindowID("ChatWindow"); - public static final WindowID CONFIGURATION_WINDOW - = new WindowID("ConfigurationWindow"); - public static final WindowID AUTHENTICATION_WINDOW = new WindowID("AuthenticationWindow"); diff --git a/src/net/java/sip/communicator/service/gui/LazyConfigurationForm.java b/src/net/java/sip/communicator/service/gui/LazyConfigurationForm.java new file mode 100644 index 0000000..86ba615 --- /dev/null +++ b/src/net/java/sip/communicator/service/gui/LazyConfigurationForm.java @@ -0,0 +1,114 @@ +/*
+ * 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.service.gui;
+
+import java.lang.reflect.*;
+
+import net.java.sip.communicator.service.gui.internal.*;
+import net.java.sip.communicator.service.resources.*;
+
+/**
+ * @author Lubomir Marinov
+ */
+public class LazyConfigurationForm
+ implements ConfigurationForm
+{
+ private static ResourceManagementService resources;
+
+ private static ResourceManagementService getResources()
+ {
+ if (resources == null)
+ resources =
+ ResourceManagementServiceUtils.getService(GuiServiceActivator
+ .getBundleContext());
+ return resources;
+ }
+
+ private final ClassLoader formClassLoader;
+
+ private final String formClassName;
+
+ private final String iconID;
+
+ private final int index;
+
+ private final String titleID;
+
+ public LazyConfigurationForm(String formClassName,
+ ClassLoader formClassLoader, String iconID, String titleID)
+ {
+ this(formClassName, formClassLoader, iconID, titleID, -1);
+ }
+
+ public LazyConfigurationForm(String formClassName,
+ ClassLoader formClassLoader, String iconID, String titleID, int index)
+ {
+ this.formClassName = formClassName;
+ this.formClassLoader = formClassLoader;
+ this.iconID = iconID;
+ this.titleID = titleID;
+ this.index = index;
+ }
+
+ public Object getForm()
+ {
+ Exception exception;
+ try
+ {
+ return Class
+ .forName(getFormClassName(), true, getFormClassLoader())
+ .newInstance();
+ }
+ catch (ClassNotFoundException ex)
+ {
+ exception = ex;
+ }
+ catch (IllegalAccessException ex)
+ {
+ exception = ex;
+ }
+ catch (InstantiationException ex)
+ {
+ exception = ex;
+ }
+ throw new UndeclaredThrowableException(exception);
+ }
+
+ protected ClassLoader getFormClassLoader()
+ {
+ return formClassLoader;
+ }
+
+ protected String getFormClassName()
+ {
+ return formClassName;
+ }
+
+ public byte[] getIcon()
+ {
+ return getResources().getImageInBytes(getIconID());
+ }
+
+ protected String getIconID()
+ {
+ return iconID;
+ }
+
+ public int getIndex()
+ {
+ return index;
+ }
+
+ public String getTitle()
+ {
+ return getResources().getI18NString(getTitleID());
+ }
+
+ protected String getTitleID()
+ {
+ return titleID;
+ }
+}
diff --git a/src/net/java/sip/communicator/service/gui/UIService.java b/src/net/java/sip/communicator/service/gui/UIService.java index 4120012..01ea702 100644 --- a/src/net/java/sip/communicator/service/gui/UIService.java +++ b/src/net/java/sip/communicator/service/gui/UIService.java @@ -333,4 +333,6 @@ public interface UIService public boolean useMacOSXScreenMenuBar(); public void beginShutdown(); + + public void setConfigurationWindowVisible(boolean visible); } diff --git a/src/net/java/sip/communicator/service/gui/gui.manifest.mf b/src/net/java/sip/communicator/service/gui/gui.manifest.mf index 798546d..2ee336a 100644 --- a/src/net/java/sip/communicator/service/gui/gui.manifest.mf +++ b/src/net/java/sip/communicator/service/gui/gui.manifest.mf @@ -1,7 +1,10 @@ +Bundle-Activator: net.java.sip.communicator.service.gui.internal.GuiServiceActivator Bundle-Name: UI Service Bundle-Description: The User Interface Service. Bundle-Vendor: sip-communicator.org Bundle-Version: 0.0.1 System-Bundle: yes +Import-Package: org.osgi.framework, + net.java.sip.communicator.service.resources Export-Package: net.java.sip.communicator.service.gui, net.java.sip.communicator.service.gui.event diff --git a/src/net/java/sip/communicator/service/gui/internal/GuiServiceActivator.java b/src/net/java/sip/communicator/service/gui/internal/GuiServiceActivator.java new file mode 100644 index 0000000..e9d9fe0 --- /dev/null +++ b/src/net/java/sip/communicator/service/gui/internal/GuiServiceActivator.java @@ -0,0 +1,33 @@ +/*
+ * 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.service.gui.internal;
+
+import org.osgi.framework.*;
+
+/**
+ * @author Lubomir Marinov
+ */
+public class GuiServiceActivator
+ implements BundleActivator
+{
+ private static BundleContext bundleContext;
+
+ public static BundleContext getBundleContext()
+ {
+ return bundleContext;
+ }
+
+ public void start(BundleContext bundleContext)
+ {
+ GuiServiceActivator.bundleContext = bundleContext;
+ }
+
+ public void stop(BundleContext bundleContext)
+ {
+ if (GuiServiceActivator.bundleContext == bundleContext)
+ GuiServiceActivator.bundleContext = null;
+ }
+}
diff --git a/src/net/java/sip/communicator/util/ImageUtils.java b/src/net/java/sip/communicator/util/ImageUtils.java index 0424ba1..ca75768 100644 --- a/src/net/java/sip/communicator/util/ImageUtils.java +++ b/src/net/java/sip/communicator/util/ImageUtils.java @@ -20,22 +20,23 @@ import net.java.sip.communicator.util.swing.*; * * @author Sebastien Mazy * @author Yana Stamcheva + * @author Lubomir Marinov */ public class ImageUtils { private static final Logger logger = Logger.getLogger(ImageUtils.class); /** - * Returns a scaled image fitting within the given bounds - * while keeping the aspect ratio. - * + * Returns a scaled image fitting within the given bounds while keeping the + * aspect ratio. + * * @param image the image to scale * @param width maximum width of the scaled image * @param height maximum height of the scaled image * @return the scaled image */ - public static ImageIcon - scaleIconWithinBounds(Image image, int width, int height) + public static Image scaleImageWithinBounds(Image image, int width, + int height) { Image scaledImage; int scaleHint = Image.SCALE_SMOOTH; @@ -51,8 +52,13 @@ public class ImageUtils { scaledImage = image.getScaledInstance(-1, height, scaleHint); } + return scaledImage; + } - return new ImageIcon(scaledImage); + public static ImageIcon scaleIconWithinBounds(Image image, int width, + int height) + { + return new ImageIcon(scaleImageWithinBounds(image, width, height)); } /** @@ -62,20 +68,16 @@ public class ImageUtils * * @return The rounded corner image. */ - public static ImageIcon getScaledRoundedImage( Image image, - int width, - int height) + public static Image getScaledRoundedImage(Image image, int width, int height) { - BufferedImage destImage = null; - - ImageIcon scaledImage = ImageUtils.scaleIconWithinBounds( image, - width, - height); + ImageIcon scaledImage = + ImageUtils.scaleIconWithinBounds(image, width, height); + int scaledImageWidth = scaledImage.getIconWidth(); + int scaledImageHeight = scaledImage.getIconHeight(); - destImage - = new BufferedImage(scaledImage.getImage().getWidth(null), - scaledImage.getImage().getHeight(null), - BufferedImage.TYPE_INT_ARGB); + BufferedImage destImage = + new BufferedImage(scaledImageWidth, scaledImageHeight, + BufferedImage.TYPE_INT_ARGB); Graphics2D g = destImage.createGraphics(); @@ -84,8 +86,7 @@ public class ImageUtils AntialiasingManager.activateAntialiasing(g); g.setColor(Color.WHITE); - g.fillRoundRect(0, 0, scaledImage.getIconWidth(), scaledImage - .getIconHeight(), 10, 10); + g.fillRoundRect(0, 0, scaledImageWidth, scaledImageHeight, 10, 10); g.setComposite(AlphaComposite.SrcIn); g.drawImage(scaledImage.getImage(), 0, 0, null); @@ -94,8 +95,13 @@ public class ImageUtils { g.dispose(); } + return destImage; + } - return new ImageIcon(destImage); + public static ImageIcon getScaledRoundedIcon(Image image, int width, + int height) + { + return new ImageIcon(getScaledRoundedImage(image, width, height)); } /** @@ -121,7 +127,7 @@ public class ImageUtils InputStream in = new ByteArrayInputStream(imageBytes); BufferedImage image = ImageIO.read(in); - imageIcon = getScaledRoundedImage(image, width, height); + imageIcon = getScaledRoundedIcon(image, width, height); } catch (Exception e) { |