[sip-comm-cvs] CVS update: /sip-communicator/src/net/java/sip/communicator/impl/gui/utils/, /sip-communicator/src/net/java/sip/communicator/impl/gui/main/chat/con...

yanas at dev.java.net yanas at dev.java.net
Wed Apr 11 16:15:57 CEST 2007


User: yanas   
Date: 2007-04-11 14:15:57+0000
Modified:
   sip-communicator/src/net/java/sip/communicator/impl/gui/utils/images.properties
   sip-communicator/src/net/java/sip/communicator/impl/gui/utils/ImageLoader.java
   sip-communicator/src/net/java/sip/communicator/impl/gui/main/chat/conference/ConferenceChatPanel.java
   sip-communicator/src/net/java/sip/communicator/impl/gui/main/chat/ChatWindow.java
   sip-communicator/src/net/java/sip/communicator/impl/gui/main/chat/ChatPanel.java
   sip-communicator/src/net/java/sip/communicator/impl/gui/main/chat/MetaContactChatPanel.java
   sip-communicator/src/net/java/sip/communicator/impl/gui/main/chat/ChatWindowManager.java
   sip-communicator/src/net/java/sip/communicator/impl/gui/main/menus/ToolsMenu.java
   sip-communicator/src/net/java/sip/communicator/impl/gui/main/menus/QuickMenu.java
   sip-communicator/src/net/java/sip/communicator/impl/gui/main/login/AuthenticationWindow.java
   sip-communicator/src/net/java/sip/communicator/impl/gui/main/login/SecurityAuthorityImpl.java
   sip-communicator/src/net/java/sip/communicator/impl/gui/main/configforms/ConfigurationFrame.java
   sip-communicator/src/net/java/sip/communicator/impl/gui/PopupDialogImpl.java
   sip-communicator/src/net/java/sip/communicator/impl/gui/UIServiceImpl.java
   sip-communicator/src/net/java/sip/communicator/impl/gui/GuiActivator.java
   sip-communicator/src/net/java/sip/communicator/impl/gui/main/contactlist/addcontact/AddContactWizard.java
   sip-communicator/src/net/java/sip/communicator/impl/gui/main/contactlist/addcontact/SelectAccountPanel.java
   sip-communicator/src/net/java/sip/communicator/impl/gui/main/AboutWindow.java

Log:
 fix UI implementation for the changes made in the UIService

File Changes:

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

File [changed]: images.properties
Url: https://sip-communicator.dev.java.net/source/browse/sip-communicator/src/net/java/sip/communicator/impl/gui/utils/images.properties?r1=1.28&r2=1.29
Delta lines:  +3 -1
-------------------
--- images.properties	2007-03-12 17:44:59+0000	1.28
+++ images.properties	2007-04-11 14:15:53+0000	1.29
@@ -192,3 +192,5 @@
 
 CHAT_ROOM_16x16_ICON=net/java/sip/communicator/impl/gui/resources/common/chatRoom16x16.png
 CHAT_SERVER_16x16_ICON=net/java/sip/communicator/impl/gui/resources/common/multiUserChatServer16x16.png
\ No newline at end of file
+
+MESSAGE_RECEIVED_ICON=net/java/sip/communicator/impl/gui/resources/common/envelope.png
\ No newline at end of file

File [changed]: ImageLoader.java
Url: https://sip-communicator.dev.java.net/source/browse/sip-communicator/src/net/java/sip/communicator/impl/gui/utils/ImageLoader.java?r1=1.40&r2=1.41
Delta lines:  +10 -2
--------------------
--- ImageLoader.java	2007-03-12 17:44:59+0000	1.40
+++ ImageLoader.java	2007-04-11 14:15:53+0000	1.41
@@ -498,6 +498,14 @@
     public static final ImageID CHAT_SERVER_16x16_ICON
         = new ImageID("CHAT_SERVER_16x16_ICON");    
 
+    /**
+     * The image used to indicate in the contact list that a message is received
+     * from a certain contact.
+     */
+    public static final ImageID MESSAGE_RECEIVED_ICON
+        = new ImageID("MESSAGE_RECEIVED_ICON");
+    
+    
     // ///////////////////// Edit Text Toolbar icons //////////////////////////
 
     /**

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

File [changed]: ConferenceChatPanel.java
Url: https://sip-communicator.dev.java.net/source/browse/sip-communicator/src/net/java/sip/communicator/impl/gui/main/chat/conference/ConferenceChatPanel.java?r1=1.2&r2=1.3
Delta lines:  +0 -5
-------------------
--- ConferenceChatPanel.java	2007-03-20 11:53:57+0000	1.2
+++ ConferenceChatPanel.java	2007-04-11 14:15:53+0000	1.3
@@ -334,9 +334,4 @@
     {
         
     }
-
-    public WindowID getWindowID()
-    {
-        return ApplicationWindow.CHAT_WINDOW;
-    }
 }

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

File [changed]: ChatWindow.java
Url: https://sip-communicator.dev.java.net/source/browse/sip-communicator/src/net/java/sip/communicator/impl/gui/main/chat/ChatWindow.java?r1=1.1&r2=1.2
Delta lines:  +48 -9
--------------------
--- ChatWindow.java	2007-03-12 17:38:29+0000	1.1
+++ ChatWindow.java	2007-04-11 14:15:53+0000	1.2
@@ -21,6 +21,7 @@
 import net.java.sip.communicator.impl.gui.main.chat.toolBars.*;
 import net.java.sip.communicator.impl.gui.utils.*;
 import net.java.sip.communicator.service.configuration.*;
+import net.java.sip.communicator.service.gui.*;
 import net.java.sip.communicator.service.protocol.*;
 import net.java.sip.communicator.util.*;
 
@@ -39,6 +40,7 @@
  */
 public class ChatWindow
     extends SIPCommFrame
