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

yanas at dev.java.net yanas at dev.java.net
Fri Apr 13 16:04:01 CEST 2007


User: yanas   
Date: 2007-04-13 14:04:01+0000
Modified:
   sip-communicator/src/net/java/sip/communicator/impl/gui/utils/ConfigurationManager.java
   sip-communicator/src/net/java/sip/communicator/impl/systray/SystrayActivator.java
   sip-communicator/src/net/java/sip/communicator/impl/gui/main/menus/ViewMenu.java
   sip-communicator/src/net/java/sip/communicator/impl/gui/main/menus/QuickMenu.java
   sip-communicator/src/net/java/sip/communicator/impl/gui/main/CommunicatorMain.java
   sip-communicator/src/net/java/sip/communicator/impl/gui/main/MainFrame.java
   sip-communicator/src/net/java/sip/communicator/impl/gui/main/contactlist/ContactList.java
   sip-communicator/src/net/java/sip/communicator/impl/gui/main/call/CallManager.java
   sip-communicator/src/net/java/sip/communicator/impl/gui/main/chat/menus/SettingsMenu.java
   sip-communicator/src/net/java/sip/communicator/impl/gui/GuiActivator.java

Log:
 1) Save the "isMinimized" property. Issue N 344
 2) some enhancements on the way the ConfigurationService is accessed from the gui

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.1&r2=1.2
Delta lines:  +77 -8
--------------------
--- ConfigurationManager.java	2007-02-09 08:50:32+0000	1.1
+++ ConfigurationManager.java	2007-04-13 14:03:57+0000	1.2
@@ -16,18 +16,48 @@
      */
     private static boolean autoPopupNewMessage;
 
-    public static void loadGuiConfigurations()
-    {
-        ConfigurationService configService
+    private static boolean isCallPanelShown;
+    
+    private static boolean isShowOffline;
+    
+    private static boolean isApplicationVisible;
+    
+    private static ConfigurationService configService
             = GuiActivator.getConfigurationService();
         
+    public static void loadGuiConfigurations()
+    {   
         String autoPopup = configService.getString(
             "net.java.sip.communicator.impl.gui.autoPopupNewMessage");
     
+        String callPanelShown = configService.getString(
+            "net.java.sip.communicator.impl.gui.showCallPanel");
+    
+        String showOffline = configService.getString(
+            "net.java.sip.communicator.impl.gui.showOffline");
+        
+        String isVisible = configService.getString(
+            "net.java.sip.communicator.impl.systray.showApplication");
+    
         if(autoPopup == null || autoPopup.equalsIgnoreCase("yes"))
             autoPopupNewMessage = true;
         else
             autoPopupNewMessage = false;
+        
+        if(callPanelShown != null && callPanelShown != "")
+        {
+            isCallPanelShown = new Boolean(callPanelShown).booleanValue();
+        }
+        
+        if(showOffline != null && showOffline != "")
+        {
+            isShowOffline = new Boolean(showOffline).booleanValue();
+        }
+
+        if(isVisible != null && isVisible != "")
+        {
+            isApplicationVisible = new Boolean(isVisible).booleanValue();
+        }
     }
     
     public static boolean isAutoPopupNewMessage()
@@ -35,13 +65,25 @@
         return autoPopupNewMessage;
     }
 
+    public static boolean isCallPanelShown()
+    {
+        return isCallPanelShown;
+    }
+    
+    public static boolean isShowOffline()
+    {
+        return isShowOffline;
+    }
+    
+    public static boolean isApplicationVisible()
+    {
+        return isApplicationVisible;
+    }
+
     public static void setAutoPopupNewMessage(boolean autoPopupNewMessage)
     {
         ConfigurationManager.autoPopupNewMessage = autoPopupNewMessage;
         
-        ConfigurationService configService
-                = GuiActivator.getConfigurationService();
-            
         if(autoPopupNewMessage)
             configService.setProperty(
                     "net.java.sip.communicator.impl.gui.autoPopupNewMessage",
@@ -51,4 +93,31 @@
                     "net.java.sip.communicator.impl.gui.autoPopupNewMessage",
                     "no");
     }
