[sip-comm-cvs] CVS update: /sip-communicator/src/net/java/sip/communicator/impl/gui/utils/ConfigurationManager.java

yanas at dev.java.net yanas at dev.java.net
Thu May 3 16:24:20 CEST 2007


User: yanas   
Date: 2007-05-03 14:24:20+0000
Log:
 save visited chat rooms - work in progress

File Changes:

Directory: /sip-communicator/src/net/java/sip/communicator/impl/gui/utils/
==========================================================================

File [changed]: ConfigurationManager.java
Url: https://sip-communicator.dev.java.net/source/browse/sip-communicator/src/net/java/sip/communicator/impl/gui/utils/ConfigurationManager.java?r1=1.3&r2=1.4
Delta lines:  +102 -2
---------------------
--- ConfigurationManager.java	2007-04-17 14:09:42+0000	1.3
+++ ConfigurationManager.java	2007-05-03 14:24:17+0000	1.4
@@ -6,8 +6,11 @@
  */
 package net.java.sip.communicator.impl.gui.utils;
 
+import java.util.*;
+
 import net.java.sip.communicator.impl.gui.*;
 import net.java.sip.communicator.service.configuration.*;
+import net.java.sip.communicator.service.protocol.*;
 
 public class ConfigurationManager
 {   
@@ -30,11 +33,14 @@
     
     private static boolean isSendTypingNotifications;
     
+    private static LinkedList chatRoomsList;
+    
     private static ConfigurationService configService
         = GuiActivator.getConfigurationService();
     
     public static void loadGuiConfigurations()
     {   
+        // Load the "auPopupNewMessage" property.
         String autoPopup = configService.getString(
             "net.java.sip.communicator.impl.gui.autoPopupNewMessage");
         
@@ -43,12 +49,14 @@
         else
             autoPopupNewMessage = false;
         
+        // Load the "sendMessageCommand" property.
         String messageCommand = configService.getString(
             "net.java.sip.communicator.impl.gui.sendMessageCommand");
     
         if(messageCommand == null || messageCommand != "")
             sendMessageCommand = messageCommand;
     
+        // Load the showCallPanel property.
         String callPanelShown = configService.getString(
             "net.java.sip.communicator.impl.gui.showCallPanel");
     
@@ -57,6 +65,7 @@
             isCallPanelShown = new Boolean(callPanelShown).booleanValue();
         }
         
+        // Load the "showOffline" property.
         String showOffline = configService.getString(
             "net.java.sip.communicator.impl.gui.showOffline");
         
@@ -65,6 +74,7 @@
             isShowOffline = new Boolean(showOffline).booleanValue();
         }
 
+        // Load the "showApplication" property.
         String isVisible = configService.getString(
             "net.java.sip.communicator.impl.systray.showApplication");
         
@@ -73,6 +83,7 @@
             isApplicationVisible = new Boolean(isVisible).booleanValue();
         }
 
+        // Load the "sendTypingNotifications" property.
         String isSendTypingNotif = configService.getString(
             "net.java.sip.communicator.impl.gui.sendTypingNotifications");
         
@@ -81,38 +92,115 @@
             isSendTypingNotifications
                 = new Boolean(isSendTypingNotif).booleanValue();
         }
+        
+        // Load the list of visited chat rooms.      
+        String prefix = "net.java.sip.communicator.impl.gui.chatRooms";
+
+        List chatRooms = configService
+                .getPropertyNamesByPrefix(prefix, true);
+
+        Iterator chatRoomIter = chatRooms.iterator();
+
+        while(chatRoomIter.hasNext())
+        {
+            String chatRoomRootPropName
+                = (String) chatRoomIter.next();
+
+            String chatRoomID
+                = configService.getString(chatRoomRootPropName);
+
+            chatRooms.add(chatRoomID);
+        }
     }
     
+    /**
+     * 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 "showCallPanel" property is true, otherwise - return
+     * FALSE. Indicates to the user interface whether the panel containing the
+     * call and hangup buttons should be shown.
+     * @return TRUE if "showCallPanel" property is true, otherwise - return
+     * FALSE.
+     */
     public static boolean isCallPanelShown()
     {
         return isCallPanelShown;
     }
     
+    /**
+     * Return TRUE if "showOffline" property is true, otherwise - return
+     * FALSE. Indicates to the user interface whether offline user should be
+     * shown in the contact list or not.
+     * @return TRUE if "showOffline" property is true, otherwise - return
+     * FALSE.
+     */
     public static boolean isShowOffline()
     {
         return isShowOffline;
     }
     
+    /**
+     * Return TRUE if "showApplication" property is true, otherwise - return
+     * FALSE. Indicates to the user interface whether the main application
+     * window should shown or hidden on startup.
+     * @return TRUE if "showApplication" property is true, otherwise - return
+     * FALSE.
+     */
     public static boolean isApplicationVisible()
     {
         return isApplicationVisible;
     }
     
+    /**
+     * 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;
     }
     
+    /**
+     * 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;
     }
 
+    /**
+     * Return the list of visited chat rooms that was previously saved in through
+     * the <tt>ConfigurationService</tt>.
+     * @return the list of visited chat rooms that was previously saved in through
+     * the <tt>ConfigurationService</tt>. 
+     */
+    public static List getChatRoomsList()
+    {
+        return chatRoomsList;
+    }
+
+    /**
+     * 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;
@@ -171,4 +259,16 @@
                 "net.java.sip.communicator.impl.gui.sendMessageCommand",
                 newMessageCommand);
     }
+    
+    public static void saveChatRoom(ChatRoom chatRoom)
+    {
+        String chatRoomNodeName
+            = "chatr" + Long.toString(System.currentTimeMillis());
+    
+        String chatRoomPackage
+            = "net.java.sip.communicator.impl.gui.chatRooms."
+                    + chatRoomNodeName;
+    
+        configService.setProperty(chatRoomPackage, chatRoom.getName());    
+    }
 }




---------------------------------------------------------------------
To unsubscribe, e-mail: cvs-unsubscribe at sip-communicator.dev.java.net
For additional commands, e-mail: cvs-help at sip-communicator.dev.java.net





More information about the commits mailing list