+    implements ExportedWindow
 {
     private Logger logger = Logger.getLogger(ChatWindow.class.getName());
 
@@ -167,7 +169,7 @@
         else
             addSimpleChat(chatPanel);
         
-        chatPanel.setChatVisible(true);        
+        chatPanel.setShown(true);
     }
     
     /**
@@ -177,8 +179,6 @@
      */
     private void addSimpleChat(ChatPanel chatPanel)
     {
-        chatPanel.setChatVisible(true);
-
         this.getContentPane().add(chatPanel, BorderLayout.CENTER);
     }
 
@@ -648,4 +648,43 @@
             mainFrame.getChatWindowManager().closeWindow();
         }
     }
+
+    /**
+     * Implements the <tt>ExportedWindow.getIdentifier()</tt> method.
+     * Returns the identifier of this window, which will 
+     */
+    public WindowID getIdentifier()
+    {   
+        return ExportedWindow.CHAT_WINDOW;
+    }
+
+    /**
+     * Implements the <tt>ExportedWindow.minimize()</tt> method. Minimizes this
+     * window.
+     */
+    public void minimize()
+    {
+        this.setExtendedState(JFrame.ICONIFIED);
+    }
+
+    /**
+     * Implements the <tt>ExportedWindow.maximize()</tt> method. Maximizes this
+     * window.
+     */
+    public void maximize()
+    {   
+        this.setExtendedState(JFrame.MAXIMIZED_BOTH);
+    }
+
+    /**
+     * Implements the <tt>ExportedWindow.bringToFront()</tt> method. Brings
+     * this window to front.
+     */
+    public void bringToFront()
+    {
+        if(getExtendedState() == JFrame.ICONIFIED)
+            setExtendedState(JFrame.NORMAL);
+        
+        this.toFront();
+    }
 }

File [changed]: ChatPanel.java
Url: https://sip-communicator.dev.java.net/source/browse/sip-communicator/src/net/java/sip/communicator/impl/gui/main/chat/ChatPanel.java?r1=1.1&r2=1.2
Delta lines:  +150 -59
----------------------
--- ChatPanel.java	2007-03-12 17:38:30+0000	1.1
+++ ChatPanel.java	2007-04-11 14:15:53+0000	1.2
@@ -8,6 +8,7 @@
 
 import java.awt.*;
 import java.awt.event.*;
+import java.beans.*;
 import java.io.*;
 import java.util.*;
 
@@ -15,8 +16,12 @@
 import javax.swing.text.*;
 import javax.swing.text.html.*;
 
+import net.java.sip.communicator.impl.gui.main.contactlist.*;
 import net.java.sip.communicator.impl.gui.utils.*;
+import net.java.sip.communicator.service.contactlist.*;
+import net.java.sip.communicator.service.contactlist.event.*;
 import net.java.sip.communicator.service.gui.*;
+import net.java.sip.communicator.service.gui.event.*;
 import net.java.sip.communicator.service.protocol.*;
 import net.java.sip.communicator.service.protocol.event.*;
 import net.java.sip.communicator.util.*;
@@ -34,7 +39,7 @@
  */
 public abstract class ChatPanel
     extends JPanel