+    
+    public static void setShowOffline(boolean isShowOffline)
+    {
+        ConfigurationManager.isShowOffline = isShowOffline;
+        
+        configService.setProperty(
+                "net.java.sip.communicator.impl.gui.showOffline",
+                new Boolean(isShowOffline));
+    }
+    
+    public static void setShowCallPanel(boolean isCallPanelShown)
+    {
+        ConfigurationManager.isCallPanelShown = isCallPanelShown;
+            
+        configService.setProperty(
+                "net.java.sip.communicator.impl.gui.showCallPanel",
+                new Boolean(isCallPanelShown));
+    }
+    
+    public static void setApplicationVisible(boolean isVisible)
+    {
+        isApplicationVisible = isVisible;
+            
+        configService.setProperty(
+                "net.java.sip.communicator.impl.systray.showApplication",
+                new Boolean(isVisible));
+    }
 }

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

File [changed]: SystrayActivator.java
Url: https://sip-communicator.dev.java.net/source/browse/sip-communicator/src/net/java/sip/communicator/impl/systray/SystrayActivator.java?r1=1.1&r2=1.2
Delta lines:  +23 -0
--------------------
--- SystrayActivator.java	2007-04-11 14:12:49+0000	1.1
+++ SystrayActivator.java	2007-04-13 14:03:57+0000	1.2
@@ -7,6 +7,7 @@
 package net.java.sip.communicator.impl.systray;
 
 import net.java.sip.communicator.impl.systray.jdic.*;
+import net.java.sip.communicator.service.configuration.*;
 import net.java.sip.communicator.service.gui.*;
 import net.java.sip.communicator.util.*;
 
@@ -27,6 +28,8 @@
 
     public static UIService uiService;
     
+    private static ConfigurationService configService;
+    
     private static Logger logger = Logger.getLogger(
             SystrayActivator.class.getName());
     
@@ -60,4 +63,24 @@
      */
     public void stop(BundleContext bc) throws Exception {
     }
+    
+
+    /**
+     * Returns the <tt>ConfigurationService</tt> obtained from the bundle
+     * context.
+     * @return the <tt>ConfigurationService</tt> obtained from the bundle
+     * context
+     */
+    public static ConfigurationService getConfigurationService() 
+    {
+        if(configService == null) {
+            ServiceReference configReference = bundleContext
+                .getServiceReference(ConfigurationService.class.getName());
+
+            configService = (ConfigurationService) bundleContext
+                .getService(configReference);
+        }
+
+        return configService;
+    }
 }

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

File [changed]: ViewMenu.java
Url: https://sip-communicator.dev.java.net/source/browse/sip-communicator/src/net/java/sip/communicator/impl/gui/main/menus/ViewMenu.java?r1=1.6&r2=1.7
Delta lines:  +2 -13
--------------------
--- ViewMenu.java	2007-03-09 17:19:53+0000	1.6
+++ ViewMenu.java	2007-04-13 14:03:57+0000	1.7
@@ -55,14 +55,8 @@
         
         this.mainFrame = mainFrame;
 
-        ConfigurationService configService
-            = GuiActivator.getConfigurationService();
-    
-        String isCallPanelShown = configService.getString(
-            "net.java.sip.communicator.impl.gui.showCallPanel");
-
         this.hideCallPanelItem.setSelected(
-            !new Boolean(isCallPanelShown).booleanValue());
+            !ConfigurationManager.isCallPanelShown());
         
         this.add(hideCallPanelItem);
         
