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 2 [3] 4
31  Announcements and General Discussion / Architecture / Re: AsyncMacroCommand (with a ChainNotifier style Mediator) on: October 09, 2008, 09:18:47
Not be pushy Cliff (although I must admit I can be!) any news on when this will be available? I definitely have a real need for it and would love to drop it in even test it out.
32  Announcements and General Discussion / General Discussion / Re: Removing mediators and views on: October 06, 2008, 05:37:38

Curious about this since I've wondered the same about where to remove mediators. I have a Flex PopUp or an AIR Window each with its own mediator. I have a command create and display it so its easily created from different inputs (buttons, keyboard shortcuts, etc.). Should I have another command remove the mediator for those windows too? Or is it ok to let the mediator remove itself from the framework?
33  Announcements and General Discussion / Architecture / Re: AsyncMacroCommand (with a ChainNotifier style Mediator) on: October 06, 2008, 04:28:01
Excellent! Did he talk to you through email or through a thread? I'd love to test out or start using the utility! How does he handle adding event handlers without adding them to the command thus giving the command state?
34  Announcements and General Discussion / Architecture / Re: AsyncMacroCommand (with a ChainNotifier style Mediator) on: October 06, 2008, 12:46:25

I'm curious then what you would suggest that would make it feel better with the rest of the framework? Don't take that as a snotty question, I'm being serious as I really have an interest in making commands work with asynchronous actions but that doesn't deviate away from the API the framework provides for creating and executing commands.

I thought it was a very clever approach with ChainNotifier and figured with some enhancements it could be made to conform to the framework. I agree though its taking the Mediator for something else that doesn't mediate the view. I would use a Proxy here as it would fit (I think at least) but it has no way of receiving replies. I don't think it would work with a Proxy.

Curious to hear your suggestions as its something I really would love for the framework to have and I think others would agree. It would be so nice to have a command that encapsulates all your calls to sub commands that each are asynchronously waiting for a response but fired in order by using the addSubCommand() call just like you would with a sync macro command.

35  Announcements and General Discussion / Architecture / AsyncMacroCommand (with a ChainNotifier style Mediator) on: October 03, 2008, 12:14:16
I've looked at the ChainNotifier http://forums.puremvc.org/index.php?topic=422.0 but its not necessarily what I expected. I've been wanting an approach that follows more the PureMVC flow, API... not sure what word I'm looking for here. Looking for something that feels PureMVCish.

@cliff, @binarycrafts

I think I have an idea that will solve some of your concerns that you mentioned in the ChainNotifier utility topic (link above).

I envision say.. an AsyncMarcoCommand, that would implement ICommand and INotifier that you call addSubCommand for each asynchronous command you wanted fired in order. Now before you all cry foul let me explain the handling for these sub commands!

Using something similar to the ChainNotifier, the AsyncMacroCommand would add each sub command to an instance of a AsyncCommandMediator (I can't think of a better name at the moment so don't get to caught up on this one!). This is crucial since Cliff makes a good point that the mediator after being registered will have to be de-registered.

How to handle the de-registration? Well with each addSubCommand call you would add in the notification it sends on complete. The AsyncCommandMediator would know (since its listening for all those notifications) when the last notification fires thus being able to remove itself from the framework.

What does this solve?

1. The command won't have state! Yay!
2. Since a mediator is registered it will handle removing itself from the framework when its done
3. Every time you issue a new AsyncMacroCommand it will always register a new instance of AsyncCommandMediator (and safely deregister when all commands are completed)
4. Sticks to the API the PureMVC framework provides for sequencing commands (only now it works with async ones!)
5. Provides a map.. an easy to read sequence of the commands being fired in one place. No more having to go search for each sendNotification call that triggers the next command. Woo hoo!

Brainstorming this just now what do you guys think? Would something like this work? Say the word and R&D will begin!
36  Announcements and General Discussion / Getting Started / Re: Courseware on: October 03, 2008, 12:11:10
Not to be pushy Cliff but anything new on this? ;)
37  Announcements and General Discussion / Architecture / Re: Alert prompt (with close handler) in a command? on: September 24, 2008, 03:05:38

