PureMVC Architects Lounge

PureMVC Manifold => MultiCore Version => Topic started by: ryebrye on June 25, 2008, 09:21:21



Title: Using the PureMVC Java port with GWT?
Post by: ryebrye on June 25, 2008, 09:21:21
Has anyone used the PureMVC java port with GWT yet?

I can see how doing a parallel RIA with both GWT and Flex would be made much easier using PureMVC in both pieces.

Anyone tried it yet?


Title: Re: Using the PureMVC Java port with GWT?
Post by: puremvc on June 26, 2008, 08:18:40
Yes, actually they have.

Luchiano Broussal, owner of GWM (the GWT WindowManager framework: http://www.gwtwindowmanager.org), recently alerted me that he had successfully ported the Java port to GWT.

Apparently it was necessary to actually port the port, due to GWT constraints. Here is what he recently told me:

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 GWT
I'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 MacroCommand

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

If you're interested in this port, then definitely contact Luciano over at his site, and see how you might get involved with it early. Otherwise, keep an eye out here, and you're sure to hear about it soon.

-=Cliff>


Title: Re: Using the PureMVC Java port with GWT?
Post by: lbroussal on June 26, 2008, 10:08:15
Hi,

Thank you Cliff  for the summary.
I will provide very soon the source code.
Is it needed you open a new tab of the existing puremvc versions.

I don't know if you prefer i deliver it to you first or on the forum ....

Let me know but yes PureMVC works for GWT :)

Luciano
--
http://www.gwtwindowmanager.org


Title: Re: Using the PureMVC Java port with GWT?
Post by: puremvc on June 26, 2008, 10:27:31
Luciano,

Send it to me first for review and we'll see how to position it for distribution.

Thanks,
-=Cliff>


Title: Re: Using the PureMVC Java port with GWT?
Post by: lbroussal on July 09, 2008, 12:30:27
hi Cliff,

Thank you.
I received mail about interest about the GWT port :)
To interested People :

I've delivered my version to the smart puremvc team.
They have to masterize it before delivering the official GWT version. As you can notice Pure MVC is a well designed and a well documented product. All this work as to be done on the GWT version to be well integrated with all existing PureMVC port.

Please hold on and keep confident.

Particular Thank you to Donald and Cliff.

Luciano
--
http://www.gwtwindowmanager.org


Title: Re: Using the PureMVC Java port with GWT?
Post by: MMauny on July 09, 2008, 02:48:48
Hi all,

I'm interested in this port.
How long do you think the validation will take?

Moreover Luciano made non gwt changes to PureMVC, did this change will be merge with Java trunc?

Matthieu


Title: Re: Using the PureMVC Java port with GWT?
Post by: dominik on July 09, 2008, 06:17:19
Same here,

it would be great to have this port from Luciano for GWT ASAP.

Thanks for this contribution Luciano.

Greetings

Dominik


Title: Re: Using the PureMVC Java port with GWT?
Post by: atrox on July 09, 2008, 06:21:03
I haven't looked at it yet, but am *definitely* very interested.  Just noting the interest here to bump the thread ;).


Title: Re: Using the PureMVC Java port with GWT?
Post by: glidealong on July 15, 2008, 01:56:34
Any updates please..?.. I am really interested in this topic, cuz that would really help us in streamlining our development process in both GWT and the Flex areas..

Cliff or anyother team members, can you give us some feedback on the status?

Thanks in advance.


Title: Re: Using the PureMVC Java port with GWT?
Post by: puremvc on July 15, 2008, 06:02:31
Don is looking at this now and working with Luciano to determine the best way to handle this. We don't want to do a whole separate java port just for GWT. Instead we want to have a special build target that produces the jar for GWT.

Luciano does, I believe have his custom port available on his site, and if you really need to get ripping with it, you could start there.

Just know that more than likely the key difference between the eventual GWT support that the Java port will offer and the version on Luciano's site now is the package space.

He has org.puremvc.puremvc4gwt.*, I believe, and here it will be org.puremvc.java.*

So you'll have to swap jars and change your imports at a minimum. I don't yet know if there will be any method signature or practice changes, that's what Don and Luciano are sorting out.

-=Cliff>


Title: Re: Using the PureMVC Java port with GWT?
Post by: twentyseven on August 29, 2008, 07:09:48
Do you have any update on this topic ?

Thanks,


Title: Re: Using the PureMVC Java port with GWT?
Post by: glidealong on September 03, 2008, 08:46:55
Sorry to say this, i had been very impressed by the simplicity and effectiveness of puremvc for Flex development, we were waiting for this release to align gwt/flex development on similar lines. We cannot wait any longer for this to be a reality , bye for now to puremvc, we are planning to write a puremvc like framework implementation in GWT.

Anyway keep up the great work and thanks for the lightweight framework in AS3.

Best Regards,
Hafiz


Title: Re: Using the PureMVC Java port with GWT?
Post by: lbroussal on September 17, 2008, 03:19:29
Hi all,

The actual version is available at http://code.google.com/p/purevmc4gwt/


Fill free to join the crew, me ;).

An official port space will be opened in the futur on PureMVC.

Cheers.

Luciano


Title: Re: Using the PureMVC Java port with GWT?
Post by: Tekool on September 17, 2008, 05:05:52
Hi,

I talk about it to a Java Developer colleague of mines that play a lot with GWT. I asked him to have a look into it. ;)



Title: Re: Using the PureMVC Java port with GWT?
Post by: puremvc on September 17, 2008, 05:07:01
I had intended to get the port set up in the repo this weekend but my plans were unfotunately foiled. It is still high on my list this week.

-=Cliff>


Title: Re: Using the PureMVC Java port with GWT?
Post by: lbroussal on September 17, 2008, 08:39:56
Hi,

I talk about it to a Java Developer colleague of mines that play a lot with GWT. I asked him to have a look into it. ;)




Thanks Ted.

Let me know.


Title: Re: Using the PureMVC Java port with GWT?
Post by: lbroussal on September 17, 2008, 08:41:28
No Problem Cliff,

That let's the possibility to the community to start playing with it.

For sure will be even better when a space to it will be available here.

Thanks.

Luciano


Title: Re: Using the PureMVC Java port with GWT?
Post by: WBrandonMartin on October 26, 2008, 03:34:35
I'm new to PureMVC and gwt, but I had trouble with the getSubCommandList() in the command Provider.  It worked as long as there was only one macro command registered, but when I went to add more, I had to change this to make it work correctly?  Is there another forum to discuss this kind of issue.  In case anyone else is having the same issue the change was  (I'm unsure of the actual cause):
:
//old: if(GWT.getTypeName(commandClass.getClass()).equals(GWT.getTypeName(StartupCommand.class.getClass()))) {
        if(commandClass.getName().equals(StartupCommand.class.getName())) {//new