@@ -90,12 +84,7 @@
         if (itemName.equals("hideCallPanel")) {
             CallManager callManager = mainFrame.getCallManager();
             
-            if (hideCallPanelItem.isSelected()) {
-                callManager.hideCallPanel();
-            }
-            else {
-                callManager.showCallPanel();
-            }
+            callManager.setCallPanelVisible(!hideCallPanelItem.isSelected());        
         }
     }
 

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.25&r2=1.26
Delta lines:  +2 -3
-------------------
--- QuickMenu.java	2007-04-12 15:33:46+0000	1.25
+++ QuickMenu.java	2007-04-13 14:03:58+0000	1.26
@@ -196,7 +196,6 @@
         }
         else if (buttonName.equals("search"))
         {
-
             ContactList contactList = mainFrame.getContactListPanel()
                 .getContactList();
 
@@ -210,7 +209,7 @@
                     = listModel.getElementAt(currentlySelectedIndex);
             }
 
-            contactList.setShowOffline(!contactList.isShowOffline());
+            contactList.setShowOffline(!ConfigurationManager.isShowOffline());
             
             if (selectedObject != null) {
                 if (selectedObject instanceof MetaContact) {

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

File [changed]: CommunicatorMain.java
Url: https://sip-communicator.dev.java.net/source/browse/sip-communicator/src/net/java/sip/communicator/impl/gui/main/CommunicatorMain.java?r1=1.33&r2=1.34
Delta lines:  +0 -12
--------------------
--- CommunicatorMain.java	2006-11-10 17:17:35+0000	1.33
+++ CommunicatorMain.java	2007-04-13 14:03:58+0000	1.34
@@ -59,18 +59,6 @@
     }
 
     /**
-     * Shows or hides the main application window.
-     * 
-     * @param isVisible <code>true</code> to show the main application
-     * window, <code>false</code> to hide it.
-     */
-    public void showCommunicator(boolean isVisible) {
-        
-        this.mainFrame.loadConfigurationSettings();
-        this.mainFrame.setVisible(isVisible);
-    }
-    
-    /**
      * Returns the main application window.
      * @return the main application window.
      */

File [changed]: MainFrame.java
Url: https://sip-communicator.dev.java.net/source/browse/sip-communicator/src/net/java/sip/communicator/impl/gui/main/MainFrame.java?r1=1.92&r2=1.93
Delta lines:  +8 -49
--------------------
--- MainFrame.java	2007-04-12 15:31:46+0000	1.92
+++ MainFrame.java	2007-04-13 14:03:58+0000	1.93
@@ -102,7 +102,7 @@
         
         this.addWindowListener(new MainFrameWindowAdapter());
 
-        this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
+        //this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
         this.setInitialBounds();
 
         this.setTitle(Messages.getI18NString("sipCommunicator").getText());
@@ -646,25 +646,11 @@
      */
     public class MainFrameWindowAdapter extends WindowAdapter
     {
-        public void windowClosing(WindowEvent e) {
-            ConfigurationService configService
-                = GuiActivator.getConfigurationService();
-
-            try {
-                configService.setProperty(
-                        "net.java.sip.communicator.impl.gui.showCallPanel",
-                        new Boolean(callManager.isShown()));
-
-
-                configService.setProperty(
-                    "net.java.sip.communicator.impl.gui.showOffline",
-                    new Boolean(getContactListPanel()
-                        .getContactList().isShowOffline()));
-
-            }
-            catch (PropertyVetoException e1) {
-                logger.error("The proposed property change "
-                        + "represents an unacceptable value");
+        public void windowClosing(WindowEvent e)
+        {
+            if(!GuiActivator.getUIService().getExitOnMainWindowClose())
+            {   
+                ConfigurationManager.setApplicationVisible(false);
             }
         }
 
@@ -689,33 +675,6 @@
     }
 
     /**
-     * Sets the window size and position.
-     */
-    public void loadConfigurationSettings() {
-        ConfigurationService configService
-            = GuiActivator.getConfigurationService();
-
-        String isCallPanelShown = configService.getString(
-            "net.java.sip.communicator.impl.gui.showCallPanel");
-
-        String isShowOffline = configService.getString(
-            "net.java.sip.communicator.impl.gui.showOffline");
-
-        if(isCallPanelShown != null && isCallPanelShown != "")
-        {
-            callManager.setShown(new Boolean(isCallPanelShown).booleanValue());
-        }
-        else {
-            callManager.setShown(true);
-        }
-
-        if(isShowOffline != null && isShowOffline != "") {
-            getContactListPanel().getContactList()
-                .setShowOffline(new Boolean(isShowOffline).booleanValue());
-        }
-    }
-
-    /**
      * Saves the last status for all accounts. This information is used
      * on loging. Each time user logs in he's logged with the same status
      * as he was the last time before closing the application.

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

File [changed]: ContactList.java
Url: https://sip-communicator.dev.java.net/source/browse/sip-communicator/src/net/java/sip/communicator/impl/gui/main/contactlist/ContactList.java?r1=1.68&r2=1.69
Delta lines:  +6 -13
--------------------
--- ContactList.java	2007-04-11 14:16:38+0000	1.68
+++ ContactList.java	2007-04-13 14:03:58+0000	1.69
@@ -16,8 +16,8 @@
 import javax.swing.text.*;
 
 import net.java.sip.communicator.impl.gui.main.*;
-import net.java.sip.communicator.impl.gui.main.chat.*;
 import net.java.sip.communicator.impl.gui.main.chat.history.*;
+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.protocol.*;
@@ -75,7 +75,6 @@
      */
     public ContactList(MainFrame mainFrame)
     {
-
         this.mainFrame = mainFrame;
 
         this.contactList = mainFrame.getContactList();
@@ -109,6 +108,8 @@
             }
         });
 
+        this.setShowOffline(ConfigurationManager.isShowOffline());
+       
         new ContactListRefresh().start();
     }
 
