+ @Override
+ public CommandContext handleCommands(List<Pair<WidgetData, ICommand>> data, CommandContextMutable context, Object component) {
+
+ // Build a linked list of commands
+
+ ArrayList<IEventCommand> commands = new ArrayList<IEventCommand>();
+ for(Pair<WidgetData, ICommand> pair : data) {
+ WidgetData d = pair.first;
+
+ ICommand c = pair.second;
+ IEventCommand p = d.eventCommand(c, null);
+// if(component != null && p != null)
+// p.setTrigger(component);
+ if(p != null) {
+ if(!commands.isEmpty())
+ commands.get(commands.size()-1).setNext(p);
+ commands.add(p);
+ }
+ }
+
+ // Execute the first command, the linked list handles the rest of them
+ if(!commands.isEmpty()) {
+ try {
+ commands.get(0).handleCommand(context);
+ } finally {
+ }
+ }
+ return context;
+ }
+