Futurescale, Inc. PureMVC Home

The PureMVC Framework Code at the Speed of Thought


Over 10 years of community discussion and knowledge are maintained here as a read-only archive.

New discussions should be taken up in issues on the appropriate projects at https://github.com/PureMVC

Show Posts

* | |

  Show Posts
Pages: [1]
1  PureMVC Manifold / MultiCore Version / Re: Events on GWT on: July 02, 2009, 05:37:30
The best practice guide (Page 13, Notification vs Events) shows that Notifications should be used to communicate between PureMVC actors Mediators, Commands and Proxies.

Yes this is also what i think so i've resolved this issue using the new event system of gwt 1.6 that make possible to define and fire custom event from view that are cached from the mediators:

ex:
:

public FriendshipsPageMediator() {
super(NAME,null);
....
proposeFriendshipView  = new ProposeFriendshipView();
proposeFriendshipView.addNotificationHandler(this);
                ....
}

@Override
public INotificationType<?>[] listNotificationInterests() {
return new INotificationType[]{
NotifiesUserConfiguration.LOADED_USER_PROFILE,
NotifiesFriendshipsModule._PROPOSED_FRIENDSHIP,
NotifiesFriendshipsModule._EDIT_FRIENDSHIP
};
}

@Override
public void handleNotification(INotification<?> notification) {
....
}

@Override
public void onNotificationEvent(NotificationEvent<?> event) {
if (event.is(NotifiesUserSearch.LOAD_USER_PUBLIC_PROFILE))
showProfileOf(event.as(NotifiesUserSearch.LOAD_USER_PUBLIC_PROFILE).body());
}


in the code above when the mediator instantiate it's view component register itself as a listener of NotificationEvents of the view.

so when the view fire a NotificationEvent its onNotificationEvent gets called,
now the mediator can decide if manage localli this events of send an application level Notification build from the NotificationEvent
2  PureMVC Manifold / MultiCore Version / Re: Changes to observerlist when notifying observers not used. on: June 08, 2009, 09:22:28
in my opinion it is far more safe ti itrate on the local copy and not on the original list.
This is because in a multithreaded environment if the list is modified while you are iterating it you can have strange behavior. that said, in gwt  port wer are in a javascript environment and this is monothreaded so it is not an issue but anyway it is more clean because if you notify STARTUP your notification go to the listeners of STARTUP in tha t moment. if soomeone attach new listeners to STARTUP during the STARTUP you will see them only on the next notification of STARTUP.

More on this... it is not very clean add STARTUP listeners during STARTUP. you shuld add all yopur STARPUP listeners statically during the application setup and then invoke once the STARTUP notification.
3  PureMVC Manifold / MultiCore Version / Re: PureMVC4GWT on google code VS multicore port on: May 04, 2009, 12:33:58
hi i haven't seen the CommandProvider impl but IMHO the problem with  gwt is that "no easy form" of reflection is usable so it's difficult to store class Object and then build on demand command instances. It should be done using the deferred binding mechanism that gwt has, but it complicates the design.
4  PureMVC Manifold / MultiCore Version / communication beetween viewComponents and mediator on: March 24, 2009, 09:42:05
hi all
i'm using pureMvc in gwt and i like it!
after reading the doc materials i've found that in the original implementation in Actionscript the comunication from  viewComponents and mediator is implemented in the following way:

mediator -> viewComponents [this is done by directy method invocation]
viewComponents  -> mediator[this is done by dispatching custom events from the components witch the mediator is listening on]


Since now for this interaction i've used the notifications system of pureMvc, but now i
 agree that  the comunication beetween viewComponents and mediators is somewhat local comunication and should not use the notification system.

Unfortunatly before 1.6 the event system of gwt was more primitive of that of flex and was difficult to create and dispatch custom events from components. i've gived a look at the new event system of gwt 1.6 and it seems ther is space for declaring and throwing user defined events, so i'm starting to think that the implementation of puremvc4gwt could align with the best practice highlited in the documentations.

I'm intersted in hear someone opinions in this.

ciao
Federico
5  PureMVC Manifold / Standard Version / Re: comunication beetween viewComponents and mediator on: March 24, 2009, 09:34:57
ok i'll post it on the MultiCore side
6  PureMVC Manifold / Standard Version / comunication beetween viewComponents and mediator on: March 23, 2009, 01:56:38
hi all
i'm using pureMvc in gwt and i like it!
after reading the doc materials i've found that in the original implementation in Actionscript the comunication from  viewComponents and mediator is implemented in the following way:

mediator -> viewComponents [this is done by directy method invocation]
viewComponents  -> mediator[this is done by dispatching custom events from the components witch the mediator is listening on]


Since now for this interaction i've used the notifications system of pureMvc, but now i
 agree that  the comunication beetween viewComponents and mediators is somewhat local comunication and should not use the notification system.

Unfortunatly before 1.6 the event system of gwt was more primitive of that of flex and was difficult to create and dispatch custom events from components. i've gived a look at the new event system of gwt 1.6 and it seems ther is space for declaring and throwing user defined events, so i'm starting to think that the implementation of puremvc4gwt could align with the best practice highlited in the documentations.

I'm intersted in hear someone opinions in this.

ciao
Federico

7  PureMVC Manifold / Standard Version / Re: Enums for Notification names? on: March 09, 2009, 08:51:17
+1 for enum as notifications name, when the application grows the eventuality of name collisions became more and more high.
and you can use a safe switch in the handleNotification of a Mediator
Pages: [1]