@@ -1094,16 +1095,6 @@
     }
 
     /**
-     * Returns TRUE if the list shows offline contacts, FALSE otherwise.
-     * 
-     * @return TRUE if the list shows offline contacts, FALSE otherwise
-     */
-    public boolean isShowOffline()
-    {
-        return listModel.isShowOffline();
-    }
-
-    /**
      * Sets the showOffline property.
      * 
      * @param isShowOffline TRUE to show all offline users, FALSE to hide
@@ -1115,6 +1106,8 @@
         
         listModel.setShowOffline(isShowOffline);
         
+        ConfigurationManager.setShowOffline(isShowOffline);
+        
         int newListSize = listModel.getSize();
         
         //hide offline users

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

File [changed]: CallManager.java
Url: https://sip-communicator.dev.java.net/source/browse/sip-communicator/src/net/java/sip/communicator/impl/gui/main/call/CallManager.java?r1=1.31&r2=1.32
Delta lines:  +29 -58
---------------------
--- CallManager.java	2007-04-11 22:09:11+0000	1.31
+++ CallManager.java	2007-04-13 14:03:59+0000	1.32
@@ -84,8 +84,6 @@
 
     private Hashtable activeCalls = new Hashtable();
     
-    private boolean isShown;
-    
     private boolean isCallMetaContact;
     
     private Hashtable removeCallTimers = new Hashtable();
@@ -149,6 +147,8 @@
         this.hangupButton.setEnabled(false);
 
         this.add(minimizeButtonPanel, BorderLayout.SOUTH);        
+        
+        this.setCallPanelVisible(ConfigurationManager.isCallPanelShown());
     }
 
     
@@ -319,7 +319,7 @@
             if(!hideCallPanelItem.isSelected())
                 hideCallPanelItem.setSelected(true);
             
-            this.hideCallPanel();
+            this.setCallPanelVisible(false);
         }
         else if (buttonName.equalsIgnoreCase("restore")) {
             
@@ -329,39 +329,38 @@
             if(hideCallPanelItem.isSelected())
                 hideCallPanelItem.setSelected(false);
             
-            this.showCallPanel();
+            this.setCallPanelVisible(true);
         }
     }
     
     /**
      * Hides the panel containing call and hangup buttons.
      */
