diff options
author | Yana Stamcheva <yana@jitsi.org> | 2012-11-21 14:56:12 +0000 |
---|---|---|
committer | Yana Stamcheva <yana@jitsi.org> | 2012-11-21 14:56:12 +0000 |
commit | f87c4cf9ba1685942e1ee170b45359f8918ecf66 (patch) | |
tree | d12b8d74435adc400cbbb23ae1b97c22bd4314eb /src/net/java/sip/communicator/plugin/generalconfig | |
parent | 4f3d81f0ccdecc7528114f7470a0c2749a908982 (diff) | |
download | jitsi-f87c4cf9ba1685942e1ee170b45359f8918ecf66.zip jitsi-f87c4cf9ba1685942e1ee170b45359f8918ecf66.tar.gz jitsi-f87c4cf9ba1685942e1ee170b45359f8918ecf66.tar.bz2 |
Removes the ConfigurationManager-s from impl.gui and plugin.generalconfig packages and create a NotificationUtils class that manages all common configuration properties and is accessible through the util package.
Diffstat (limited to 'src/net/java/sip/communicator/plugin/generalconfig')
4 files changed, 38 insertions, 757 deletions
diff --git a/src/net/java/sip/communicator/plugin/generalconfig/ConfigurationManager.java b/src/net/java/sip/communicator/plugin/generalconfig/ConfigurationManager.java deleted file mode 100644 index 847a13a..0000000 --- a/src/net/java/sip/communicator/plugin/generalconfig/ConfigurationManager.java +++ /dev/null @@ -1,721 +0,0 @@ -/* - * Jitsi, 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.generalconfig; - -import java.io.*; -import java.util.*; - -import javax.net.ssl.*; - -import net.java.sip.communicator.service.protocol.*; -import net.java.sip.communicator.service.resources.*; -import net.java.sip.communicator.util.Logger; - -import org.jitsi.service.configuration.*; -import org.jitsi.service.resources.*; -import org.jitsi.util.*; - -public class ConfigurationManager -{ - private static final Logger logger - = Logger.getLogger(ConfigurationManager.class); - - public static final String ENTER_COMMAND = "Enter"; - - public static final String CTRL_ENTER_COMMAND = "Ctrl-Enter"; - - /** - * Indicates whether the message automatic popup is enabled. - */ - private static boolean autoPopupNewMessage; - - private static String sendMessageCommand; - - private static boolean isSendTypingNotifications; - - private static boolean isMultiChatWindowEnabled; - - private static boolean isLeaveChatRoomOnWindowCloseEnabled; - - private static boolean isHistoryLoggingEnabled; - - private static boolean isHistoryShown; - - private static int chatHistorySize; - - private static int windowTransparency; - - private static boolean isTransparentWindowEnabled; - - /** - * Indicates if phone numbers should be normalized before dialed. - */ - private static boolean isNormalizePhoneNumber; - - /** - * Indicates if a string containing alphabetical characters might be - * considered as a phone number. - */ - private static boolean acceptPhoneNumberWithAlphaChars; - - private static ConfigurationService configService - = GeneralConfigPluginActivator.getConfigurationService(); - - /** - * - */ - public static void loadGuiConfigurations() - { - // Load the "auPopupNewMessage" property. - String autoPopupProperty = - "service.gui.AUTO_POPUP_NEW_MESSAGE"; - - String autoPopup = configService.getString(autoPopupProperty); - - if(autoPopup == null) - autoPopup = Resources.getSettingsString(autoPopupProperty); - - if(autoPopup != null && autoPopup.equalsIgnoreCase("yes")) - autoPopupNewMessage = true; - - // Load the "sendMessageCommand" property. - String messageCommandProperty = - "service.gui.SEND_MESSAGE_COMMAND"; - String messageCommand = configService.getString(messageCommandProperty); - - if(messageCommand == null) - messageCommand = - Resources.getSettingsString(messageCommandProperty); - - if(messageCommand != null && messageCommand.length() > 0) - { - sendMessageCommand = messageCommand; - } - - // Load the "sendTypingNotifications" property. - String isSendTypingNotifProperty = - "service.gui.SEND_TYPING_NOTIFICATIONS_ENABLED"; - String isSendTypingNotif = - configService.getString(isSendTypingNotifProperty); - - if(isSendTypingNotif == null) - isSendTypingNotif = - Resources.getSettingsString(isSendTypingNotifProperty); - - if(isSendTypingNotif != null && isSendTypingNotif.length() > 0) - { - isSendTypingNotifications - = new Boolean(isSendTypingNotif).booleanValue(); - } - - // Load the "isLeaveChatroomOnWindowCloseEnabled" property. - String isLeaveChatRoomOnWindowCloseEnabledStringProperty - = "service.gui.LEAVE_CHATROOM_ON_WINDOW_CLOSE"; - - String isLeaveChatRoomOnWindowCloseEnabledString - = configService.getString(isLeaveChatRoomOnWindowCloseEnabledStringProperty); - - if(isLeaveChatRoomOnWindowCloseEnabledString == null) - isLeaveChatRoomOnWindowCloseEnabledString = - Resources. - getSettingsString(isLeaveChatRoomOnWindowCloseEnabledStringProperty); - - if(isLeaveChatRoomOnWindowCloseEnabledString != null - && isLeaveChatRoomOnWindowCloseEnabledString.length() > 0) - { - isLeaveChatRoomOnWindowCloseEnabled - = new Boolean(isLeaveChatRoomOnWindowCloseEnabledString) - .booleanValue(); - } - - // Load the "isMultiChatWindowEnabled" property. - String isMultiChatWindowEnabledStringProperty - = "service.gui.IS_MULTI_CHAT_WINDOW_ENABLED"; - - String isMultiChatWindowEnabledString - = configService.getString(isMultiChatWindowEnabledStringProperty); - - if(isMultiChatWindowEnabledString == null) - isMultiChatWindowEnabledString = - Resources. - getSettingsString(isMultiChatWindowEnabledStringProperty); - - if(isMultiChatWindowEnabledString != null - && isMultiChatWindowEnabledString.length() > 0) - { - isMultiChatWindowEnabled - = new Boolean(isMultiChatWindowEnabledString) - .booleanValue(); - } - - // Load the "isHistoryLoggingEnabled" property. - String isHistoryLoggingEnabledPropertyString = - "impl.msghistory.IS_MESSAGE_HISTORY_ENABLED"; - - String isHistoryLoggingEnabledString - = configService.getString( - isHistoryLoggingEnabledPropertyString); - - if(isHistoryLoggingEnabledString == null) - isHistoryLoggingEnabledString = - Resources. - getSettingsString(isHistoryLoggingEnabledPropertyString); - - if(isHistoryLoggingEnabledString != null - && isHistoryLoggingEnabledString.length() > 0) - { - isHistoryLoggingEnabled - = new Boolean(isHistoryLoggingEnabledString) - .booleanValue(); - } - - // Load the "isHistoryShown" property. - String isHistoryShownStringProperty = - "service.gui.IS_MESSAGE_HISTORY_SHOWN"; - - String isHistoryShownString - = configService.getString(isHistoryShownStringProperty); - - if(isHistoryShownString == null) - isHistoryShownString = - Resources.getSettingsString(isHistoryShownStringProperty); - - if(isHistoryShownString != null - && isHistoryShownString.length() > 0) - { - isHistoryShown - = new Boolean(isHistoryShownString) - .booleanValue(); - } - - // Load the "chatHistorySize" property. - String chatHistorySizeStringProperty = - "service.gui.MESSAGE_HISTORY_SIZE"; - String chatHistorySizeString - = configService.getString(chatHistorySizeStringProperty); - - if(chatHistorySizeString == null) - chatHistorySizeString = - Resources.getSettingsString(chatHistorySizeStringProperty); - - if(chatHistorySizeString != null - && chatHistorySizeString.length() > 0) - { - chatHistorySize - = Integer.parseInt(chatHistorySizeString); - } - - // Load the "isTransparentWindowEnabled" property. - String isTransparentWindowEnabledProperty = - "impl.gui.IS_TRANSPARENT_WINDOW_ENABLED"; - - String isTransparentWindowEnabledString - = configService.getString(isTransparentWindowEnabledProperty); - - if(isTransparentWindowEnabledString == null) - isTransparentWindowEnabledString = - Resources.getSettingsString(isTransparentWindowEnabledProperty); - - if(isTransparentWindowEnabledString != null - && isTransparentWindowEnabledString.length() > 0) - { - isTransparentWindowEnabled - = new Boolean(isTransparentWindowEnabledString).booleanValue(); - } - - // Load the "windowTransparency" property. - String windowTransparencyProperty = - "impl.gui.WINDOW_TRANSPARENCY"; - - String windowTransparencyString - = configService.getString(windowTransparencyProperty); - - if(windowTransparencyString == null) - windowTransparencyString = - Resources.getSettingsString(windowTransparencyProperty); - - if(windowTransparencyString != null - && windowTransparencyString.length() > 0) - { - windowTransparency - = Integer.parseInt(windowTransparencyString); - } - - // Load the "NORMALIZE_PHONE_NUMBER" property. - String normalizePhoneNumberProperty = - "impl.gui.NORMALIZE_PHONE_NUMBER"; - - isNormalizePhoneNumber - = configService.getBoolean(normalizePhoneNumberProperty, true); - - // Load the "ACCEPT_PHONE_NUMBER_WITH_ALPHA_CHARS" property. - String acceptPhoneNumberWithAlphaCharsProperty = - "impl.gui.ACCEPT_PHONE_NUMBER_WITH_ALPHA_CHARS"; - - acceptPhoneNumberWithAlphaChars - = configService.getBoolean( - acceptPhoneNumberWithAlphaCharsProperty, - true); - } - - /** - * Return TRUE if "autoPopupNewMessage" property is true, otherwise - return - * FALSE. Indicates to the user interface whether new messages should be - * opened and bring to front. - * @return TRUE if "autoPopupNewMessage" property is true, otherwise - return - * FALSE. - */ - public static boolean isAutoPopupNewMessage() - { - return autoPopupNewMessage; - } - - /** - * Return TRUE if "sendTypingNotifications" property is true, otherwise - - * return FALSE. Indicates to the user interface whether typing - * notifications are enabled or disabled. - * @return TRUE if "sendTypingNotifications" property is true, otherwise - - * return FALSE. - */ - public static boolean isSendTypingNotifications() - { - return isSendTypingNotifications; - } - - /** - * Returns <code>true</code> if the "isMultiChatWindowEnabled" property is - * true, otherwise - returns <code>false</code>. Indicates to the user - * interface whether the chat window could contain multiple chats or just - * one chat. - * @return <code>true</code> if the "isMultiChatWindowEnabled" property is - * true, otherwise - returns <code>false</code>. - */ - public static boolean isMultiChatWindowEnabled() - { - return isMultiChatWindowEnabled; - } - - /** - * Returns <code>true</code> if the "isLeaveChatRoomOnWindowCloseEnabled" - * property is true, otherwise - returns <code>false</code>. Indicates to - * the user interface whether when closing the chat window we would leave - * the chat room. - * @return <code>true</code> if the "isLeaveChatRoomOnWindowCloseEnabled" - * property is true, otherwise - returns <code>false</code>. - */ - public static boolean isLeaveChatRoomOnWindowCloseEnabled() - { - return isLeaveChatRoomOnWindowCloseEnabled; - } - - /** - * Returns <code>true</code> if the "isHistoryLoggingEnabled" property is - * true, otherwise - returns <code>false</code>. Indicates to the user - * interface whether the history logging is enabled. - * @return <code>true</code> if the "isHistoryLoggingEnabled" property is - * true, otherwise - returns <code>false</code>. - */ - public static boolean isHistoryLoggingEnabled() - { - return isHistoryLoggingEnabled; - } - - /** - * Returns <code>true</code> if the "isHistoryShown" property is - * true, otherwise - returns <code>false</code>. Indicates to the user - * whether the history is shown in the chat window. - * @return <code>true</code> if the "isHistoryShown" property is - * true, otherwise - returns <code>false</code>. - */ - public static boolean isHistoryShown() - { - return isHistoryShown; - } - - /** - * Returns the number of messages from chat history that would be shown in - * the chat window. - * @return the number of messages from chat history that would be shown in - * the chat window. - */ - public static int getChatHistorySize() - { - return chatHistorySize; - } - - /** - * Return the "sendMessageCommand" property that was saved previously - * through the <tt>ConfigurationService</tt>. Indicates to the user - * interface whether the default send message command is Enter or CTRL-Enter. - * @return "Enter" or "CTRL-Enter" message commands. - */ - public static String getSendMessageCommand() - { - return sendMessageCommand; - } - - /** - * Gets the configuration handler which is currently in use. - * - * @return the configuration handler which is currently in use - */ - public static String getPopupHandlerConfig() - { - return (String) configService.getProperty("systray.POPUP_HANDLER"); - } - - /** - * Saves the popup handler choice made by the user. - * - * @param handler the handler which will be used - */ - public static void setPopupHandlerConfig(String handler) - { - configService.setProperty("systray.POPUP_HANDLER", handler); - } - - /** - * Returns <code>true</code> if transparent windows are enabled, - * <code>false</code> otherwise. - * - * @return <code>true</code> if transparent windows are enabled, - * <code>false</code> otherwise. - */ - public static boolean isTransparentWindowEnabled() - { - return isTransparentWindowEnabled; - } - - public static void setTransparentWindowEnabled( - boolean isTransparentWindowEnabled) - { - ConfigurationManager.isTransparentWindowEnabled = - isTransparentWindowEnabled; - - configService.setProperty( - "impl.gui.IS_TRANSPARENT_WINDOW_ENABLED", - new Boolean(isTransparentWindowEnabled).toString()); - } - - /** - * Returns <code>true</code> if phone numbers should be normalized, - * <code>false</code> otherwise. - * - * @return <code>true</code> if phone numbers should be normalized, - * <code>false</code> otherwise. - */ - public static boolean isNormalizePhoneNumber() - { - return isNormalizePhoneNumber; - } - - /** - * Updates the "NORMALIZE_PHONE_NUMBER" property. - * - * @param isNormalize indicates to the user interface whether all dialed - * phone numbers should be normalized - */ - public static void setNormalizePhoneNumber(boolean isNormalize) - { - ConfigurationManager.isNormalizePhoneNumber = isNormalize; - - configService.setProperty("impl.gui.NORMALIZE_PHONE_NUMBER", - Boolean.toString(isNormalize)); - } - - /** - * Returns <code>true</code> if a string with a alphabetical character migth - * be considered as a phone number. <code>false</code> otherwise. - * - * @return <code>true</code> if a string with a alphabetical character migth - * be considered as a phone number. <code>false</code> otherwise. - */ - public static boolean acceptPhoneNumberWithAlphaChars() - { - return acceptPhoneNumberWithAlphaChars; - } - - /** - * Updates the "ACCEPT_PHONE_NUMBER_WITH_CHARS" property. - * - * @param accepPhoneNumberWithAlphaChars indicates to the user interface - * whether a string with alphabetical characters might be accepted as a - * phone number. - */ - public static void setAcceptPhoneNumberWithAlphaChars( - boolean acceptPhoneNumberWithAlphaChars) - { - ConfigurationManager.acceptPhoneNumberWithAlphaChars - = acceptPhoneNumberWithAlphaChars; - - configService.setProperty( - "impl.gui.ACCEPT_PHONE_NUMBER_WITH_ALPHA_CHARS", - Boolean.toString(acceptPhoneNumberWithAlphaChars)); - } - - /** - * Returns the transparency value for all transparent windows. - * - * @return the transparency value for all transparent windows. - */ - public static int getWindowTransparency() - { - return windowTransparency; - } - - /** - * Updates the "WINDOW_TRANSPARENCY" property. - * - * @param windowTransparency indicates to the user interface what is the - * window transparency value - **/ - public static void setWindowTransparency(int windowTransparency) - { - ConfigurationManager.windowTransparency = windowTransparency; - - configService.setProperty( - "impl.gui.WINDOW_TRANSPARENCY", - Integer.toString(windowTransparency)); - } - - /** - * Updates the "autoPopupNewMessage" property. - * - * @param autoPopupNewMessage indicates to the user interface whether new - * messages should be opened and bring to front. - **/ - public static void setAutoPopupNewMessage(boolean autoPopupNewMessage) - { - ConfigurationManager.autoPopupNewMessage = autoPopupNewMessage; - - if(autoPopupNewMessage) - configService.setProperty( - "service.gui.AUTO_POPUP_NEW_MESSAGE", - "yes"); - else - configService.setProperty( - "service.gui.AUTO_POPUP_NEW_MESSAGE", - "no"); - } - - /** - * Updates the "sendTypingNotifications" property through the - * <tt>ConfigurationService</tt>. - * - * @param isSendTypingNotif <code>true</code> to indicate that typing - * notifications are enabled, <code>false</code> otherwise. - */ - public static void setSendTypingNotifications(boolean isSendTypingNotif) - { - isSendTypingNotifications = isSendTypingNotif; - - configService.setProperty( - "service.gui.SEND_TYPING_NOTIFICATIONS_ENABLED", - Boolean.toString(isSendTypingNotif)); - } - - /** - * Updates the "sendMessageCommand" property through the - * <tt>ConfigurationService</tt>. - * - * @param newMessageCommand the command used to send a message ( it could be - * ENTER_COMMAND or CTRL_ENTER_COMMAND) - */ - public static void setSendMessageCommand(String newMessageCommand) - { - sendMessageCommand = newMessageCommand; - - configService.setProperty( - "service.gui.SEND_MESSAGE_COMMAND", - newMessageCommand); - } - - /** - * Updates the "isMultiChatWindowEnabled" property through the - * <tt>ConfigurationService</tt>. - * - * @param isMultiChatWindowEnabled indicates if the chat window could - * contain multiple chats or only one chat. - */ - public static void setMultiChatWindowEnabled( - boolean isMultiChatWindowEnabled) - { - ConfigurationManager.isMultiChatWindowEnabled = isMultiChatWindowEnabled; - - configService.setProperty( - "service.gui.IS_MULTI_CHAT_WINDOW_ENABLED", - Boolean.toString(isMultiChatWindowEnabled)); - } - - /** - * Updates the "isLeaveChatroomOnWindowClose" property through - * the <tt>ConfigurationService</tt>. - * - * @param isLeaveChatroomOnWindowClose indicates whether - * to leave chat room on window close. - */ - public static void setLeaveChatRoomOnWindowClose( - boolean isLeaveChatroomOnWindowClose) - { - ConfigurationManager.isLeaveChatRoomOnWindowCloseEnabled - = isLeaveChatroomOnWindowClose; - - configService.setProperty( - "service.gui.LEAVE_CHATROOM_ON_WINDOW_CLOSE", - Boolean.toString(isLeaveChatroomOnWindowClose)); - } - /** - * Updates the "isHistoryLoggingEnabled" property through the - * <tt>ConfigurationService</tt>. - * - * @param isHistoryLoggingEnabled indicates if the history logging is - * enabled. - */ - public static void setHistoryLoggingEnabled( - boolean isHistoryLoggingEnabled) - { - ConfigurationManager.isHistoryLoggingEnabled = isHistoryLoggingEnabled; - - configService.setProperty( - "impl.msghistory.IS_MESSAGE_HISTORY_ENABLED", - Boolean.toString(isHistoryLoggingEnabled)); - } - - /** - * Updates the "isHistoryShown" property through the - * <tt>ConfigurationService</tt>. - * - * @param isHistoryShown indicates if the message history is - * shown - */ - public static void setHistoryShown(boolean isHistoryShown) - { - ConfigurationManager.isHistoryShown = isHistoryShown; - - configService.setProperty( - "service.gui.IS_MESSAGE_HISTORY_SHOWN", - Boolean.toString(isHistoryShown)); - } - - /** - * Updates the "chatHistorySize" property through the - * <tt>ConfigurationService</tt>. - * - * @param historySize indicates if the history logging is - * enabled. - */ - public static void setChatHistorySize(int historySize) - { - ConfigurationManager.chatHistorySize = historySize; - - configService.setProperty( - "service.gui.MESSAGE_HISTORY_SIZE", - Integer.toString(chatHistorySize)); - } - - public static Locale getCurrentLanguage() - { - String localeId - = configService.getString( - ResourceManagementService.DEFAULT_LOCALE_CONFIG); - - return - (localeId != null) - ? ResourceManagementServiceUtils.getLocale(localeId) - : Locale.getDefault(); - } - - public static void setLanguage(Locale locale) - { - String language = locale.getLanguage(); - String country = locale.getCountry(); - - configService.setProperty( - ResourceManagementService.DEFAULT_LOCALE_CONFIG, - (country.length() > 0) ? (language + '_' + country) : language); - } - - public static void setClientPort(int port) - { - configService.setProperty( - ProtocolProviderFactory.PREFERRED_CLEAR_PORT_PROPERTY_NAME, - port); - } - - public static void setClientSecurePort(int port) - { - configService.setProperty( - ProtocolProviderFactory.PREFERRED_SECURE_PORT_PROPERTY_NAME, - port); - } - - public static int getClientPort() - { - return configService.getInt( - ProtocolProviderFactory.PREFERRED_CLEAR_PORT_PROPERTY_NAME, - 5060); - } - - public static int getClientSecurePort() - { - return configService.getInt( - ProtocolProviderFactory.PREFERRED_SECURE_PORT_PROPERTY_NAME, - 5061); - } - - public static String[] getAvailableSslProtocols() - { - SSLSocket temp; - try - { - temp = (SSLSocket) SSLSocketFactory - .getDefault().createSocket(); - return temp.getSupportedProtocols(); - } - catch (IOException e) - { - logger.error(e); - return new String[]{}; - } - } - - public static String[] getEnabledSslProtocols() - { - String enabledSslProtocols = configService - .getString("gov.nist.javax.sip.TLS_CLIENT_PROTOCOLS"); - if(StringUtils.isNullOrEmpty(enabledSslProtocols, true)) - { - SSLSocket temp; - try - { - temp = (SSLSocket) SSLSocketFactory - .getDefault().createSocket(); - return temp.getEnabledProtocols(); - } - catch (IOException e) - { - logger.error(e); - return getAvailableSslProtocols(); - } - } - return enabledSslProtocols.split("(,)|(,\\s)"); - } - - public static void setEnabledSslProtocols(String[] enabledProtocols) - { - if(enabledProtocols == null || enabledProtocols.length == 0) - configService.removeProperty( - "gov.nist.javax.sip.TLS_CLIENT_PROTOCOLS"); - else - { - String protocols = Arrays.toString(enabledProtocols); - configService.setProperty( - "gov.nist.javax.sip.TLS_CLIENT_PROTOCOLS", - protocols.substring(1, protocols.length() - 1)); - } - } -} diff --git a/src/net/java/sip/communicator/plugin/generalconfig/GeneralConfigPluginActivator.java b/src/net/java/sip/communicator/plugin/generalconfig/GeneralConfigPluginActivator.java index 1e0a785..7960da7 100644 --- a/src/net/java/sip/communicator/plugin/generalconfig/GeneralConfigPluginActivator.java +++ b/src/net/java/sip/communicator/plugin/generalconfig/GeneralConfigPluginActivator.java @@ -103,7 +103,7 @@ public class GeneralConfigPluginActivator // If the general configuration form is disabled don't continue. if (!getConfigurationService().getBoolean(DISABLED_PROP, false)) { - ConfigurationManager.loadGuiConfigurations(); + ConfigurationUtils.loadGuiConfigurations(); properties.put( ConfigurationForm.FORM_TYPE, ConfigurationForm.GENERAL_TYPE); diff --git a/src/net/java/sip/communicator/plugin/generalconfig/GeneralConfigurationPanel.java b/src/net/java/sip/communicator/plugin/generalconfig/GeneralConfigurationPanel.java index eb20cd9..34b2ea5 100644 --- a/src/net/java/sip/communicator/plugin/generalconfig/GeneralConfigurationPanel.java +++ b/src/net/java/sip/communicator/plugin/generalconfig/GeneralConfigurationPanel.java @@ -17,6 +17,7 @@ import javax.swing.event.*; import net.java.sip.communicator.plugin.generalconfig.autoaway.*; import net.java.sip.communicator.service.systray.*; +import net.java.sip.communicator.util.*; import net.java.sip.communicator.util.Logger; import net.java.sip.communicator.util.swing.*; @@ -254,13 +255,13 @@ public class GeneralConfigurationPanel groupMessagesCheckBox.setAlignmentX(JCheckBox.LEFT_ALIGNMENT); groupMessagesCheckBox.setSelected( - ConfigurationManager.isMultiChatWindowEnabled()); + ConfigurationUtils.isMultiChatWindowEnabled()); groupMessagesCheckBox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { - ConfigurationManager.setMultiChatWindowEnabled( + ConfigurationUtils.setMultiChatWindowEnabled( groupMessagesCheckBox.isSelected()); } }); @@ -281,13 +282,13 @@ public class GeneralConfigurationPanel leaveChatroomCheckBox.setAlignmentX(JCheckBox.LEFT_ALIGNMENT); leaveChatroomCheckBox.setSelected( - ConfigurationManager.isLeaveChatRoomOnWindowCloseEnabled()); + ConfigurationUtils.isLeaveChatRoomOnWindowCloseEnabled()); leaveChatroomCheckBox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { - ConfigurationManager.setLeaveChatRoomOnWindowClose( + ConfigurationUtils.setLeaveChatRoomOnWindowClose( leaveChatroomCheckBox.isSelected()); } }); @@ -312,13 +313,13 @@ public class GeneralConfigurationPanel logHistoryCheckBox.setText( Resources.getString("plugin.generalconfig.LOG_HISTORY")); logHistoryCheckBox.setSelected( - ConfigurationManager.isHistoryLoggingEnabled()); + ConfigurationUtils.isHistoryLoggingEnabled()); logHistoryCheckBox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { - ConfigurationManager.setHistoryLoggingEnabled( + ConfigurationUtils.setHistoryLoggingEnabled( logHistoryCheckBox.isSelected()); } }); @@ -334,13 +335,13 @@ public class GeneralConfigurationPanel showHistoryCheckBox.setText( Resources.getString("plugin.generalconfig.SHOW_HISTORY")); showHistoryCheckBox.setSelected( - ConfigurationManager.isHistoryShown()); + ConfigurationUtils.isHistoryShown()); showHistoryCheckBox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { - ConfigurationManager.setHistoryShown( + ConfigurationUtils.setHistoryShown( showHistoryCheckBox.isSelected()); } }); @@ -352,7 +353,7 @@ public class GeneralConfigurationPanel showHistoryPanel.add(historySizeSpinner); historySizeSpinner.setModel(historySizeSpinnerModel); historySizeSpinner.setValue( - ConfigurationManager.getChatHistorySize()); + ConfigurationUtils.getChatHistorySize()); logHistoryCheckBox.addChangeListener(new ChangeListener() { @@ -379,7 +380,7 @@ public class GeneralConfigurationPanel { public void stateChanged(ChangeEvent e) { - ConfigurationManager.setChatHistorySize( + ConfigurationUtils.setChatHistorySize( ((Integer) historySizeSpinner .getValue()).intValue()); } @@ -390,13 +391,13 @@ public class GeneralConfigurationPanel historySizeLabel.setText( Resources.getString("plugin.generalconfig.HISTORY_SIZE")); - if (!ConfigurationManager.isHistoryLoggingEnabled()) + if (!ConfigurationUtils.isHistoryLoggingEnabled()) { showHistoryCheckBox.setEnabled(false); historySizeSpinner.setEnabled(false); } - if (!ConfigurationManager.isHistoryShown()) + if (!ConfigurationUtils.isHistoryShown()) { historySizeSpinner.setEnabled(false); } @@ -422,19 +423,19 @@ public class GeneralConfigurationPanel ComboBoxModel sendMessageComboBoxModel = new DefaultComboBoxModel( new String[] { - ConfigurationManager.ENTER_COMMAND, - ConfigurationManager.CTRL_ENTER_COMMAND }); + ConfigurationUtils.ENTER_COMMAND, + ConfigurationUtils.CTRL_ENTER_COMMAND }); final JComboBox sendMessageComboBox = new JComboBox(); sendMessagePanel.add(sendMessageComboBox); sendMessageComboBox.setModel(sendMessageComboBoxModel); sendMessageComboBox.setSelectedItem( - ConfigurationManager.getSendMessageCommand()); + ConfigurationUtils.getSendMessageCommand()); sendMessageComboBox.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent arg0) { - ConfigurationManager.setSendMessageCommand( + ConfigurationUtils.setSendMessageCommand( (String)sendMessageComboBox.getSelectedItem()); } }); @@ -459,13 +460,13 @@ public class GeneralConfigurationPanel new Dimension(253, 20)); enableTypingNotifiCheckBox.setSelected( - ConfigurationManager.isSendTypingNotifications()); + ConfigurationUtils.isSendTypingNotifications()); enableTypingNotifiCheckBox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { - ConfigurationManager.setSendTypingNotifications( + ConfigurationUtils.setSendTypingNotifications( enableTypingNotifiCheckBox.isSelected()); } }); @@ -487,13 +488,13 @@ public class GeneralConfigurationPanel bringToFrontCheckBox.setAlignmentX(Component.LEFT_ALIGNMENT); bringToFrontCheckBox.setSelected( - ConfigurationManager.isAutoPopupNewMessage()); + ConfigurationUtils.isAutoPopupNewMessage()); bringToFrontCheckBox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { - ConfigurationManager.setAutoPopupNewMessage( + ConfigurationUtils.setAutoPopupNewMessage( bringToFrontCheckBox.isSelected()); } }); @@ -566,7 +567,7 @@ public class GeneralConfigurationPanel { // "Auto" selected. Delete the user's preference and // select the best available handler. - ConfigurationManager.setPopupHandlerConfig(null); + ConfigurationUtils.setPopupHandlerConfig(null); GeneralConfigPluginActivator.getSystrayService() .selectBestPopupMessageHandler(); @@ -576,7 +577,7 @@ public class GeneralConfigurationPanel (PopupMessageHandler) notifConfigComboBox.getSelectedItem(); - ConfigurationManager.setPopupHandlerConfig( + ConfigurationUtils.setPopupHandlerConfig( handler.getClass().getName()); GeneralConfigPluginActivator.getSystrayService() @@ -610,7 +611,7 @@ public class GeneralConfigurationPanel locale.getDisplayLanguage(locale)); } Locale currLocale = - ConfigurationManager.getCurrentLanguage(); + ConfigurationUtils.getCurrentLanguage(); localesConfigComboBox.setSelectedItem(currLocale .getDisplayLanguage(currLocale)); @@ -632,7 +633,7 @@ public class GeneralConfigurationPanel if(locale.getDisplayLanguage(locale) .equals(language)) { - ConfigurationManager.setLanguage(locale); + ConfigurationUtils.setLanguage(locale); break; } } @@ -681,7 +682,7 @@ public class GeneralConfigurationPanel JPanel checkBoxPanel = new TransparentPanel(new BorderLayout()); SIPCommCheckBox formatPhoneNumber = new SIPCommCheckBox("", - ConfigurationManager.isNormalizePhoneNumber()); + ConfigurationUtils.isNormalizePhoneNumber()); formatPhoneNumber.setAlignmentY(Component.TOP_ALIGNMENT); @@ -689,7 +690,7 @@ public class GeneralConfigurationPanel { public void actionPerformed(ActionEvent e) { - ConfigurationManager.setNormalizePhoneNumber( + ConfigurationUtils.setNormalizePhoneNumber( ((JCheckBox)e.getSource()).isSelected()); } }); @@ -725,7 +726,7 @@ public class GeneralConfigurationPanel // phone numbers. SIPCommCheckBox acceptPhoneNumberWithAlphaChars = new SIPCommCheckBox("", - ConfigurationManager.acceptPhoneNumberWithAlphaChars()); + ConfigurationUtils.acceptPhoneNumberWithAlphaChars()); acceptPhoneNumberWithAlphaChars.setAlignmentY(Component.TOP_ALIGNMENT); @@ -733,7 +734,7 @@ public class GeneralConfigurationPanel { public void actionPerformed(ActionEvent e) { - ConfigurationManager.setAcceptPhoneNumberWithAlphaChars( + ConfigurationUtils.setAcceptPhoneNumberWithAlphaChars( ((JCheckBox)e.getSource()).isSelected()); } }); diff --git a/src/net/java/sip/communicator/plugin/generalconfig/SIPConfigForm.java b/src/net/java/sip/communicator/plugin/generalconfig/SIPConfigForm.java index d65b9e3..b7a5e91 100644 --- a/src/net/java/sip/communicator/plugin/generalconfig/SIPConfigForm.java +++ b/src/net/java/sip/communicator/plugin/generalconfig/SIPConfigForm.java @@ -13,6 +13,7 @@ import java.util.List; import javax.swing.*; import net.java.sip.communicator.service.gui.*; +import net.java.sip.communicator.util.*; import net.java.sip.communicator.util.swing.*; /** @@ -65,7 +66,7 @@ public class SIPConfigForm final JTextField clientPortField = new JTextField(6); clientPortField.setText( - String.valueOf(ConfigurationManager.getClientPort())); + String.valueOf(ConfigurationUtils.getClientPort())); valuePanel.add(clientPortField); clientPortField.addFocusListener(new FocusListener() { @@ -82,7 +83,7 @@ public class SIPConfigForm throw new NumberFormatException( "Not a port number"); - ConfigurationManager.setClientPort(port); + ConfigurationUtils.setClientPort(port); } catch (NumberFormatException ex) { @@ -107,7 +108,7 @@ public class SIPConfigForm final JTextField clientSecurePortField = new JTextField(6); clientSecurePortField.setText( - String.valueOf(ConfigurationManager.getClientSecurePort())); + String.valueOf(ConfigurationUtils.getClientSecurePort())); valuePanel.add(clientSecurePortField); clientSecurePortField.addFocusListener(new FocusListener() { @@ -124,7 +125,7 @@ public class SIPConfigForm throw new NumberFormatException( "Not a port number"); - ConfigurationManager.setClientSecurePort(port); + ConfigurationUtils.setClientSecurePort(port); } catch (NumberFormatException ex) { @@ -148,13 +149,13 @@ public class SIPConfigForm }); String configuredProtocols = Arrays.toString( - ConfigurationManager.getEnabledSslProtocols()); + ConfigurationUtils.getEnabledSslProtocols()); pnlSslProtocols = Box.createVerticalBox(); pnlSslProtocols.setBorder(BorderFactory.createTitledBorder(Resources .getString("plugin.generalconfig.SIP_SSL_PROTOCOLS"))); pnlSslProtocols.setAlignmentX(Component.LEFT_ALIGNMENT); - for(String protocol : ConfigurationManager.getAvailableSslProtocols()) + for(String protocol : ConfigurationUtils.getAvailableSslProtocols()) { JCheckBox chkProtocol = new SIPCommCheckBox(protocol); chkProtocol.addActionListener(this); @@ -179,7 +180,7 @@ public class SIPConfigForm if(((JCheckBox) child).isSelected()) enabledSslProtocols.add(((JCheckBox) child).getText()); } - ConfigurationManager.setEnabledSslProtocols( + ConfigurationUtils.setEnabledSslProtocols( enabledSslProtocols.toArray(new String[]{})); } } |