- 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.
cusax-fix
Lyubomir Marinov 17 years ago
parent 3c911f558f
commit 2e83c45aa2

@ -206,8 +206,8 @@
<!-- Import installation build xml -->
<import file="${inst.resrc}/build.xml"/>
<!-- default Ant target does nothing except print helpful options -->
<!-- Ant-external target will appear in -projecthelp output -->
<!-- default Ant target does nothing except print helpful options -->
<!-- Ant-external target will appear in -projecthelp output -->
<target name="ant-usage"
description="simply execute 'ant' to discover the most useful targets.">
<echo message="Useful ant commands for the SIP Communicator Project..." />

@ -130,8 +130,6 @@ public void loadApplicationGui()
this.wizardContainer = new AccountRegWizardContainerImpl(mainFrame);
this.configurationFrame = new ConfigurationFrame(mainFrame);
if (ConfigurationManager.isTransparentWindowEnabled())
{
try
@ -385,7 +383,6 @@ public boolean getExitOnMainWindowClose()
*/
public void initExportedWindows()
{
registerExportedWindow(configurationFrame);
registerExportedWindow(new AddContactWizardExportedWindow(mainFrame));
}
@ -984,4 +981,11 @@ public void beginShutdown()
}
}
}
public void setConfigurationWindowVisible(boolean visible)
{
if (configurationFrame == null)
configurationFrame = new ConfigurationFrame(mainFrame);
configurationFrame.setVisible(visible);
}
}

@ -22,15 +22,15 @@
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 FramedImage(int width, int height)
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);
}
}

@ -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");
}
}

@ -129,9 +129,9 @@ private void initCallLabel(JLabel callLabel)
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())
{

@ -492,10 +492,7 @@ else if (buttonText.equals("addContact"))
}
else if (buttonText.equalsIgnoreCase("settings"))
{
ExportedWindow configDialog = GuiActivator.getUIService()
.getExportedWindow(ExportedWindow.CONFIGURATION_WINDOW);
configDialog.setVisible(true);
GuiActivator.getUIService().setConfigurationWindowVisible(true);
}
}

@ -20,7 +20,6 @@
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 @@ else if (buttonText.equals("invite"))
}
else if (buttonText.equals("options"))
{
ExportedWindow optionsDialog = GuiActivator.getUIService()
.getExportedWindow(ExportedWindow.CONFIGURATION_WINDOW);
optionsDialog.setVisible(true);
GuiActivator.getUIService().setConfigurationWindowVisible(true);
}
}

@ -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 ImageIcon getConfigFormIcon()
*/
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;
}
/**

@ -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>

@ -12,7 +12,6 @@
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 @@
*/
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 ConfigurationFrame(MainFrame mainFrame)
{
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 ConfigurationFrame(MainFrame mainFrame)
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 ConfigurationFrame(MainFrame mainFrame)
*/
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));
}
/**
@ -161,24 +160,6 @@ public void setVisible(boolean isVisible)
super.setVisible(isVisible);
}
/**
* 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.
@ -190,36 +171,6 @@ protected void close(boolean isEscaped)
{
}
/**
* 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.
*/
@ -289,9 +240,4 @@ private void removeConfigurationForm(ConfigurationForm configForm)
{
this.configList.removeConfigForm(configForm);
}
/**
* Implementation of {@link ExportedWindow#setParams(Object[])}.
*/
public void setParams(Object[] windowParams) {}
}

