[sip-comm-cvs] CVS update: /sip-communicator/src/net/java/sip/communicator/impl/gui/main/chatroomslist/

yanas at dev.java.net yanas at dev.java.net
Tue Apr 24 14:28:34 CEST 2007


User: yanas   
Date: 2007-04-24 12:28:34+0000
Modified:
   sip-communicator/src/net/java/sip/communicator/impl/gui/main/chatroomslist/ChatRoomServerRightButtonMenu.java
   sip-communicator/src/net/java/sip/communicator/impl/gui/main/chatroomslist/JoinChannelDialog.java
   sip-communicator/src/net/java/sip/communicator/impl/gui/main/chatroomslist/ChatRoomsList.java

Log:
 some methods added to the chat rooms list for facilitate the access to the list

File Changes:

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

File [changed]: ChatRoomServerRightButtonMenu.java
Url: https://sip-communicator.dev.java.net/source/browse/sip-communicator/src/net/java/sip/communicator/impl/gui/main/chatroomslist/ChatRoomServerRightButtonMenu.java?r1=1.1&r2=1.2
Delta lines:  +3 -3
-------------------
--- ChatRoomServerRightButtonMenu.java	2007-04-20 14:18:19+0000	1.1
+++ ChatRoomServerRightButtonMenu.java	2007-04-24 12:28:31+0000	1.2
@@ -122,10 +122,10 @@
 
         if (itemName.equals("createChatRoom"))
         {
-            CreateChatRoomWizard createChatRoomWizard
-                = new CreateChatRoomWizard(mainFrame);
+            CreateChatRoomDialog createChatRoomDialog
+                = new CreateChatRoomDialog(mainFrame, protocolProvider);
             
-            createChatRoomWizard.setVisible(true);
+            createChatRoomDialog.setVisible(true);
         }
         else if (itemName.equals("joinChatRoom"))
         {

File [changed]: JoinChannelDialog.java
Url: https://sip-communicator.dev.java.net/source/browse/sip-communicator/src/net/java/sip/communicator/impl/gui/main/chatroomslist/JoinChannelDialog.java?r1=1.3&r2=1.4
Delta lines:  +16 -5
--------------------
--- JoinChannelDialog.java	2007-04-23 18:55:18+0000	1.3
+++ JoinChannelDialog.java	2007-04-24 12:28:31+0000	1.4
@@ -116,9 +116,16 @@
             }
             catch (Exception ex)
             {
-                /** @todo handle exceptions being thrown here. */
-                logger.error("Failed to find room " + chatRoomName
-                             , ex);
+                logger.error("Failed to find chat room.", ex);
+                
+                new ErrorDialog(mainFrame,
+                    Messages.getI18NString(
+                        "findChatRoomError",
+                        new String[]{chatRoomName}).getText(),
+                        ex,
+                    Messages.getI18NString(
+                        "error").getText())
+                        .showDialog();
             }
 
             if(chatRoom != null)
@@ -127,6 +134,10 @@
                 {
                     chatRoom.join();
 
+                    ChatRoomsList chatRoomsList
+                        = mainFrame.getChatRoomsListPanel().getChatRoomsList();
+                    
+                    if(!chatRoomsList.containsChatRoom(chatRoom))
                     mainFrame.getChatRoomsListPanel().getChatRoomsList()
                         .addChatRoom(chatRoom);
                 }

File [changed]: ChatRoomsList.java
Url: https://sip-communicator.dev.java.net/source/browse/sip-communicator/src/net/java/sip/communicator/impl/gui/main/chatroomslist/ChatRoomsList.java?r1=1.3&r2=1.4
Delta lines:  +43 -0
--------------------
--- ChatRoomsList.java	2007-04-23 18:55:18+0000	1.3
+++ ChatRoomsList.java	2007-04-24 12:28:31+0000	1.4
@@ -111,6 +111,34 @@
     }
 
     /**
+     * Adds a chat room to this list.
+     *
+     * @param chatRoom the <tt>ChatRoom</tt> to add
+     * @param parentProvider the <tt>ProtocolProviderService</tt>, which is the
+     * parent of the given <tt>ChatRoom</tt>.
+     */
+    public void addChatRoom(ChatRoom chatRoom,
+            ProtocolProviderService parentProvider)
+    {
+        int parentIndex = listModel.indexOf(parentProvider);
+        
+        if(parentIndex != -1)
+            listModel.add(parentIndex + 1, chatRoom);
+    }
+
+    /**
+     * Verifies if the given <tt>ChatRoom</tt> is contained in the list.
+     * 
+     * @param chatRoom the <tt>ChatRoom</tt> to search.
+     * @return TRUE if the given <tt>ChatRoom</tt> is contained in the list,
+     * FALSE - otherwise.
+     */
+    public boolean containsChatRoom(ChatRoom chatRoom)
+    {
+        return listModel.contains(chatRoom);
+    }
+    
+    /**
      *
      * @param pps
      * @return
@@ -182,4 +210,19 @@
 
     public void mouseReleased(MouseEvent e)
     {}
+    
+    public ChatRoom getChatRoomFromList(String chatRoomName)
+    {
+        for(int i=0; i<listModel.getSize(); i++)
+        {
+            Object o = listModel.getElementAt(i);
+           
+            if(o instanceof ChatRoom)
+            {
+                if((((ChatRoom) o).getName()).equalsIgnoreCase(chatRoomName))
+                    return ((ChatRoom)(o));
+            }
+        }
+        return null;
+    }
 }




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