Author: remi
Date: 2009-01-16 16:35:27 +0100 (Fri, 16 Jan 2009)
New Revision: 3480

Modified:
   
software_suite_v2/software/tools/attitunesStudio/trunk/src/GUI/AttituneCmdConf.java
   software_suite_v2/software/tools/attitunesStudio/trunk/src/MainFrame.java
   
software_suite_v2/software/tools/attitunesStudio/trunk/src/com/tuxisalive/attitunes/messages.properties
   
software_suite_v2/software/tools/attitunesStudio/trunk/src/com/tuxisalive/attitunes/messages_en.properties
   
software_suite_v2/software/tools/attitunesStudio/trunk/src/com/tuxisalive/attitunes/messages_es.properties
   
software_suite_v2/software/tools/attitunesStudio/trunk/src/com/tuxisalive/attitunes/messages_fr.properties
   
software_suite_v2/software/tools/attitunesStudio/trunk/src/com/tuxisalive/attitunes/messages_nl.properties
Log:
* Added function to check if a block can be validate.
* Added the check of the charger in condition of a spinning block validation.
* Added messages string for this condition.

Modified: 
software_suite_v2/software/tools/attitunesStudio/trunk/src/GUI/AttituneCmdConf.java
===================================================================
--- 
software_suite_v2/software/tools/attitunesStudio/trunk/src/GUI/AttituneCmdConf.java
 2009-01-16 15:31:29 UTC (rev 3479)
+++ 
software_suite_v2/software/tools/attitunesStudio/trunk/src/GUI/AttituneCmdConf.java
 2009-01-16 15:35:27 UTC (rev 3480)
@@ -392,6 +392,45 @@
                }
        }
        
