Author: ulhume
Date: 2008-08-02 13:15:10 +0200 (Sat, 02 Aug 2008)
New Revision: 1445

Modified:
   
software_suite_v2/software/tools/tuxdroid-gadget-tester/trunk/tuxdroid-gadget-tester/sources/com/kysoh/tuxdroid/gadget/framework/tester/GadgetPanel.java
Log:
Modified to handle multiple command for a gadget. 

Modified: 
software_suite_v2/software/tools/tuxdroid-gadget-tester/trunk/tuxdroid-gadget-tester/sources/com/kysoh/tuxdroid/gadget/framework/tester/GadgetPanel.java
===================================================================
--- 
software_suite_v2/software/tools/tuxdroid-gadget-tester/trunk/tuxdroid-gadget-tester/sources/com/kysoh/tuxdroid/gadget/framework/tester/GadgetPanel.java
    2008-08-02 11:14:45 UTC (rev 1444)
+++ 
software_suite_v2/software/tools/tuxdroid-gadget-tester/trunk/tuxdroid-gadget-tester/sources/com/kysoh/tuxdroid/gadget/framework/tester/GadgetPanel.java
    2008-08-02 11:15:10 UTC (rev 1445)
@@ -50,16 +50,19 @@
 
 public class GadgetPanel extends JPanel {
 
-       public class StartAction extends TreeActionItem {
+       public class GadgetCommandAction extends TreeActionItem {
+               private final GadgetToken command;
+
                @Override
                public void actionPerformed(ActionEvent e) {
                        GadgetInstance instance = gadget.create();
-                       instance.start(gadgetParametersEditor.getValues());
+                       instance.start(command, 
gadgetParametersEditor.getValues());
 
                }
 
-               public StartAction() {
-                       super("start");
+               public GadgetCommandAction(GadgetToken token) {
+                       super(token.getDescription());
+                       this.command = token;
                }
        }
 
@@ -107,20 +110,6 @@
                }
        }
 
-       public class CommandInstanceAction extends InstanceAction {
-               private final GadgetToken token;
-
-               @Override
-               public void actionPerformed(ActionEvent e) {
-                       getInstance().sendCommand(token.getName());
-               }
-
-               public CommandInstanceAction(GadgetInstance instance, 
GadgetToken token) {
-                       super(token.getName(), instance);
-                       this.token = token;
-               }
-       }
-
        private static class TreeActionItem extends AbstractAction {
                public TreeActionItem(String label) {
                        super(label);
@@ -248,9 +237,7 @@
                public void starting(GadgetInstance instance) {
                        TreeActionItem item = new InstanceAction("Instance #" + 
instance.getId(), instance);
                        item.getActions().add(new 
AbortInstanceAction(instance));
-                       for (GadgetToken token : gadget.getCommands()) {
-                               item.getActions().add(new 
CommandInstanceAction(instance, token));
-                       }
+
                        actionsRoot.getActions().add(item);
                        ((ActionsListModel) actionsTree.getModel()).update();
                }
@@ -296,7 +283,9 @@
 
                // Actions
                actionsRoot = new 
TreeActionItem(gadget.getDescription().getName());
-               actionsRoot.getActions().add(new StartAction());
+               for (GadgetToken token : gadget.getCommands()) {
+                       actionsRoot.getActions().add(new 
GadgetCommandAction(token));
+               }
                actionsRoot.getActions().add(new StopAllAction());
                actionsTree = new JTree(new ActionsListModel());
                actionsTree.addMouseListener(new ActionTreeMouseObserver());
@@ -356,7 +345,6 @@
                console.append("  " + description.getName() + " v" + 
description.getVersion() + " [" + description.getAuthor() + "]");
                console.append("  " + description.getDescription());
                console.append("  UUID        : " + description.getUuid());
-               console.append("  execution   : " + 
description.getExecutionMode());
                console.append("  WorkingPath : " + 
gadget.getInterpreter().getWorkingPath());
                console.append("  iconFile    : " + description.getIconFile());
                console.append("  HelpFile    : " + gadget.getHelpFile());


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