Author: ulhume
Date: 2008-08-15 01:44:15 +0200 (Fri, 15 Aug 2008)
New Revision: 1491

Modified:
   
software_suite_v2/software/gadgets/DemosGadgets/tuxdroid-gadget-java-samples/trunk/tuxdroid-gadget-java-samples/sources/net/karmaLab/tuxDroid/gadgets/HelloWorldGadget.java
   
software_suite_v2/software/gadgets/tuxdroid-gadget-clock/trunk/tuxdroid-gadget-clock/sources/net/karmaLab/tuxDroid/gadgets/ClockGadget.java
   
software_suite_v2/software/gadgets/tuxdroid-gadget-feed/trunk/tuxdroid-gadget-feed/sources/net/karmaLab/tuxDroid/gadgets/FeedGadget.java
   
software_suite_v2/software/gadgets/tuxdroid-gadget-weather/trunk/tuxdroid-gadget-weather/sources/net/karmaLab/tuxDroid/gadgets/WeatherGadget.java
   
software_suite_v2/software/tuxdroid-gadget-framework/trunk/tuxdroid-gadget-framework/sources/com/kysoh/tuxdroid/gadget/framework/container/interpreters/GadgetInterpreter.java
   
software_suite_v2/software/tuxdroid-gadget-framework/trunk/tuxdroid-gadget-framework/sources/com/kysoh/tuxdroid/gadget/framework/container/interpreters/GadgetJavaInterpreter.java
   
software_suite_v2/software/tuxdroid-gadget-framework/trunk/tuxdroid-gadget-framework/sources/com/kysoh/tuxdroid/gadget/framework/gadget/SimpleGadget.java
Log:
throwMessageNotification => throwNotification

Modified: 
software_suite_v2/software/gadgets/DemosGadgets/tuxdroid-gadget-java-samples/trunk/tuxdroid-gadget-java-samples/sources/net/karmaLab/tuxDroid/gadgets/HelloWorldGadget.java
===================================================================
--- 
software_suite_v2/software/gadgets/DemosGadgets/tuxdroid-gadget-java-samples/trunk/tuxdroid-gadget-java-samples/sources/net/karmaLab/tuxDroid/gadgets/HelloWorldGadget.java
 2008-08-14 16:31:42 UTC (rev 1490)
+++ 
software_suite_v2/software/gadgets/DemosGadgets/tuxdroid-gadget-java-samples/trunk/tuxdroid-gadget-java-samples/sources/net/karmaLab/tuxDroid/gadgets/HelloWorldGadget.java
 2008-08-14 23:44:15 UTC (rev 1491)
@@ -84,7 +84,7 @@
         */
        @Override
        public void start() {
-               throwMessageNotification("Hello World, %s", 
configuration().getMessage());
+               throwMessage("Hello World, %s", configuration().getMessage());
        }
 
 }

Modified: 
software_suite_v2/software/gadgets/tuxdroid-gadget-clock/trunk/tuxdroid-gadget-clock/sources/net/karmaLab/tuxDroid/gadgets/ClockGadget.java
===================================================================
--- 
software_suite_v2/software/gadgets/tuxdroid-gadget-clock/trunk/tuxdroid-gadget-clock/sources/net/karmaLab/tuxDroid/gadgets/ClockGadget.java
 2008-08-14 16:31:42 UTC (rev 1490)
+++ 
software_suite_v2/software/gadgets/tuxdroid-gadget-clock/trunk/tuxdroid-gadget-clock/sources/net/karmaLab/tuxDroid/gadgets/ClockGadget.java
 2008-08-14 23:44:15 UTC (rev 1491)
@@ -57,7 +57,7 @@
                if (m != 0) {
                        format += " et " + m + " minutes";
                }
-               throwMessageNotification(format);
+               throwMessage(format);
        }
 
 }

Modified: 
software_suite_v2/software/gadgets/tuxdroid-gadget-feed/trunk/tuxdroid-gadget-feed/sources/net/karmaLab/tuxDroid/gadgets/FeedGadget.java
===================================================================
--- 
software_suite_v2/software/gadgets/tuxdroid-gadget-feed/trunk/tuxdroid-gadget-feed/sources/net/karmaLab/tuxDroid/gadgets/FeedGadget.java
    2008-08-14 16:31:42 UTC (rev 1490)
+++ 
software_suite_v2/software/gadgets/tuxdroid-gadget-feed/trunk/tuxdroid-gadget-feed/sources/net/karmaLab/tuxDroid/gadgets/FeedGadget.java
    2008-08-14 23:44:15 UTC (rev 1491)
