Author: jerome
Date: 2008-08-17 07:15:57 +0200 (Sun, 17 Aug 2008)
New Revision: 1528

Modified:
   
software_suite_v2/software/tools/chatterTux/trunk/Chatter_tux/src/ConfInterface.java
Log:
* Parse ini stored api command for displaying.

Modified: 
software_suite_v2/software/tools/chatterTux/trunk/Chatter_tux/src/ConfInterface.java
===================================================================
--- 
software_suite_v2/software/tools/chatterTux/trunk/Chatter_tux/src/ConfInterface.java
        2008-08-16 19:08:31 UTC (rev 1527)
+++ 
software_suite_v2/software/tools/chatterTux/trunk/Chatter_tux/src/ConfInterface.java
        2008-08-17 05:15:57 UTC (rev 1528)
@@ -392,7 +392,7 @@
                                        storeAsIni();
                                }
                        });
-                       this.okEdition.setLocation(new Point(294, 2));
+                       this.okEdition.setLocation(new Point(294, 100));
                        this.editPanel.add(this.okEdition);
                        int x = this.actionModifier.getX();
                        int y = this.actionModifier.getY() + 4 + 
this.actionModifier.getHeight();
@@ -424,18 +424,21 @@
                String title = "";
                String text = "";
                String action = "";
+               String value = "";
                Hashtable <String, String> values = 
properties.getProperties(key);
                
                if(values.get("action").equalsIgnoreCase("tts")){
                        action = "Tux say a message";
                        title = "Message: ";
+                       value = values.get("cmd");
                }
                else if(values.get("action").equalsIgnoreCase("api")){
                        action = "Tux moves his body";
                        title = "Command: ";
+                       value = this.parseCommand(values.get("cmd"));
                }
                
-               text = "Action: " + action + "\n" + title + values.get("cmd");
+               text = "Action: " + action + "\n" + title + value;
                parameters.setText(text);
        }
        
@@ -448,7 +451,23 @@
                
        }
        
+       /*
+        * Parse tux api command to return a human comprehensive sentense.
+        */
+       public String parseCommand(String command){
+               StringBuffer returns = new StringBuffer();
+               if(command.contains("tux")) returns.append("Tux ");
+               if(command.contains("eyes")) returns.append("open his eyes");
+               else if(command.contains("mouth")) returns.append("open his 
mouth");
+               else if(command.contains("flippers")) returns.append("moves his 
flippers");
+               else if(command.contains("led.both")) returns.append("blink his 
leds");
+               else if(command.contains("led.left")) returns.append("blink his 
left led");
+               else if(command.contains("left.right")) returns.append("blink 
his right led");
+               
+               return returns.toString();
+       }
        
+       
        private class ServerControlActionListener implements ActionListener{
 
                public void actionPerformed(ActionEvent e) {


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Tux-droid-svn mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tux-droid-svn

Reply via email to