Over 10 years of community discussion and knowledge are maintained here as a read-only archive.
Most of the modification i had to do are :- i had to package the source for GWT since the packaging on GWT is specific.- GWT doesnt support reflective API so newInstance call into Controller and MacroCommand can't be run that way under GWTI've introducted a CommandProvider interface instead /** * @author lbroussal */import org.puremvc.java.client.interfaces.ICommand;import org.puremvc.java.client.patterns.command.MacroCommand;public interface CommandProvider { public ICommand getCommand(String command); public List<ICommand> getSubCommandList(Class<? extends MacroCommand> commandClass);}this is registered on the Facade and used into the Controller and into the MacroCommandinto the Controller-------------------------- public void registerCommandProvider(CommandProvider commandProvider) { this.commandProvider = commandProvider; }public void executeCommand( INotification note ) { Class<ICommand> commandClassRef = this.commandMap.get( note.getName() ); if (commandClassRef == null) { return; } try { ICommand commandInstance = commandProvider.getCommand( note.getName()); commandInstance.execute( note ); } catch (Exception iae) { } }into MacroCommand------------------------------ public void execute(INotification notification) { List<ICommand> subCommandsList = facade.getCommandProvider().getSubCommandList(this.getClass()); for (ICommand command : subCommandsList) { command.execute(notification); } }The Provider itself---------------------------public class MyCommandProvider implements CommandProvider { public ICommand getCommand(String command) { if(command.equals(ApplicationFacade.STARTUP)) return new StartupCommand(); if(command.equals(ApplicationFacade.SUBMIT_LOGIN)) return new ProcessLogin(); return null; } public List<ICommand> getSubCommandList(Class<? extends MacroCommand> commandClass) { List<ICommand> subCommands = new ArrayList<ICommand>(); if(GWT.getTypeName(commandClass.getClass()).equals(GWT.getTypeName(StartupCommand.class.getClass()))) { subCommands.add(new PrepViewCommand()); subCommands.add(new PrepModelCommand()); }else { throw new RuntimeException("Unknow type command " + commandClass); } return subCommands; } }I've also try to use generic as much as possible and interface so i've changed some declaration from Vector to List and Hashtable to Map.I've to clean and package a bit more and i will send you the code.