+       public static int checkConditionBeforeValidateBlockConf(ATTBlockViewer 
attBlockViewer)
+       {
+               if (selectedStruct == null)
+               {
+                       return 1;
+               }
+               
+               // Dongle must be plugged
+               if (!attBlockViewer.tux.dongle.getConnected())
+               {
+                       return 2;
+               }
+               
+               // Tux droid must be connected to the dongle
+               if (!attBlockViewer.tux.radio.getConnected())
+               {
+                       return 3;
+               }
+               
+               String cmd = (String)selectedStruct.get("cmd");
+               
+               // With a spinning block, the charger must be unplugged
+               if ((cmd.equals("spinl_on")) || (cmd.equals("spinr_on")))
+               {
+                       Object[] chargerState = 
attBlockViewer.tux.status.requestOne("charger_state");
+                       if (chargerState[0] == null)
+                       {
+                               return 4;
+                       }
+
+                       if (!chargerState[0].equals("UNPLUGGED"))
+                       {
+                               return 4;
+                       }
+               }
+
+               return 0;
+       }
+       
        /**
         * 
         * @param attBlockViewer

Modified: 
software_suite_v2/software/tools/attitunesStudio/trunk/src/MainFrame.java
===================================================================
--- software_suite_v2/software/tools/attitunesStudio/trunk/src/MainFrame.java   
2009-01-16 15:31:29 UTC (rev 3479)
+++ software_suite_v2/software/tools/attitunesStudio/trunk/src/MainFrame.java   
2009-01-16 15:35:27 UTC (rev 3480)
@@ -818,23 +818,41 @@
         */
        private void onValidateBlockMouseClicked(MouseEvent evt)
        {       
-               if (!attBlockViewer.tux.dongle.getConnected())
+               int condition;
+               
+               condition = 
AttituneCmdConf.checkConditionBeforeValidateBlockConf(attBlockViewer);
+               
+               switch (condition)
                {
+               // All conditions done
+               case 0:
+                       AttituneCmdConf.validateBlockConf(attBlockViewer);
+                       return;
+               // No block selected
+               case 1:
+                       return;
+               // Dongle unplugged
+               case 2:
                        JOptionPane.showMessageDialog(this, 
                                        ATTMessages.getString("MainFrame.103"), 
                                        ATTMessages.getString("MainFrame.1"), 
                                        JOptionPane.WARNING_MESSAGE);
                        return;
-               }
-               if (!attBlockViewer.tux.radio.getConnected())
-               {
+               // Radio not connected
+               case 3:
                        JOptionPane.showMessageDialog(this, 
                                        ATTMessages.getString("MainFrame.104"), 
                                        ATTMessages.getString("MainFrame.1"), 
                                        JOptionPane.WARNING_MESSAGE);
                        return;
+               // Charger plugged and spinning block
+               case 4:
+                       JOptionPane.showMessageDialog(this, 
+                                       ATTMessages.getString("MainFrame.105"), 
+                                       ATTMessages.getString("MainFrame.1"), 
+                                       JOptionPane.WARNING_MESSAGE);
+                       return;
                }
-               AttituneCmdConf.validateBlockConf(attBlockViewer);
        }
        
        /* 
------------------------------------------------------------------------

Modified: 
software_suite_v2/software/tools/attitunesStudio/trunk/src/com/tuxisalive/attitunes/messages.properties
===================================================================
--- 
software_suite_v2/software/tools/attitunesStudio/trunk/src/com/tuxisalive/attitunes/messages.properties
     2009-01-16 15:31:29 UTC (rev 3479)
+++ 
software_suite_v2/software/tools/attitunesStudio/trunk/src/com/tuxisalive/attitunes/messages.properties
     2009-01-16 15:35:27 UTC (rev 3480)
@@ -24,6 +24,7 @@
 MainFrame.102=Validate
 MainFrame.103=Your USB fish is disconnected, operation canceled
 MainFrame.104=Tuxdroid is disconnected, operation canceled
+MainFrame.105=Your Tux Droid is currently recharging. Please unplug the 
recharger to enable the spinning function.
 BlockConf.0=Count :
 BlockConf.1=Speed :
 BlockConf.2=No parameter

Modified: 
software_suite_v2/software/tools/attitunesStudio/trunk/src/com/tuxisalive/attitunes/messages_en.properties
===================================================================
--- 
software_suite_v2/software/tools/attitunesStudio/trunk/src/com/tuxisalive/attitunes/messages_en.properties
  2009-01-16 15:31:29 UTC (rev 3479)
+++ 
software_suite_v2/software/tools/attitunesStudio/trunk/src/com/tuxisalive/attitunes/messages_en.properties
  2009-01-16 15:35:27 UTC (rev 3480)
@@ -24,6 +24,7 @@
 MainFrame.102=Validate
 MainFrame.103=Your USB fish is disconnected, operation canceled
 MainFrame.104=Tuxdroid is disconnected, operation canceled
+MainFrame.105=Your Tux Droid is currently recharging. Please unplug the 
recharger to enable the spinning function.
 BlockConf.0=Count :
 BlockConf.1=Speed :
 BlockConf.2=No parameter

Modified: 
software_suite_v2/software/tools/attitunesStudio/trunk/src/com/tuxisalive/attitunes/messages_es.properties
===================================================================
--- 
software_suite_v2/software/tools/attitunesStudio/trunk/src/com/tuxisalive/attitunes/messages_es.properties
  2009-01-16 15:31:29 UTC (rev 3479)
+++ 
software_suite_v2/software/tools/attitunesStudio/trunk/src/com/tuxisalive/attitunes/messages_es.properties
  2009-01-16 15:35:27 UTC (rev 3480)
@@ -24,6 +24,7 @@
 MainFrame.102=Validar
 MainFrame.103=Su pez USB esta desconectado, operacion cancelada
 MainFrame.104=Tuxdroid esta desconectado, operacion cancelada
+MainFrame.105=Your Tux Droid is currently recharging. Please unplug the 
recharger to enable the spinning function.
 BlockConf.0=Cantidad :
 BlockConf.1=Velocidad :
 BlockConf.2=Sin valor

Modified: 
software_suite_v2/software/tools/attitunesStudio/trunk/src/com/tuxisalive/attitunes/messages_fr.properties
===================================================================
--- 
software_suite_v2/software/tools/attitunesStudio/trunk/src/com/tuxisalive/attitunes/messages_fr.properties
  2009-01-16 15:31:29 UTC (rev 3479)
+++ 
software_suite_v2/software/tools/attitunesStudio/trunk/src/com/tuxisalive/attitunes/messages_fr.properties
  2009-01-16 15:35:27 UTC (rev 3480)
@@ -24,6 +24,7 @@
 MainFrame.102=Valider
 MainFrame.103=Le poisson USB n'est pas branch�, l'op�ration est annul�e
 MainFrame.104=Tuxdroid n'est pas allum�, l'op�ration est annul�e
+MainFrame.105=Votre Tux droid est actuellement en charge. Veuillez d�brancher 
le chargeur pour activer les fonctions de rotation.
 BlockConf.0=Nombre :
 BlockConf.1=Vitesse :
 BlockConf.2=Pas de param�tre

Modified: 
software_suite_v2/software/tools/attitunesStudio/trunk/src/com/tuxisalive/attitunes/messages_nl.properties
===================================================================
--- 
software_suite_v2/software/tools/attitunesStudio/trunk/src/com/tuxisalive/attitunes/messages_nl.properties
  2009-01-16 15:31:29 UTC (rev 3479)
+++ 
software_suite_v2/software/tools/attitunesStudio/trunk/src/com/tuxisalive/attitunes/messages_nl.properties
  2009-01-16 15:35:27 UTC (rev 3480)
@@ -24,6 +24,7 @@
 MainFrame.102=Valideren
 MainFrame.103=De USB vis is niet verbonden. De opdracht werd geannuleerd.
 MainFrame.104=Tux Droid is niet verbonden. De opdracht werd geannuleerd.
+MainFrame.105=Je Tux Droid is aan het opladen. Gelieve de oplader los te 
koppelen zodat Tux Droid kan ronddraaien.
 BlockConf.0=Aantal :
 BlockConf.1=Snelheid :
 BlockConf.2=Geen parameter


------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
Tux-droid-svn mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tux-droid-svn

Reply via email to