@@ -122,9 +122,9 @@
                        }
                        if (!found) {
                                
configuration().getLastTitles().insertElementAt(entry.getTitle(), 0);
-                               
throwMessageNotification(configuration().getTitle() + ":" + 
entry.getTitle().trim() + ".");
+                               throwMessage(configuration().getTitle() + ":" + 
entry.getTitle().trim() + ".");
                                if (configuration().isReadDescription()) {
-                                       
throwMessageNotification(entry.getTextDescription() + ".\n");
+                                       throwMessage(entry.getTextDescription() 
+ ".\n");
                                }
                        }
                        count--;

Modified: 
software_suite_v2/software/gadgets/tuxdroid-gadget-weather/trunk/tuxdroid-gadget-weather/sources/net/karmaLab/tuxDroid/gadgets/WeatherGadget.java
===================================================================
--- 
software_suite_v2/software/gadgets/tuxdroid-gadget-weather/trunk/tuxdroid-gadget-weather/sources/net/karmaLab/tuxDroid/gadgets/WeatherGadget.java
   2008-08-14 16:31:42 UTC (rev 1490)
+++ 
software_suite_v2/software/gadgets/tuxdroid-gadget-weather/trunk/tuxdroid-gadget-weather/sources/net/karmaLab/tuxDroid/gadgets/WeatherGadget.java
   2008-08-14 23:44:15 UTC (rev 1491)
@@ -105,10 +105,10 @@
                // wind = humidity.split("\\s+:\\s+")[1];
                String message = String.format("Les conditions actuelles sur %s 
sont \"%s\" avec une température de %s degrés %s. Le taux d'humidité est de 
%s.", configuration().getLocation(), weather, temperature,
                                configuration().getUnit() == Unit.celcius ? 
"celcius" : "fareneight", humidity);
-               throwMessageNotification(message);
+               throwMessage(message);
                message = String.format("Les conditions actuelles sur %s sont 
\"%s\" avec une température de %s degrés %s. Le taux d'humidité est de %s.", 
configuration().getLocation(), weather, temperature, configuration().getUnit() 
== Unit.celcius ? "celcius"
                                : "fareneight", humidity);
-               throwMessageNotification(message);
+               throwMessage(message);
                current = xmlReply.getElementAt(3);
                weather = getData(current, "condition");
                temperature = getData(current, "low");
@@ -116,9 +116,9 @@
                // icon = new ImageIcon(new URL("http://www.google.com"; +
                // getData(current, "icon")));
                message = String.format("Le temps demain sera \"%s\" avec des 
températures allant de %s à  %s degrés.", weather, temperature, 
temperatureHigh);
-               throwMessageNotification(message);
+               throwMessage(message);
                message = String.format("Le temps demain sera \"%s\" avec des 
températures allant de %s à %s degrés.", weather, temperature, temperatureHigh);
-               throwMessageNotification(message);
+               throwMessage(message);
                throwTrace("Test trace");
        }
 }

Modified: 
software_suite_v2/software/tuxdroid-gadget-framework/trunk/tuxdroid-gadget-framework/sources/com/kysoh/tuxdroid/gadget/framework/container/interpreters/GadgetInterpreter.java
===================================================================
--- 
software_suite_v2/software/tuxdroid-gadget-framework/trunk/tuxdroid-gadget-framework/sources/com/kysoh/tuxdroid/gadget/framework/container/interpreters/GadgetInterpreter.java
      2008-08-14 16:31:42 UTC (rev 1490)
+++ 
software_suite_v2/software/tuxdroid-gadget-framework/trunk/tuxdroid-gadget-framework/sources/com/kysoh/tuxdroid/gadget/framework/container/interpreters/GadgetInterpreter.java
      2008-08-14 23:44:15 UTC (rev 1491)
@@ -23,6 +23,7 @@
 package com.kysoh.tuxdroid.gadget.framework.container.interpreters;
 
 import java.io.File;
+import java.util.Vector;
 
 import net.karmaLab.shell.CommandResult;
 import net.karmaLab.shell.Shell;
@@ -65,25 +66,23 @@
        }
 
        public final int run(Shell shell, GadgetToken command) throws 
ShellTransortException {
-
-               String commandLine = prepareCommandLine();
+               Vector<String> arguments = new Vector<String>();
+               prepareCommandLine(arguments);
                if (command != null) {
-                       commandLine += " " + command.getName();
+                       arguments.add(command.getName());
                }
-               CommandResult result = shell.run(commandLine);
+               String[] args = arguments.toArray(new String[arguments.size()]);
+               CommandResult result = shell.run(args);
 
                return result.exitStatus();
        }
 