@ -202,10 +202,7 @@ public void actionPerformed(ActionEvent e)
}
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"))
{

@ -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 void actionPerformed(ActionEvent arg0)
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 void componentHidden(ComponentEvent e)
*/
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 void valueChanged(ListSelectionEvent e)
{
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 void updateMuteButton(boolean isMute)
private class ToolBarButton
extends JLabel
{
private Image iconImage;
private boolean isMouseOver = false;
private boolean isMousePressed = false;
@ -554,10 +536,7 @@ public void mouseClicked(MouseEvent e)
}
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 @@ else if (buttonName.equals("info"))
(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());

@ -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 void actionPerformed(ActionEvent e)
void configActionPerformed()
{
ExportedWindow configDialog =
GuiActivator.getUIService().getExportedWindow(
ExportedWindow.CONFIGURATION_WINDOW);
configDialog.setVisible(true);
GuiActivator.getUIService().setConfigurationWindowVisible(true);
}
public void pluginComponentAdded(PluginComponentEvent event)

@ -28,12 +28,13 @@
*/
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.
@ -191,12 +192,6 @@ public class ImageLoader {
public static final ImageID DOWN_ARROW_ICON
= new ImageID("service.gui.icons.DOWN_ARROW_ICON");
/**
* 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>.
*/
@ -1088,7 +1083,7 @@ public static BufferedImage getImage(ImageID imageID)
if (loadedImages.containsKey(imageID))
{
image = (BufferedImage) loadedImages.get(imageID);
image = loadedImages.get(imageID);
}
else
{
@ -1192,9 +1187,7 @@ public static Image getBytesInImage(byte[] imageBytes)
*/
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 static BufferedImage[] getAnimatedImage(byte[] animatedImage)
*/
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
{

@ -8,7 +8,7 @@
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 void start(BundleContext context)
// 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);
}
/**

@ -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");
}
}

@ -300,7 +300,7 @@ public void registerCustomCodecs()
.getSupportedOutputFormats(null),
PlugInManager.CODEC);
logger.debug("Codec : " + className
+ " is succsefully registered : " + result);
+ " is successfully registered : " + result);
}
catch (Throwable ex)
{

@ -23,13 +23,11 @@
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 void start(BundleContext bc) throws Exception
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();

@ -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 @@ private void fireNotificationEventTypeEvent(String eventType,
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 void registerDefaultNotificationForEvent(
// 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 @@ else if (actionType.equals(NotificationService.ACTION_COMMAND))
// 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 @@ else if (actionType.equals(NotificationService.ACTION_COMMAND))
*/
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 void restoreDefaults()
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())
{

@ -18,15 +18,12 @@
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 @@ public void actionPerformed(ActionEvent event) {
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 @@ public void setPort(String port) {
this.portField.setText(port);
}
public int getIndex()
{
return -1;
}
protected void close(boolean isEscaped)
{
}

@ -47,11 +47,7 @@ private static void actionPerformed(ActionEvent evt)
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"))
{

@ -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 @@
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 void stop(BundleContext bc) throws Exception
* @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 static BrowserLauncherService getBrowserLauncher()
return browserLauncherService;
}
}
}

@ -10,7 +10,6 @@
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 @@
*
* @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 AccountInfoForm()
protocolProvider.addRegistrationStateChangeListener(
new RegistrationStateChangeListenerImpl());
this.accountsTabbedPane.addTab(
accountsTabbedPane.addTab(
accountID.getUserID(), detailsPanel);
}
}
@ -98,36 +78,6 @@ public 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 void registrationStateChanged(RegistrationStateChangeEvent evt)
}
}
}
public int getIndex()
{
return -1;
}
}
}

@ -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()
{

@ -14,7 +14,6 @@
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 @@
*
* @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 @@ private void saveData()
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");
}
}

@ -191,11 +191,10 @@ private JPanel createSummaryInfoPanel()
);
}
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);

@ -33,12 +33,14 @@ public void start(BundleContext bc) throws Exception
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]");
}

@ -22,12 +22,11 @@
/**
* @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 @@ private String getApplicationName()
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();

@ -38,8 +38,14 @@ public void start(BundleContext context)
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);
}
/**

@ -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";
}
}

@ -23,7 +23,7 @@
public class MailboxActivator
implements BundleActivator
{
private static Logger logger =
private static final Logger logger =
Logger.getLogger(BundleActivator.class);
/**
@ -74,12 +74,13 @@ public void start(BundleContext bundleContext) throws Exception
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]");
}

@ -13,19 +13,18 @@
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 @@ else if (e.getSource() == jbtnDefault)
}
}
/**
* 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;
}
}
}

@ -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 void start(BundleContext bc) throws Exception
{
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 ]");
}

@ -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");
}
}

@ -82,8 +82,6 @@ public class NotificationConfigurationPanel
public NotificationConfigurationPanel()
{
super();
JPanel actions = new TransparentPanel();
GridBagLayout actionsLayout = new GridBagLayout();
JPanel applyPanel = new TransparentPanel();

@ -33,10 +33,14 @@ public void start(BundleContext bc) throws Exception
{
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);
}
/**

@ -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";
}
}

@ -29,6 +29,7 @@
* accounts are found.
*
* @author Yana Stamcheva
* @author Lubomir Marinov
*/
public class InitialAccountRegistrationFrame
extends JFrame
@ -179,10 +180,9 @@ private void initAccountWizards()
}
}
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 @@ private class AccountRegistrationPanel extends JPanel
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 AccountRegistrationPanel(
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 AccountRegistrationPanel(
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 void mousePressed(MouseEvent arg0)
this.usernameExampleLabel.setText(wizard.getUserNameExample());
this.protocolLabel.setText(wizard.getProtocolName());
protocolLabel.setText(wizard.getProtocolName());
Image image = null;
try
@ -418,7 +392,7 @@ public void serviceChanged(ServiceEvent event)
if (event.getType() == ServiceEvent.REGISTERED)
{
this.addAccountRegistrationForm(wizard);
this.addAccountRegistrationForm(wizard);
}
}

@ -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;
}
}

@ -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");

@ -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;
}
}

@ -333,4 +333,6 @@ public SecurityAuthority getDefaultSecurityAuthority(
public boolean useMacOSXScreenMenuBar();
public void beginShutdown();
public void setConfigurationWindowVisible(boolean visible);
}

@ -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

@ -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;
}
}

@ -20,22 +20,23 @@
*
* @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 static ImageIcon getScaledRoundedImage( Image image,
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 static ImageIcon getScaledRoundedImage( Image image,
{
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 static ImageIcon getScaledRoundedImage( byte[] imageBytes,
InputStream in = new ByteArrayInputStream(imageBytes);
BufferedImage image = ImageIO.read(in);
imageIcon = getScaledRoundedImage(image, width, height);
imageIcon = getScaledRoundedIcon(image, width, height);
}
catch (Exception e)
{

Loading…
Cancel
Save