Author: jerome
Date: 2009-02-11 23:33:49 +0100 (Wed, 11 Feb 2009)
New Revision: 3610

Modified:
   
software_suite_v2/software/control_center/trunk/control_center/sources/com/tuxdroid/cc/CcCommons.java
   
software_suite_v2/software/control_center/trunk/control_center/sources/com/tuxdroid/cc/Utils/Watcher.java
   
software_suite_v2/software/control_center/trunk/control_center/sources/com/tuxdroid/cc/Utils/ZIP.java
   
software_suite_v2/software/control_center/trunk/control_center/sources/com/tuxdroid/cc/swing/TuxUpdateWindow.java
Log:
* Removed unused import.
* Removed useless static function.
* updated typo 
* Added head functions comments.

Modified: 
software_suite_v2/software/control_center/trunk/control_center/sources/com/tuxdroid/cc/CcCommons.java
===================================================================
--- 
software_suite_v2/software/control_center/trunk/control_center/sources/com/tuxdroid/cc/CcCommons.java
       2009-02-11 22:06:26 UTC (rev 3609)
+++ 
software_suite_v2/software/control_center/trunk/control_center/sources/com/tuxdroid/cc/CcCommons.java
       2009-02-11 22:33:49 UTC (rev 3610)
@@ -24,7 +24,6 @@
 package com.tuxdroid.cc;
 
 import java.io.File;
-import java.io.IOException;
 import java.util.Vector;
 
 import javax.swing.ImageIcon;
@@ -148,11 +147,4 @@
                Locutors.add("emma");
                logger.appendDone();    
        }
-       
-       /**
-        * Hide cc from other classes.
-        */
-       public static void hideCc(){
-               CcCommons.CcFrame.setVisible(false);
-       }
 }

Modified: 
software_suite_v2/software/control_center/trunk/control_center/sources/com/tuxdroid/cc/Utils/Watcher.java
===================================================================
--- 
software_suite_v2/software/control_center/trunk/control_center/sources/com/tuxdroid/cc/Utils/Watcher.java
   2009-02-11 22:06:26 UTC (rev 3609)
+++ 
software_suite_v2/software/control_center/trunk/control_center/sources/com/tuxdroid/cc/Utils/Watcher.java
   2009-02-11 22:33:49 UTC (rev 3610)
@@ -38,19 +38,33 @@
        public static Object sender;
        public static int interval = 6;
 