-    implements  ApplicationWindow,
+    implements  Chat,
                 ChatConversationContainer
 {
     private static final Logger logger = Logger
@@ -55,8 +60,6 @@
 
     private ChatWindow chatWindow;
     
-    private boolean isChatVisible;
-    
     public static final int TYPING_NOTIFICATION_SUCCESSFULLY_SENT = 1;
     
     public static final int TYPING_NOTIFICATION_SEND_FAILED = 0;
@@ -65,6 +68,10 @@
     
     protected static final int MESSAGES_PER_PAGE = 20;
     
+    private boolean isShown = false;
+    
+    private Vector focusListeners = new Vector();
+    
     /**
      * Creates a <tt>ChatPanel</tt> which is added to the given chat window.
      *
@@ -106,7 +113,14 @@
         this.add(messagePane, BorderLayout.CENTER);
         this.add(sendPanel, BorderLayout.SOUTH);
         
-        addComponentListener(new TabSelectionComponentListener());
+        this.addComponentListener(new TabSelectionComponentListener());
+        
+        KeyboardFocusManager focusManager =
+            KeyboardFocusManager.getCurrentKeyboardFocusManager();
+        
+        focusManager.addPropertyChangeListener(
+            new FocusPropertyChangeListener()
+        );
     }
   
 
@@ -461,91 +475,168 @@
     }
 
     /**
-     * Implements the <code>ApplicationWindow.isVisible</code> method, to
-     * check whether this chat panel is currently visible.
-     * @return <code>true</code> if this chat panel is currently visible,
-     * <code>false</code> otherwise.
+     * Seys the first date from the last page in the chat.
+     * 
+     * @param pageFirstMsgTimestamp the fist date from the last page of the chat
+     */
+    public void setBeginLastPageTimeStamp(Date pageFirstMsgTimestamp)
+    {
+        this.beginLastPageTimeStamp = pageFirstMsgTimestamp;
+    }
+
+    /**
+     * Returns the first date from the last chat page.
+     * 
+     * @return the first date from the last chat page
      */
-    public boolean isWindowVisible() {
-        return isChatVisible;
+    public Date getBeginLastPageTimeStamp()
+    {
+        return beginLastPageTimeStamp;
     }
 
     /**
-     * Implements the <code>ApplicationWindow.showWindow</code> method, to
-     * make a chat panel visible.
+     * Returns TRUE if this chat panel is added to a container (window or
+     * tabbed pane), which is shown on the screen, FALSE - otherwise.
+     * 
+     * @return TRUE if this chat panel is added to a container (window or
+     * tabbed pane), which is shown on the screen, FALSE - otherwise
      */
-    public void showWindow()
+    public boolean isShown()
     {
-        //TODO: Implement the showWindow method coming from Application Window
+        return isShown;
     }
 
     /**
-     * Implements the <code>ApplicationWindow.hideWindow</code> method. Hides
-     * the chat panel.
+     * Marks this chat panel as shown or hidden.
+     * 
+     * @param isShown TRUE to mark this chat panel as shown, FALSE - otherwise
      */
-    public void hideWindow()
+    public void setShown(boolean isShown)
     {
-        //TODO: Implement the hideWindow method coming from Application Window
+        this.isShown = isShown;
     }
 
     /**
-     * Implements the <code>ApplicationWindow.resizeWindow</code> method.
-     * Resizes the chat window to the given width and height.
-     * @param width The new width to set.
-     * @param height The new height to set.
+     * Implements the <tt>Chat.isChatFocused</tt> method. Returns TRUE if this
+     * chat panel is the currently selected panel and if the chat window, where
+     * it's contained is active.
      */
-    public void resizeWindow(int width, int height) {
-        getChatWindow().setSize(width, height);
+    public boolean isChatFocused()
+    {
+        ChatPanel currentChatPanel = chatWindow.getCurrentChatPanel();
+        
+        if(currentChatPanel != null
+                && currentChatPanel.equals(this)
+                && chatWindow.isActive())
+            return true;
+        
+        return false;
     }
 
     /**
-     * Implements the <code>ApplicationWindow.moveWindow</code> method. Moves
-     * the chat window to the given x and y coordinates.
-     * @param x The <code>x</code> coordinate.
-     * @param y The <code>y</code> coordinate.
+     * The <tt>FocusPropertyChangeListener</tt> listens for events triggered
+     * when the "focusOwner" property has changed. It is used to change the
+     * state of a contact from active (we have non read messages from this
+     * contact) to inactive, when user has opened a chat.
      */
-    public void moveWindow(int x, int y) {
-        getChatWindow().setLocation(x, y);
+    private class FocusPropertyChangeListener implements PropertyChangeListener
+    {
+        public void propertyChange(PropertyChangeEvent e)
+        {
+            String prop = e.getPropertyName();
+            if ((prop.equals("focusOwner")) &&
+                  (e.getNewValue() != null) &&
+                  (e.getNewValue() instanceof Component) &&
+                  ((Component)e.getNewValue())
+                      .getFocusCycleRootAncestor() instanceof ChatWindow)
+            {
+                ChatWindow chatWindow = (ChatWindow)((Component)e
+                        .getNewValue()).getFocusCycleRootAncestor();
+                
+                ChatPanel chatPanel
+                    = chatWindow.getCurrentChatPanel();
+                
+                if(chatPanel instanceof MetaContactChatPanel)
+                {
+                    MetaContact selectedMetaContact
+                        = ((MetaContactChatPanel)chatPanel).getMetaContact();
+                    
+                    ContactList clist
+                        = chatWindow.getMainFrame()
+                            .getContactListPanel().getContactList();
+                    ContactListModel clistModel
+                        = (ContactListModel) clist.getModel();
+                    
+                    if(clistModel.isContactActive(selectedMetaContact))
+                    {
+                        clistModel.removeActiveContact(selectedMetaContact);
+                        clist.modifyContact(selectedMetaContact);
+                    }
+                    
+                    fireChatFocusEvent(ChatFocusEvent.FOCUS_GAINED);
+                }
+            }
+        }
     }
 
     /**
-     * Implements the <code>ApplicationWindow.minimizeWindow</code> method.
-     * Minimizes the chat window.
+     * Implements <tt>Chat.addChatFocusListener</tt> method. Adds the given
+     * <tt>ChatFocusListener</tt> to the list of listeners.
      */
-    public void minimizeWindow()
+    public void addChatFocusListener(ChatFocusListener l)
+    {
+        synchronized (focusListeners)
     {
-        getChatWindow().setState(JFrame.ICONIFIED);
+            focusListeners.add(l);
+        }
     }
 
     /**
-     * Implements the <code>ApplicationWindow.maximizeWindow</code> method.
-     * Maximizes the chat window.
+     * Implements <tt>Chat.removeChatFocusListener</tt> method. Removes the given
+     * <tt>ChatFocusListener</tt> from the list of listeners.
      */
-    public void maximizeWindow()
+    public void removeChatFocusListener(ChatFocusListener l)
+    {
+        synchronized (focusListeners)
     {
-        getChatWindow().setState(JFrame.MAXIMIZED_BOTH);
+            focusListeners.remove(l);
+        }
     }
 
     /**
-     * Sets the chat <code>isVisible</code> variable to <code>true</code> or
-     * <code>false</code> to indicate that this chat panel is visible or
-     * invisible.
+     * Informs all <tt>ChatFocusListener</tt>s that a <tt>ChatFocusEvent</tt>
+     * has been triggered.
      *
-     * @param isVisible specifies whether we'd like this chat panel visible or
-     * not.
+     * @param eventID the type of the <tt>ChatFocusEvent</tt>
      */
-    public void setChatVisible(boolean isVisible) {
-        this.isChatVisible = isVisible;
-    }
+    private void fireChatFocusEvent(int eventID)
+    {
+        ChatFocusEvent evt = new ChatFocusEvent(this, eventID);
     
-    public void setBeginLastPageTimeStamp(Date pageFirstMsgTimestamp)
+        logger.trace("Will dispatch the following chat event: " + evt);
+
+        Iterator listeners = null;
+        synchronized (focusListeners)
     {
-        this.beginLastPageTimeStamp = pageFirstMsgTimestamp;
+            listeners = new ArrayList(focusListeners).iterator();
     }
 
+        while (listeners.hasNext())
+        {
+            ChatFocusListener listener
+                = (ChatFocusListener) listeners.next();
 
-    public Date getBeginLastPageTimeStamp()
+            switch (evt.getEventID())
     {
-        return beginLastPageTimeStamp;
+            case ChatFocusEvent.FOCUS_GAINED:
+                listener.chatFocusGained(evt);
+                break;
+            case ChatFocusEvent.FOCUS_LOST:
+                listener.chatFocusLost(evt);
+                break;
+            default:
+                logger.error("Unknown event type " + evt.getEventID());
+            }
+        }
     }
 }

File [changed]: MetaContactChatPanel.java
Url: https://sip-communicator.dev.java.net/source/browse/sip-communicator/src/net/java/sip/communicator/impl/gui/main/chat/MetaContactChatPanel.java?r1=1.2&r2=1.3
Delta lines:  +2 -3
-------------------
--- MetaContactChatPanel.java	2007-03-20 11:53:56+0000	1.2
+++ MetaContactChatPanel.java	2007-04-11 14:15:53+0000	1.3
@@ -20,7 +20,6 @@
 import net.java.sip.communicator.impl.gui.utils.*;
 import net.java.sip.communicator.service.contactlist.*;
 import net.java.sip.communicator.service.contactlist.event.*;
-import net.java.sip.communicator.service.gui.*;
 import net.java.sip.communicator.service.msghistory.*;
 import net.java.sip.communicator.service.protocol.*;
 import net.java.sip.communicator.service.protocol.event.*;
@@ -646,8 +645,8 @@
         }
     }
 
-    public WindowID getWindowID()
+    public MetaContact getMetaContact()
     {
-        return ApplicationWindow.CHAT_WINDOW;
+        return metaContact;
     }
 }