-    public void hideCallPanel()
+    public void setCallPanelVisible(boolean isVisible)
+    {
+        if(isVisible)
+        {
+            this.add(comboPanel, BorderLayout.NORTH);
+            this.add(buttonsPanel, BorderLayout.CENTER);
+
+            this.minimizeButtonPanel.removeAll();
+            this.minimizeButtonPanel.add(minimizeButton);
+        }
+        else
     {
         this.remove(comboPanel);
         this.remove(buttonsPanel);
 
         this.minimizeButtonPanel.removeAll();
         this.minimizeButtonPanel.add(restoreButton);
-        this.isShown = false;
         
+            if(mainFrame.isVisible())
         this.mainFrame.getContactListPanel()
             .getContactList().requestFocus();
-
-        this.mainFrame.validate();
     }
     
-    /**
-     * Shows the panel containing call and hangup buttons.
-     */
-    public void showCallPanel()
-    {
-        this.add(comboPanel, BorderLayout.NORTH);
-        this.add(buttonsPanel, BorderLayout.CENTER);
-
-        this.minimizeButtonPanel.removeAll();
-        this.minimizeButtonPanel.add(minimizeButton);
-        this.isShown = true;
+        if(ConfigurationManager.isCallPanelShown() != isVisible)
+            ConfigurationManager.setShowCallPanel(isVisible);
 
         this.mainFrame.validate();
     }
@@ -468,7 +467,7 @@
         
         activeCalls.put(sourceCall, callPanel);
         
-        this.showCallPanel();
+        this.setCallPanelVisible(true);
     }
 
     /**
@@ -618,34 +617,6 @@
     }
 
     /**
-     * Returns TRUE if this panel is visible, FALSE otherwise.
-     * @return TRUE if this panel is visible, FALSE otherwise
-     */
-    public boolean isShown()
-    {
-        return this.isShown;
-    }
-
-    /**
-     * When TRUE shows this panel, when FALSE hides it.
-     * @param isShown
-     */
-    public void setShown(boolean isShown)
-    {
-        this.isShown = isShown;
-
-        if(isShown) {
-            this.add(comboPanel, BorderLayout.NORTH);
-            this.add(buttonsPanel, BorderLayout.CENTER);
-
-            this.minimizeButtonPanel.add(minimizeButton);
-        }
-        else {
-            this.minimizeButtonPanel.add(restoreButton);
-        }
-    }
-    
-    /** 
      * Answers the given call.
      * @param call the call to answer
      */

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

File [changed]: SettingsMenu.java
Url: https://sip-communicator.dev.java.net/source/browse/sip-communicator/src/net/java/sip/communicator/impl/gui/main/chat/menus/SettingsMenu.java?r1=1.1&r2=1.2
Delta lines:  +4 -1
-------------------
--- SettingsMenu.java	2007-03-12 17:38:41+0000	1.1
+++ SettingsMenu.java	2007-04-13 14:03:59+0000	1.2
@@ -77,6 +77,9 @@
         String autoPopup = configService.getString(
             "net.java.sip.communicator.impl.gui.autoPopupNewMessage");
 
+        String typingNotif = configService.getString(
+            "net.java.sip.communicator.impl.gui.autoPopupNewMessage");
+
         if(messageCommand == null || messageCommand.equalsIgnoreCase("enter"))
             this.sendingMessageCommandItem.setSelected(false);
         else

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

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.26&r2=1.27
Delta lines:  +5 -2
-------------------
--- GuiActivator.java	2007-04-11 14:15:54+0000	1.26
+++ GuiActivator.java	2007-04-13 14:03:59+0000	1.27
@@ -63,6 +63,8 @@
 
         GuiActivator.bundleContext = bundleContext;
         
+        ConfigurationManager.loadGuiConfigurations();
+        
         this.communicatorMain = new CommunicatorMain();
 
         MainFrame mainFrame = communicatorMain.getMainFrame();
@@ -91,8 +93,9 @@
 
             logger.info("UI Service ...[REGISTERED]");
             
-            ConfigurationManager.loadGuiConfigurations();
-            communicatorMain.showCommunicator(true);
+            if(ConfigurationManager.isApplicationVisible())
+                mainFrame.setVisible(true);
+            
             SwingUtilities.invokeLater(new RunLogin());
             
             uiService.initExportedWindows();




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