Always can count on a reply from you. :) Don't know how you do it! My problem though is that this is just a simple Alert. No need for an MXML popup, although I will be saving and using that PopManager technique for when I do!

Maybe I should use that approach with a unique class, AlertManager, but it doesn't take a mediator. Say... pass it a notification for each of the different alert options (yes/no,etc.)?? Or only the ones you need.

If I add a anonymous function to the Alert.show() call within a command, does that command still have state? I'm wondering if by defining the function even anonymously (inline with the show() call) still creates state in the command? It just seems so natural to put this into command rather than elsewhere.

38  Announcements and General Discussion / Architecture / Re: Registering Multiple Instances of one Mediator and Proxy: A Best Practice on: September 24, 2008, 10:25:11

Great to hear everything has worked out. :) Re-reading the documentation certainly helps out a lot more. It has for me at least. If I had known that your problem was related to the SuperTabNavigator (I use that a lot here at work) I would have pointed you right away to the Slacker demo! Cliff has done an amazing job with that! It really helps understand how to handle deferred instantiation better.

Good luck with your journey into proxies! If you have more questions let us know. Always happy to help.
39  Announcements and General Discussion / Architecture / Alert prompt (with close handler) in a command? on: September 24, 2008, 10:20:07
I know commands are good places to have common actions that need to happen from different views in your app. For example, if you display a pop up based on a keyboard event, a button click and even some other action, abstracting that repeated code into a command is useful. I have a situation where I'm building a desktop application where there is much more communication going on between components and am wondering if a command fits well with what I'm trying to do. Let me explain.

I have a List and AppControlBar component each with its own mediator. When an item is selected the AppControlBar is notified and has a tracker (variable) for that item. A "Delete" button is in the control bar (plus many other item-selected dependent actions) that displays an Alert prompt with Yes/No buttons. Pretty straightforward. The catch is that I've added a key down handler on the List component so if the user hits their DELETE key I want to trigger that same Alert prompt but that is defined within the AppControlBar MXML component.

Is this where I would take that block of code with the Alert prompt and move it into a command? Seems like an easy question but I'm not really used to knowing exactly when to use commands and when not too. My concern here is that the Alert needs a close handler and I know commands shouldn't have state. Would the code for the Alert prompt still go in a command?

40  Announcements and General Discussion / Architecture / Re: Registering Multiple Instances of one Mediator and Proxy: A Best Practice on: September 22, 2008, 04:47:24
My problem with the getProxyName was the meaning wasn't enough. I hated having to see so many sendNotification calls with a third parameter of getProxyName and getMediatorName. I have had others look at me puzzled wondering what that does. I've been trying to find a good name like "actorGroupId" or "tag" something that you know when you set that third parameter of the sendNotification call its a bit more meaningful. All preference really.
41  Announcements and General Discussion / Architecture / Re: Registering Multiple Instances of one Mediator and Proxy: A Best Practice on: September 22, 2008, 08:54:32

I've provided sample code in the first post. Honestly, its nothing more than that. It's pretty bare bones so I don't think a full example will be of much use. The trick is to knowing that you have to register that multi instance mediator and/or proxies with a unique name. All of the grunt work happens in the command.
42  Announcements and General Discussion / Public Demos, Tools and Applications / Re: New PureMVC AIR Utility - NetworkMonitor on: August 27, 2008, 09:01:38
Cliff please don't apologize! I don't see how this would really be any different. You have an AIR client interacting with a remote service (in my case its only one, hence the creation of this utility) or several and by knowing if the app is online or offline you have no real other choice but checking against a URL or socket. Hence why this uses the URLMonitor. You simply give it a URL and if it pings it and doesn't get a valid request it then marks the app as offline. It could still be enhanced to say something like: your Network 1 available or whatever.

Either way what did you think about what I sent? Now understanding what I'm going for as is, does it do the job? Is it a utility you would be willing to accept for PureMVC? Let me know. I'm more than open for suggestions/enhancements. It currently does all I need it too but since I'm doing this for the first time I don't have much experience. I figured people who have built many more AIR apps will have different needs.