File [changed]: ChatWindowManager.java
Url: https://sip-communicator.dev.java.net/source/browse/sip-communicator/src/net/java/sip/communicator/impl/gui/main/chat/ChatWindowManager.java?r1=1.1&r2=1.2
Delta lines:  +17 -5
--------------------
--- ChatWindowManager.java	2007-03-12 17:38:29+0000	1.1
+++ ChatWindowManager.java	2007-04-11 14:15:53+0000	1.2
@@ -10,6 +10,7 @@
 
 import javax.swing.*;
 
+import net.java.sip.communicator.impl.gui.GuiActivator;
 import net.java.sip.communicator.impl.gui.customcontrols.*;
 import net.java.sip.communicator.impl.gui.i18n.*;
 import net.java.sip.communicator.impl.gui.main.*;
@@ -39,8 +40,6 @@
     public ChatWindowManager(MainFrame mainFrame)
     {
         this.mainFrame = mainFrame;
-        
-        this.chatWindow = new ChatWindow(mainFrame);
     }
 
     /**
@@ -57,7 +56,7 @@
         {
             ChatWindow chatWindow = chatPanel.getChatWindow();
 
-            boolean isChatVisible = chatPanel.isWindowVisible();
+            boolean isChatVisible = chatPanel.isShown();
             
             if(!isChatVisible)
                 chatWindow.addChat(chatPanel);
@@ -279,9 +278,11 @@
                 return getChat(metaContact);
             }
             else         
+            {
                 return createChat(metaContact);
         }
     } 
+    } 
     
     /**
      * Returns the chat panel corresponding to the given meta contact
@@ -442,7 +443,17 @@
         ChatWindow chatWindow;
 
         if(Constants.TABBED_CHAT_WINDOW)
+        {
+            if(this.chatWindow == null)
+            {
+                this.chatWindow = new ChatWindow(mainFrame);
+                
+                GuiActivator.getUIService()
+                    .registerExportedWindow(this.chatWindow);
+            }
+            
             chatWindow = this.chatWindow;
+        }
         else
         {
             chatWindow = new ChatWindow(mainFrame);
@@ -482,6 +493,7 @@
         else
         {
             chatWindow = new ChatWindow(mainFrame);
+            GuiActivator.getUIService().registerExportedWindow(chatWindow);
 
             this.chatWindow = chatWindow;
         }

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

File [changed]: ToolsMenu.java
Url: https://sip-communicator.dev.java.net/source/browse/sip-communicator/src/net/java/sip/communicator/impl/gui/main/menus/ToolsMenu.java?r1=1.7&r2=1.8
Delta lines:  +1 -1
-------------------
--- ToolsMenu.java	2007-02-09 08:49:29+0000	1.7
+++ ToolsMenu.java	2007-04-11 14:15:53+0000	1.8
@@ -73,7 +73,7 @@
         if (itemText.equalsIgnoreCase("config")) {
             configDialog = GuiActivator.getUIService().getConfigurationWindow();
 
-            configDialog.showWindow();
+            configDialog.setVisible(true);
         }
     }
 }

File [changed]: QuickMenu.java
Url: https://sip-communicator.dev.java.net/source/browse/sip-communicator/src/net/java/sip/communicator/impl/gui/main/menus/QuickMenu.java?r1=1.23&r2=1.24
Delta lines:  +1 -1
-------------------
--- QuickMenu.java	2007-03-12 17:47:22+0000	1.23
+++ QuickMenu.java	2007-04-11 14:15:54+0000	1.24
@@ -193,7 +193,7 @@
 
             configDialog = GuiActivator.getUIService().getConfigurationWindow();
 
-            configDialog.showWindow();
+            configDialog.setVisible(true);
         }
         else if (buttonName.equals("search"))
         {

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

File [changed]: AuthenticationWindow.java
Url: https://sip-communicator.dev.java.net/source/browse/sip-communicator/src/net/java/sip/communicator/impl/gui/main/login/AuthenticationWindow.java?r1=1.19&r2=1.20
Delta lines:  +51 -14
---------------------
--- AuthenticationWindow.java	2007-02-28 15:01:33+0000	1.19
+++ AuthenticationWindow.java	2007-04-11 14:15:54+0000	1.20
@@ -15,6 +15,7 @@
 import net.java.sip.communicator.impl.gui.i18n.*;
 import net.java.sip.communicator.impl.gui.main.*;
 import net.java.sip.communicator.impl.gui.utils.*;
+import net.java.sip.communicator.service.gui.*;
 import net.java.sip.communicator.service.protocol.*;
 /**
  * The <tt>LoginWindow</tt> is the window where the user should type his
@@ -24,7 +25,8 @@
  */
 public class AuthenticationWindow
     extends SIPCommFrame