-       public Watcher(){
+       /**
+        * This object implements a simple job that is triggered every 6 
seconds,
+        * The watcher check if they have a new attitune added/removed, if it's 
the
+        * case, then execute the declared method.
+        */
+       public Watcher()
+       {
                //Scedulling check function.
-               try {
-                       new TaskDefiner("watcher_" + method, this.getClass(), 
interval); //refreshing each 4 seconds.
-               } catch (ObjectAlreadyExistsException e) {}
+               try 
+               {
+                       //Defining a task triggered each 6 seconds.
+                       new TaskDefiner("watcher_" + method, this.getClass(), 
interval);
+               } 
+               catch (ObjectAlreadyExistsException e) 
+               {
+                       ;
+               }
        }
        
        
        /**
-        * Set the method.
-        * @param method
+        * Set the method to start in case of update available.
+        * @param sender : the object that send the method.
+        * @param method : the method to start in case of update.
         */
-       public void onUpdateAvailable(Object sender, String method){
+       public void onUpdateAvailable(Object sender, String method)
+       {
                Watcher.method = method;
                Watcher.target = sender.getClass();
                Watcher.sender = sender;
@@ -58,21 +72,35 @@
        
        
        /**
-        * Refresh attitunes view.
+        * Check if attitune update is available, if something changed,
+        * then start the registered function if not null.
         */
-       public void trigger(){
-               if(AttitunesFunctions.checkForUpdate()){
-                       try{
-                               Method targetMethod = 
target.getDeclaredMethod(method);
-                               targetMethod.invoke(sender, (Object[])null);
-                               
-                       } catch(Exception ex){}
+       public void trigger()
+       {
+               if(AttitunesFunctions.checkForUpdate())
+               {
+                       try
+                       {
+                               if((sender !=null) && (method != null))
+                               {
+                                       Method targetMethod = 
target.getDeclaredMethod(method);
+                                       targetMethod.invoke(sender, 
(Object[])null);
+                               }
+                       } 
+                       catch(Exception ex)
+                       {
+                               ;
+                       }
                }
        }
 
        
+       /**
+        * Interface function that is triggered every 6 seconds.
+        */
        @Override
-       public void execute(JobExecutionContext arg0) throws 
JobExecutionException {
+       public void execute(JobExecutionContext arg0) throws 
JobExecutionException 
+       {
                this.trigger();
        }
 }

Modified: 
software_suite_v2/software/control_center/trunk/control_center/sources/com/tuxdroid/cc/Utils/ZIP.java
===================================================================
--- 
software_suite_v2/software/control_center/trunk/control_center/sources/com/tuxdroid/cc/Utils/ZIP.java
       2009-02-11 22:06:26 UTC (rev 3609)
+++ 
software_suite_v2/software/control_center/trunk/control_center/sources/com/tuxdroid/cc/Utils/ZIP.java
       2009-02-11 22:33:49 UTC (rev 3610)
@@ -51,7 +51,8 @@
      * @param src : Source file.
      * @param dst : Destination directory.
      */
-    public ZIP(File src, File dst) {
+    public ZIP(File src, File dst) 
+    {
         this.src = src;
         this.dst = dst;
     }
@@ -62,29 +63,33 @@
      * @param zos: Zip output Stream
      * @throws IOException 
      */
-    private void zipDir(String dir2zip, ZipOutputStream zos) throws 
IOException  {
-
+    private void zipDir(String dir2zip, ZipOutputStream zos) throws 
IOException  
+    {
         File zipDir = new File(dir2zip);
         String[] dirList = zipDir.list();
         byte[] readBuffer = new byte[MAX_PAQUET_SIZE];
         int bytesIn = 0;
-        for (int i = 0; i < dirList.length; i++) {
-        File f = new File(zipDir, dirList[i]);
-        if (f.isDirectory()) {
-            String filePath = f.getPath();
-            zipDir(filePath, zos);
-            continue;
-        }
-        String entryName = 
f.getAbsolutePath().substring(src.getParent().length() + 1)
-                                       .substring(this.src.getName().length() 
+ 1);
-        FileInputStream fis = new FileInputStream(f);
-        ZipEntry anEntry = new ZipEntry(entryName);
-        zos.putNextEntry(anEntry);
+        for (int i = 0; i < dirList.length; i++) 
+        {
+               File f = new File(zipDir, dirList[i]);
+               if (f.isDirectory()) 
+               {
+                       String filePath = f.getPath();
+                       zipDir(filePath, zos);
+                       continue;
+               }
+               String entryName = 
f.getAbsolutePath().substring(src.getParent().length() + 1)
+                                                  
.substring(this.src.getName().length() + 1);
+               FileInputStream fis = new FileInputStream(f);
+               ZipEntry anEntry = new ZipEntry(entryName);
+               zos.putNextEntry(anEntry);
 
-        while ((bytesIn = fis.read(readBuffer)) != -1)
-            zos.write(readBuffer, 0, bytesIn);
-        zos.closeEntry();
-        fis.close();
+               while ((bytesIn = fis.read(readBuffer)) != -1)
+               {
+                       zos.write(readBuffer, 0, bytesIn);
+               }
+               zos.closeEntry();
+               fis.close();
         }
     }
     
@@ -95,20 +100,31 @@
      * @param level
      * @throws Exception
      */
-    public void compress(int level) throws Exception {
+    public void compress(int level) throws Exception 
+    {
         level = (level < 0) ? 0 : (level > 9) ? 9 : level;
-        if(!dst.exists())
-            dst.createNewFile(); 
+        if(!dst.exists())
+        {
+            dst.createNewFile(); 
+        }
         ZipOutputStream zos = new ZipOutputStream(new FileOutputStream(dst));
         zos.setLevel(level);
         zipDir(src.getAbsolutePath(), zos);
         zos.flush();
         zos.close();
     }
-
-    public void uncompress() throws Exception {
+
+    
+    /**
+     * Uncompress given zip file.
+     * @throws Exception
+     */
+    public void uncompress() throws Exception 
+    {
        if(AttitunesFunctions.log)
+       {
                CcCommons.logger.append("Uncompress atitune " + 
src.getAbsolutePath(), true);
+       }
        ATTFormatCompressor.uncompressAttitune(this.src.getAbsolutePath(), 
this.dst.getAbsolutePath() + "/");
     }
 }
\ No newline at end of file

Modified: 
software_suite_v2/software/control_center/trunk/control_center/sources/com/tuxdroid/cc/swing/TuxUpdateWindow.java
===================================================================
--- 
software_suite_v2/software/control_center/trunk/control_center/sources/com/tuxdroid/cc/swing/TuxUpdateWindow.java
   2009-02-11 22:06:26 UTC (rev 3609)
+++ 
software_suite_v2/software/control_center/trunk/control_center/sources/com/tuxdroid/cc/swing/TuxUpdateWindow.java
   2009-02-11 22:33:49 UTC (rev 3610)
@@ -57,7 +57,7 @@
                this.setSize(550, 450);
                setPreferredSize(getSize());
                
-               CcCommons.hideCc(); //mask control center.
+               CcCommons.CcFrame.setVisible(false);
                add(getConsole());
                add(getProgressBar());
                


------------------------------------------------------------------------------
Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM)
software. With Adobe AIR, Ajax developers can use existing skills and code to
build responsive, highly engaging applications that combine the power of local
resources and data with the reach of the web. Download the Adobe AIR SDK and
Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com
_______________________________________________
Tux-droid-svn mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tux-droid-svn

Reply via email to