I'm hoping others chime in and let me know their thoughts. I can post the code now if others are interested since I've tested it and for me its complete for what I need. I can do that tomorrow.
43  Announcements and General Discussion / Public Demos, Tools and Applications / Re: New PureMVC AIR Utility - NetworkMonitor on: August 27, 2008, 09:59:47
Cliff thanks for the reply! It currently only supports 1 URLMonitor but I don't see why I couldn't have the proxy handle multiple ones. I'll definitely add support for that. I was thinking this would be desirable by some. I'll just assume that if 1 of all your URLs being monitored gives a status then I know you are online. Would you want to know individually about each monitor and whether you are online? Currently, I send an ONLINE or OFFLINE notification depending on the status. Maybe I do the same but for each monitor? Would be strange though I think, not as simple.

Maybe I should change the constants to START_MONITORING and STOP_MONITORING and I would store the URLs in an array and when stopping, you would pass the same URL and it would be removed from the array. Hmm would need to support though a STOP_ALL_MONITORS.

The code is definitely up to snuff. It's got all ASDoc comments in and I used your XMLDatabase and DesktopCitizen as examples to follow. Quite proud of what I got here. It's simple but I think you'll be pleased. Let me send you what I have with a working example and I'll start working on these new features.
44  Announcements and General Discussion / Public Demos, Tools and Applications / New PureMVC AIR Utility - NetworkMonitor on: August 26, 2008, 01:51:49
I had an idea for a simple PureMVC AIR utility that will send out a notification when your application is offline or online. I'm building my first offline-supported AIR PureMVC application so this is something of value to me. I would love to tap into a notification that is clear and simple: ONLINE or OFFLINE. I can simply register a command with this notification and I can do whatever work necessary when either online or offline. This is the main goal of the utility.

The utility has 2 commands and 1 proxy. The NetworkMonitorProxy to put it simply handles a URLMonitor instance. Once you tell it to start you have no other work to do. No need to add an event listener on NativeApplication.nativeApplication either! The NetworkMonitorProxy will listen for a status event on the URLMonitor instance and using its "available" property determines whether to send an ONLINE or OFFLINE notification. Simple.

Before being able to start the monitor you need to simply register this command:

registerCommand(NetworkMonitor.START_MONITOR, StartNetworkMonitorCommand);

To start the monitor send the following notification with a body being a URL to monitor:

sendNotification(NetworkMonitor.START_MONITOR, "www.myservice.com");

You would follow the same procedures for stopping a monitor with the only difference being sending no body to fire off the command. Also as a helper NetworkMonitorProxy sends out to notifications when a monitor has started NetworkMonitor.MONITOR_STARTED and when it has stopped NetworkMonitor.MONITOR_STOPPED.

Basically all you are going to want to do is handle the following notification constants in your mediators or register it to fire off a custom command: NetworkMonitor.ONLINE or NetworkMonitor.OFFLINE depending on what you need. When these notifications are sent the notification body is the NetworkMonitorProxy instance. I did this since I have several properties you might want access too say for logging or other purposes. Those read-only properties include:

  • online
  • startedOn
  • statusChangedOn
  • url

I couldn't think of anymore to add in but if any of you have ideas let me know. I'd like to see what features you guys might need but I figure since this is pretty simple and straightforward much if not nothing at all else would be needed. I plan to share the code but I'm unfamiliar with procedure of getting a utility out as I would need to change the namespace for PureMVC first.


I've talked to you through email about creating PureMVC utilities and what their namespaces should be. I've completed this utility locally and would love to finally be able to offer something back to the PureMVC community. What do I need to do to get this submitted for approval? Just zip up and send you the code? Commit it to an SVN repo you create? Let me know.
45  Announcements and General Discussion / General Discussion / Re: Nested View - Manage Mediators. on: August 17, 2008, 06:22:22
Sweet thanks Cliff! Then I'm very much looking forward to it! If you don't mind I'd like to offer my post on registering multiple instances of the same mediator and proxies for a component. I can touch it up a bit though. Either way very looking forward to the FAQ. The folks at my work will be sure to check it out as well. Thanks!
Pages: 1 2 [3] 4