-       protected String prepareCommandLine() {
-               String commandLine = getExecutable();
+       protected void prepareCommandLine(Vector<String> arguments) {
                if (SystemInformation.isUnix()) {
-                       commandLine = "./" + commandLine;
+                       arguments.add("./" + getExecutable());
                } else {
-                       commandLine = "cmd /c " + commandLine;
+                       arguments.add("cmd /c " + getExecutable());
                }
-               System.err.println(commandLine);
-               return commandLine;
        }
 
        /**

Modified: 
software_suite_v2/software/tuxdroid-gadget-framework/trunk/tuxdroid-gadget-framework/sources/com/kysoh/tuxdroid/gadget/framework/container/interpreters/GadgetJavaInterpreter.java
===================================================================
--- 
software_suite_v2/software/tuxdroid-gadget-framework/trunk/tuxdroid-gadget-framework/sources/com/kysoh/tuxdroid/gadget/framework/container/interpreters/GadgetJavaInterpreter.java
  2008-08-14 16:31:42 UTC (rev 1490)
+++ 
software_suite_v2/software/tuxdroid-gadget-framework/trunk/tuxdroid-gadget-framework/sources/com/kysoh/tuxdroid/gadget/framework/container/interpreters/GadgetJavaInterpreter.java
  2008-08-14 23:44:15 UTC (rev 1491)
@@ -68,7 +68,7 @@
        }
 
        @Override
-       protected String prepareCommandLine() {
+       protected void prepareCommandLine(Vector<String> arguments) {
                Vector<File> classPathFiles = new Vector<File>();
                classPathFiles.add(new File("."));
                classPathFiles.addAll(libraries);
@@ -104,7 +104,12 @@
                } else {
                        tmp = classpath.toString();
                }
-               return String.format("java -cp %s %s %s", tmp.toString(), 
getParameters(), getExecutable());
+               arguments.add("java");
+               arguments.add("-cp");
+               arguments.add(tmp.toString());
+               // if (getParameters()!=null)
+               // arguments.add(getParameters());
+               arguments.add(getExecutable());
        }
 
        /**

Modified: 
software_suite_v2/software/tuxdroid-gadget-framework/trunk/tuxdroid-gadget-framework/sources/com/kysoh/tuxdroid/gadget/framework/gadget/SimpleGadget.java
===================================================================
--- 
software_suite_v2/software/tuxdroid-gadget-framework/trunk/tuxdroid-gadget-framework/sources/com/kysoh/tuxdroid/gadget/framework/gadget/SimpleGadget.java
   2008-08-14 16:31:42 UTC (rev 1490)
+++ 
software_suite_v2/software/tuxdroid-gadget-framework/trunk/tuxdroid-gadget-framework/sources/com/kysoh/tuxdroid/gadget/framework/gadget/SimpleGadget.java
   2008-08-14 23:44:15 UTC (rev 1491)
@@ -22,6 +22,9 @@
 
 package com.kysoh.tuxdroid.gadget.framework.gadget;
 
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.io.Writer;
 import java.util.Map;
 
 import net.karmaLab.beans.BeanProxyFactory;
@@ -96,6 +99,9 @@
                                throwTrace("   " + key + ":" + stringValue);
                                BeanReflectiveProxy proxy = 
BeanProxyFactory.defaultFactory().build(configuration.getClass());
                                BeanProperty property = proxy.getProperty(key);
+                               if (property == null) {
+                                       throw new SimpleGadgetException("No 
property (getter/setter) found for parameter '" + key + "'");
+                               }
                                AbstractStringConverter converter = 
StringConverters.instance().get(property.getType());
                                if (converter == null) {
                                        throw new SimpleGadgetException("Unable 
to find conversion for : " + property.getType());
@@ -118,8 +124,8 @@
         * @param content
         *            message content
         */
-       protected void throwMessageNotification(String content, Object... 
arguments) {
-               Object[] tmp = new String[arguments.length + 1];
+       protected void throwMessage(String content, Object... arguments) {
+               Object[] tmp = new Object[arguments.length + 1];
                tmp[0] = content;
                System.arraycopy(arguments, 0, tmp, 1, arguments.length);
                throwNotification("message", tmp);
@@ -151,7 +157,7 @@
                        loadEnvironementData();
                        start();
                } catch (Throwable e) {
-                       throwNotification("error", e.getLocalizedMessage());
+                       throwError(e);
                }
        }
 
@@ -228,7 +234,14 @@
         *            Exception to throw.
         */
        protected void throwError(Throwable throwable) {
-               throwTrace(throwable.toString());
+               if (configuration.isTraces()) {
+                       final Writer result = new StringWriter();
+                       final PrintWriter printWriter = new PrintWriter(result);
+                       throwable.printStackTrace(printWriter);
+                       throwNotification("error", result.toString());
+               } else {
+                       throwNotification("error", throwable.getMessage());
+               }
 
        }
 
@@ -239,7 +252,7 @@
         */
        @Deprecated
        protected void speak(String message) {
-               throwMessageNotification(message);
+               throwMessage(message);
        }
 
        /**


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