-    implements ActionListener
+    implements  ActionListener,
+                ExportedWindow
 {
 
     private JTextArea realmTextArea = new JTextArea();
@@ -279,9 +281,14 @@
      * Shows this modal dialog.
      * @return the result code, which shows what was the choice of the user
      */
-    public UserCredentials showWindow() {
-        this.setVisible(true);
+    public void setVisible(boolean isVisible)
+    {
+        this.setName("AUTHENTICATION");
+        
+        super.setVisible(isVisible);
 
+        if(isVisible)
+        {
         this.passwdField.requestFocus();
         
         synchronized (lock) {
@@ -293,7 +300,37 @@
                 e.printStackTrace();
             }
         }
+        }
+    }
+
+    /**
+     * Implements the <tt>ExportedWindow.getIdentifier()</tt> method.
+     */
+    public WindowID getIdentifier()
+    {
+         return ExportedWindow.AUTHENTICATION_WINDOW;
+    }
         
-        return userCredentials;
+    /**
+     * This dialog could not be minimized.
+     */
+    public void minimize()
+    {   
+    }
+
+    /**
+     * This dialog could not be maximized.
+     */
+    public void maximize()
+    {   
+    }
+    
+    /**
+     * Implements the <tt>ExportedWindow.bringToFront()</tt> method. Brings this
+     * window to front.
+     */
+    public void bringToFront()
+    {
+        this.toFront();
     }
 }

File [changed]: SecurityAuthorityImpl.java
Url: https://sip-communicator.dev.java.net/source/browse/sip-communicator/src/net/java/sip/communicator/impl/gui/main/login/SecurityAuthorityImpl.java?r1=1.6&r2=1.7
Delta lines:  +4 -4
-------------------
--- SecurityAuthorityImpl.java	2006-12-21 14:48:06+0000	1.6
+++ SecurityAuthorityImpl.java	2007-04-11 14:15:54+0000	1.7
@@ -40,13 +40,13 @@
      * its password.
      */
     public UserCredentials obtainCredentials(String realm,
-            UserCredentials userCredentials) {
-
+            UserCredentials userCredentials)
+    {
         AuthenticationWindow loginWindow = new AuthenticationWindow(
                 mainFrame, protocolProvider, realm, userCredentials);
         
-        UserCredentials uc = loginWindow.showWindow();
+        loginWindow.setVisible(true);
         
-        return uc;
+        return userCredentials;
     }
 }

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

File [changed]: ConfigurationFrame.java
Url: https://sip-communicator.dev.java.net/source/browse/sip-communicator/src/net/java/sip/communicator/impl/gui/main/configforms/ConfigurationFrame.java?r1=1.24&r2=1.25
Delta lines:  +48 -63
---------------------
--- ConfigurationFrame.java	2007-03-20 11:53:58+0000	1.24
+++ ConfigurationFrame.java	2007-04-11 14:15:54+0000	1.25
@@ -230,19 +230,13 @@
     }
 
     /**
-     * Implements <code>ApplicationWindow.isWindowVisible</code> method.
-     * @see net.java.sip.communicator.service.gui.ApplicationWindow#isWindowVisible()
+     * Implements <code>ApplicationWindow.show</code> method.
+     * @see net.java.sip.communicator.service.gui.ExportedWindow#showWindow()
      */
-    public boolean isWindowVisible() {
-        return this.isVisible();
-    }
-
-    /**
-     * Implements <code>ApplicationWindow.showWindow</code> method.
-     * @see net.java.sip.communicator.service.gui.ApplicationWindow#showWindow()
-     */
-    public void showWindow() {
-        
+    public void setVisible(boolean isVisible)
+    {
+        if(isVisible)
+        {
         ConfigurationForm configForm 
             = (ConfigurationForm) this.configContainer.get(0);
         
@@ -259,60 +253,51 @@
 
         this.centerPanel.add(titlePanel, BorderLayout.NORTH);
         
-        this.setVisible(true);
+            super.setVisible(true);
         
         this.closeButton.requestFocus();
     }
-
-    /**
-     * Implements <code>ApplicationWindow.hideWindow</code> method.
-     * @see net.java.sip.communicator.service.gui.ApplicationWindow#hideWindow()
-     */
-    public void hideWindow() {
-        this.setVisible(false);
-    }
-
-    /**
-     * Implements <code>ApplicationWindow.resizeWindow</code> method.
-     * @see net.java.sip.communicator.service.gui.ApplicationWindow#resizeWindow(int, int)
-     */
-    public void resizeWindow(int width, int height) {
-        this.setSize(width, height);
-    }
-
-    /**
-     * Implements <code>ApplicationWindow.moveWindow</code> method.
-     * @see net.java.sip.communicator.service.gui.ApplicationWindow#moveWindow(int, int)
-     */
-    public void moveWindow(int x, int y) {
-        this.setLocation(x, y);
+        else
+            super.setVisible(false);
     }
 
     /**
      * Implements <code>ApplicationWindow.minimizeWindow</code> method.
-     * @see net.java.sip.communicator.service.gui.ApplicationWindow#minimizeWindow()
+     * @see net.java.sip.communicator.service.gui.ExportedWindow#minimizeWindow()
      */
-    public void minimizeWindow()
+    public void minimize()
     {}
 
     /**
      * Implements <code>ApplicationWindow.maximizeWindow</code> method.
-     * @see net.java.sip.communicator.service.gui.ApplicationWindow#maximizeWindow()
+     * @see net.java.sip.communicator.service.gui.ExportedWindow#maximizeWindow()
      */
-    public void maximizeWindow()
+    public void maximize()
     {}
     
     /**
-     * Implements <tt>SIPCommFrame</tt> close method.
+     * Implements <tt>SIPCommFrame.close()</tt> method. Performs a click on the
+     * close button.
      */
     protected void close(boolean isEscaped)
     {
         this.closeButton.doClick();
     }
 
-    public WindowID getWindowID()
+    /**
+     * Returns the identifier of this <tt>ExportedWindow</tt>.
+     */
+    public WindowID getIdentifier()
     {
-        return ApplicationWindow.CONFIGURATION_WINDOW;
+        return ExportedWindow.CONFIGURATION_WINDOW;
     }
     
+    /**
+     * Implements the <tt>ExportedWindow.bringToFront</tt> method. Brings this
+     * window to front.
+     */
+    public void bringToFront()
+    {
+        this.toFront();
+    }
 }

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

File [changed]: PopupDialogImpl.java
Url: https://sip-communicator.dev.java.net/source/browse/sip-communicator/src/net/java/sip/communicator/impl/gui/PopupDialogImpl.java?r1=1.6&r2=1.7
Delta lines:  +22 -34
---------------------
--- PopupDialogImpl.java	2007-03-20 11:53:58+0000	1.6
+++ PopupDialogImpl.java	2007-04-11 14:15:54+0000	1.7
@@ -220,54 +220,42 @@
     }
 
     /**
-     * Implements the <tt>PopupDialog.isWindowVisible</tt> method.
-     * @return <code>true</code> if the dialog is visible, <code>false</code>
-     * otherwise.
+     * Implements the <tt>ExportedWindow.getIdentifier()</tt> method.
      */
-    public boolean isWindowVisible() {
-        return this.isVisible();
+    public WindowID getIdentifier()
+    {
+        return WINDOW_GENERAL_POPUP;
     }
 
     /**
-     * Implements the <tt>PopupDialog.showWindow</tt> method.
-     * Shows this <tt>JOptionPane</tt>.
+     * Implements the <tt>ExportedWindow.isFocused()</tt> method. Returns TRUE
+     * if this dialog is the focus owner, FALSE - otherwise.
      */
-    public void showWindow() {
-        this.setVisible(true);
+    public boolean isFocused()
+    {
+        return super.isFocusOwner();
     }
 
     /**
-     * Implements the <tt>PopupDialog.hideWindow</tt> method.
-     * Hides this <tt>JOptionPane</tt>.
+     * Implements the <tt>ExportedWindow.bringToFront()</tt> method. Brings this
+     * window to front.
      */
-    public void hideWindow() {
-        this.setVisible(false);
+    public void bringToFront()
+    {
+        this.requestFocusInWindow();
     }
 
     /**
-     * Implements the <tt>PopupDialog.resizeWindow</tt> method.
-     * Resizes this <tt>JOptionPane</tt>.
+     * This dialog could not be minimized.
      */
-    public void resizeWindow(int width, int height) {
-        this.setSize(width, height);
+    public void minimize()
+    {
     }
 
     /**
-     * Implements the <tt>PopupDialog.moveWindow</tt> method.
-     * Moves this <tt>JOptionPane</tt>.
+     * This dialog could not be maximized.
      */
-    public void moveWindow(int x, int y) {
-        this.setLocation(x, y);
-    }
-
-    public void minimizeWindow()
-    {}
-
-    public void maximizeWindow()
-    {}
-
-    public WindowID getWindowID()
+    public void maximize()
     {
-        return WINDOW_GENERAL_POPUP;
     }    
 }

File [changed]: UIServiceImpl.java
Url: https://sip-communicator.dev.java.net/source/browse/sip-communicator/src/net/java/sip/communicator/impl/gui/UIServiceImpl.java?r1=1.30&r2=1.31
Delta lines:  +59 -53
---------------------
--- UIServiceImpl.java	2007-03-20 11:53:58+0000	1.30
+++ UIServiceImpl.java	2007-04-11 14:15:54+0000	1.31
@@ -23,18 +23,12 @@
 import net.java.sip.communicator.impl.gui.main.configforms.ConfigurationFrame;
 import net.java.sip.communicator.impl.gui.main.contactlist.ContactListPanel;
 import net.java.sip.communicator.impl.gui.main.contactlist.addcontact.*;
+import net.java.sip.communicator.impl.gui.main.login.*;
 import net.java.sip.communicator.service.contactlist.*;
-import net.java.sip.communicator.service.gui.AccountRegistrationWizardContainer;
-import net.java.sip.communicator.service.gui.ApplicationWindow;
-import net.java.sip.communicator.service.gui.ConfigurationWindow;
-import net.java.sip.communicator.service.gui.ContactAwareComponent;
-import net.java.sip.communicator.service.gui.ContainerID;
-import net.java.sip.communicator.service.gui.PopupDialog;
-import net.java.sip.communicator.service.gui.UIService;
-import net.java.sip.communicator.service.gui.WindowID;
+import net.java.sip.communicator.service.gui.*;
 import net.java.sip.communicator.service.gui.event.PluginComponentEvent;
 import net.java.sip.communicator.service.gui.event.PluginComponentListener;
-import net.java.sip.communicator.service.protocol.Contact;
+import net.java.sip.communicator.service.protocol.*;
 import net.java.sip.communicator.util.Logger;
 
 /**
@@ -44,8 +38,7 @@
  * @author Yana Stamcheva
  */
 public class UIServiceImpl
-    implements
-    UIService
+    implements UIService
 {
 
     private static final Logger logger = Logger.getLogger(UIServiceImpl.class);
@@ -397,27 +390,31 @@
     }
 
     /**
-     * Adds all exportable <tt>ApplicationWindow</tt>s to the list of
-     * application windows, which could be used from other bundles. Once
-     * registered in the UIService this window could be obtained through the
-     * <tt>getApplicationWindow(WindowID)</tt> method and could be shown,
+     * Adds all <tt>ExportedWindow</tt>s to the list of application windows,
+     * which could be used from other bundles. Once registered in the
+     * <tt>UIService</tt> this window could be obtained through the
+     * <tt>getExportedWindow(WindowID)</tt> method and could be shown,
      * hidden, resized, moved, etc.
      */
-    /**
-     * Adds all exportable <tt>ApplicationWindow</tt>s to the list of application
-     * windows, which could be used from other bundles. Once registered in the
-     * UIService this window could be obtained through the
-     * <tt>getApplicationWindow(WindowID)</tt> method and could be shown,
-     * hidden, resized, moved, etc.
-     */
-    public void registerExportableWindows()
+    public void initExportedWindows()
     {
         AboutWindow aboutWindow = new AboutWindow(mainFrame);
         AddContactWizard addContactWizard = new AddContactWizard(mainFrame);
         
-        exportedWindows.put(aboutWindow.getWindowID(), aboutWindow);
-        exportedWindows.put(configurationFrame.getWindowID(), configurationFrame);
-        exportedWindows.put(addContactWizard.getWindowID(), addContactWizard);
+        exportedWindows.put(aboutWindow.getIdentifier(), aboutWindow);
+        exportedWindows.put(configurationFrame.getIdentifier(), configurationFrame);
+        exportedWindows.put(addContactWizard.getIdentifier(), addContactWizard);
+    }
+    
+    /**
+     * Registers the given <tt>ExportedWindow</tt> to the list of windows that
+     * could be accessed from other bundles.
+     * 
+     * @param window the window to be exported
+     */
+    public void registerExportedWindow(ExportedWindow window)
+    {
+        exportedWindows.put(window.getIdentifier(), window);
     }
     
     /**
@@ -446,34 +443,46 @@
     }
     
     /**
-     * Implements <code>getApplicationWindows</code> in the UIService
-     * interface. Returns an iterator over a set of all windows exported by this
-     * implementation.
+     * Implements <code>getSupportedExportedWindows</code> in the UIService
+     * interface. Returns an iterator over a set of all windows exported by
+     * this implementation.
      * 
-     * @see UIService#getApplicationWindows()
+     * @see UIService#getSupportedExportedWindows()
      */
-    public Iterator getSupportedApplicationWindows()
+    public Iterator getSupportedExportedWindows()
     {
         return Collections.unmodifiableMap(exportedWindows).keySet().iterator();
     }
 
     /**
-     * Implements <code>getApplicationWindow</code> in the UIService
+     * Implements the <code>getExportedWindow</code> in the UIService
      * interface. Returns the window corresponding to the given
      * <tt>WindowID</tt>.
      * 
-     * @see UIService#getApplicationWindow(WindowID)
+     * @see UIService#getExportableComponent(WindowID)
      */
-    public ApplicationWindow getApplicationWindow(WindowID windowID)
+    public ExportedWindow getExportedWindow(WindowID windowID)
     {
         if (exportedWindows.containsKey(windowID))
         {
-            return (ApplicationWindow) exportedWindows.get(windowID);
+            return (ExportedWindow) exportedWindows.get(windowID);
         }
         return null;
     }
 
     /**
+     * Implements the <code>UIService.isExportedWindowSupported</code> method.
+     * Checks if there's an exported component for the given
+     * <tt>WindowID</tt>.
+     * 
+     * @see UIService#isExportedWindowSupported(WindowID)
+     */
+    public boolean isExportedWindowSupported(WindowID windowID)
+    {
+        return exportedWindows.containsKey(windowID);
+    }
+
+    /**
      * Implements <code>getPopupDialog</code> in the UIService interface.
      * Returns a <tt>PopupDialog</tt> that could be used to show simple
      * messages, warnings, errors, etc.
@@ -486,13 +495,13 @@
     }
 
     /**
-     * Implements <code>getChatDialog</code> in the UIService interface. If a
-     * chat dialog for the given contact exists already returns it, otherwise
+     * Implements <code>getChat</code> in the UIService interface. If a
+     * chat for the given contact exists already - returns it, otherwise
      * creates a new one.
      * 
-     * @see UIService#getChatWindow(Contact)
+     * @see UIService#getChat(Contact)
      */
-    public ApplicationWindow getChatWindow(Contact contact)
+    public Chat getChat(Contact contact)
     {
         MetaContact metaContact = mainFrame.getContactList()
             .findMetaContactByContact(contact);
@@ -501,18 +510,7 @@
 
         ChatPanel chatPanel = chatWindowManager.getContactChat(metaContact);
 
-        return (ApplicationWindow) chatPanel;
-    }
-
-    /**
-     * Implements the <code>UIService.containsApplicationWindow</code> method.
-     * Checks if there's an exported window for the given <tt>WindowID</tt>.
-     * 
-     * @see UIService#containsApplicationWindow(WindowID)
-     */
-    public boolean containsApplicationWindow(WindowID windowID)
-    {
-        return exportedWindows.containsKey(windowID);
+        return chatPanel;
     }
 
     /**
@@ -550,4 +548,12 @@
     {
         return this.configurationFrame;
     }
+
+    public ExportedWindow getAuthenticationWindow(
+        ProtocolProviderService protocolProvider,
+        String realm, UserCredentials userCredentials)
+    {
+        return new AuthenticationWindow(mainFrame, protocolProvider,
+            realm, userCredentials);
+    }
 }

File [changed]: GuiActivator.java
Url: https://sip-communicator.dev.java.net/source/browse/sip-communicator/src/net/java/sip/communicator/impl/gui/GuiActivator.java?r1=1.25&r2=1.26
Delta lines:  +2 -2
-------------------
--- GuiActivator.java	2007-03-20 11:53:58+0000	1.25
+++ GuiActivator.java	2007-04-11 14:15:54+0000	1.26
@@ -95,7 +95,7 @@
             communicatorMain.showCommunicator(true);
             SwingUtilities.invokeLater(new RunLogin());
             
-            uiService.registerExportableWindows();
+            uiService.initExportedWindows();
         }
         finally {
             logger.logExit();
@@ -279,7 +279,7 @@
      * Returns the current implementation of the <tt>UIService</tt>.
      * @return the current implementation of the <tt>UIService</tt>
      */
-    public static UIService getUIService() {
+    public static UIServiceImpl getUIService() {
         return uiService;
     }
 }

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

File [changed]: AddContactWizard.java
Url: https://sip-communicator.dev.java.net/source/browse/sip-communicator/src/net/java/sip/communicator/impl/gui/main/contactlist/addcontact/AddContactWizard.java?r1=1.18&r2=1.19
Delta lines:  +37 -26
---------------------
--- AddContactWizard.java	2007-03-20 11:53:57+0000	1.18
+++ AddContactWizard.java	2007-04-11 14:15:55+0000	1.19
@@ -17,10 +17,16 @@
 import net.java.sip.communicator.service.protocol.*;
 import net.java.sip.communicator.util.*;
 
+/**
+ * The <tt>AddContactWizard</tt> is the wizard the guides the user through the
+ * process of adding a contact.
+ * 
+ * @author Yana Stamcheva
+ */
 public class AddContactWizard
     extends Wizard
     implements  WizardListener,
-                ApplicationWindow
+                ExportedWindow
 {
     private Logger logger = Logger.getLogger(AddContactWizard.class.getName());
     
@@ -155,41 +161,46 @@
         }
     }
 
-    public WindowID getWindowID()
-    {
-        return ApplicationWindow.ADD_CONTACT_WINDOW;
-    }
-
-    public boolean isWindowVisible()
-    {
-        return isVisible();
-    }
-
-    public void showWindow()
-    {
-        this.showDialog(false);
-    }
-
-    public void hideWindow()
+    /**
+     * Invokes the <tt>Wizard.showDialog</tt> method in order to perform
+     * additional operations when visualizing this component.
+     */
+    public void setVisible(boolean isVisible)
     {
-        this.setVisible(false);
+        if(isVisible)
+            showDialog(false);
+        else
+            super.setVisible(false);
     }
 
-    public void resizeWindow(int width, int height)
+    /**
+     * Implements the <tt>ExportedWindow.getIdentifier()</tt> method.
+     */
+    public WindowID getIdentifier()
     {
-        this.setSize(width, height);
+        return ExportedWindow.ADD_CONTACT_WINDOW;
     }
 
-    public void moveWindow(int x, int y)
+    /**
+     * This dialog could not be minimized.
+     */
+    public void minimize()
     {
-        this.setLocation(x, y);
     }
 
-    public void minimizeWindow()
+    /**
+     * This dialog could not be maximized.
+     */
+    public void maximize()
     {   
     }
 
-    public void maximizeWindow()
+    /**
+     * Implements the <tt>ExportedWindow.bringToFront()</tt> method. Brings this
+     * window to front.
+     */
+    public void bringToFront()
     {   
+        this.toFront();
     }
 }

File [changed]: SelectAccountPanel.java
Url: https://sip-communicator.dev.java.net/source/browse/sip-communicator/src/net/java/sip/communicator/impl/gui/main/contactlist/addcontact/SelectAccountPanel.java?r1=1.12&r2=1.13
Delta lines:  +8 -0
-------------------
--- SelectAccountPanel.java	2007-03-20 11:53:57+0000	1.12
+++ SelectAccountPanel.java	2007-04-11 14:15:55+0000	1.13
@@ -195,6 +195,14 @@
 
     public void serviceChanged(ServiceEvent event)
     {
+        //if the event is caused by a bundle being stopped, we don't want to
+        //know
+        if(event.getServiceReference().getBundle().getState()
+            == Bundle.STOPPING)
+        {
+            return;
+        }
+        
         Object sourceService = GuiActivator.bundleContext
             .getService(event.getServiceReference());
         

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

File [changed]: AboutWindow.java
Url: https://sip-communicator.dev.java.net/source/browse/sip-communicator/src/net/java/sip/communicator/impl/gui/main/AboutWindow.java?r1=1.9&r2=1.10
Delta lines:  +23 -39
---------------------
--- AboutWindow.java	2007-03-20 11:53:56+0000	1.9
+++ AboutWindow.java	2007-04-11 14:15:55+0000	1.10
@@ -16,7 +16,7 @@
         extends SIPCommDialog
         implements  HyperlinkListener,
                     ActionListener,
-                    ApplicationWindow
+                    ExportedWindow
 {
     private WindowBackground mainPanel
         = new WindowBackground();
@@ -178,50 +178,34 @@
         this.dispose();
     }
 
-    public WindowID getWindowID()
-    {
-        return ApplicationWindow.ABOUT_WINDOW;
-    }
-
-    public boolean isWindowVisible()
-    {
-        // TODO Auto-generated method stub
-        return false;
-    }
-
-    public void showWindow()
-    {
-        // TODO Auto-generated method stub
-        
-    }
-
-    public void hideWindow()
-    {
-        // TODO Auto-generated method stub
-        
-    }
-
-    public void resizeWindow(int width, int height)
+    /**
+     * Implements the <tt>ExportedWindow.getIdentifier()</tt> method.
+     */
+    public WindowID getIdentifier()
     {
-        // TODO Auto-generated method stub
-        
+        return ExportedWindow.ABOUT_WINDOW;
     }
 
-    public void moveWindow(int x, int y)
+    /**
+     * This dialog could not be minimized.
+     */
+    public void minimize()
     {
-        // TODO Auto-generated method stub
-        
     }
 
-    public void minimizeWindow()
+    /**
+     * This dialog could not be maximized.
+     */
+    public void maximize()
     {
-        // TODO Auto-generated method stub
-        
     }
 
-    public void maximizeWindow()
+    /**
+     * Implements the <tt>ExportedWindow.bringToFront()</tt> method. Brings this
+     * window to front.
+     */
+    public void bringToFront()
     {
-        // TODO Auto-generated method stub
-        
+        this.toFront();
     }
 }




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