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
1  Announcements and General Discussion / Public Demos, Tools and Applications / Re: State Machine on: October 15, 2008, 12:47:55
Hi Guys,
Sorry it's been a while since my last post, I've had so many multi-projects going on just finding time to breathe was becoming an issue... :o
I have noticed that the chaining utility has a flaw when assigning multiple commands unless you reregister the mediator
Cliff, is it possible to have a hook into the registration process to allow reinitialization for the notification of interest?
(For this to happen behind the scenes so the programmer doesn't have to do with reregistering mediator)
also it looks like some fantastic work is being done with a state machine from "Fleecie" I'm not sure if he's facing the same issues and look forward to experimenting with this development.
It would be nice to have a PureMVC sanctioned style of state machine and if I can be of help (with what little time I have) it may be good to continue along Fleecie development trunk so as to not fragment and help provide a solidified end product.

As always
keep well
Trilec
2  PureMVC Manifold / Port Authority / Re: C++ on: June 25, 2008, 01:31:53
Ive started looking at it but was trying to get a feel for who else might be interested and C++ and understands some of the possible issues data storage/multi core id/approch etc and of course more minds are better.
I was concidering using stl map functions but perhaps a fast and simple hash table could be used instead of using the STL or ever STL vector class and passing a reference into the array for the ID fastest method.
another question is how much to emulate flash data structures or just keep witl STL etc

comments welcome
curt [Trilec]

3  PureMVC Manifold / Port Authority / C++ on: May 29, 2008, 07:30:57
Anyone looking at this or interested in?

C++ / STL or some form

Trilec
4  Announcements and General Discussion / Public Demos, Tools and Applications / Re: Notification Chaining Utility on: May 29, 2008, 07:20:42
The utility in its true form is a mediator.
when you create a ChainNotifier it is added to the system in order to receve events.
when an event is recived it sends out the next event.

if the ChainNotifier is in another mediator, issues maybe if you delete the org  mediator
you will also need to remove the created  ChainNotifier .
these is support for onRemove() so it will clean up after itself when removed

iF you are also using the new version, unique action names will be based on the supplied name
so no conflict should occure.

var chainNotifier:ChainNotifier = new ChainNotifier("MYCHAINNAME");

Trilec

5  Announcements and General Discussion / General Discussion / Proxy onRegister Notification - execution order on: May 09, 2008, 10:32:50
Hi All, was doing a few tests (multicore) and noticed some interesting behavior which is related to execution order.

The goal seemed fairly simple, A proxy sends  ApplicationFacade.IM_INITIALIZED, from within its onRegister() but as it appears MODELS done first then VIEWS thus  no "MY DATA IS INITIALIZED" Notification can't be sent from a proxy to a mediator at this startup stage, this can however can be done from a Mediator which would request "INITIALIZE yourself" then the proxy would respond IM_INITIALIZED

notifyObservers: ImInitialized
notifyObservers: StartupInitialized
notifyObservers: Startup

It almost seems like you need a Notification registered in a proxy that gets sent when ALL MODEL/VIEW are registered??
is there a framework suggestion (besides the Mediator call INITIALIZE proxy to get Notification  out)

T
6  Announcements and General Discussion / General Discussion / Re: Notification firing multiple times in multicore version on: May 09, 2008, 09:00:52
have you tried running a small trace on the ApplicationFacade notifyObservers

Placed in your ApplicationFacade
This should report all notifications going on
:

...
import  org.puremvc.as3.multicore.interfaces.INotification; //will need this
...

override public function notifyObservers ( notification:INotification ):void {
if ( view != null ) {
view.notifyObservers( notification );
trace("notifyObservers: " + notification.getName());
}
}

T
7  Announcements and General Discussion / Public Demos, Tools and Applications / Re: Moonlighting - My first PureMVC website: AS3, Papervision, and a lil SWFAddress on: May 09, 2008, 06:19:38
Yes, came to the same conclusion Gags, was also discussing with Pedr about this exact topic.
My train of thought was that in a simplistic manner and striving for loose coupling the question I felt was "what is SWFAddress communicating", one could look at this as displaying the status of navigation to a user in a URL field
therefore this could be looked at as a form of view thus a mediator, the mediator is updating a URL text field and as I found with the chaining utility the mediator already has built in support for sending and receiving notification which would seem that important part in the SWFAddress process.

I'm not sure where Pedr is up to but he was looking into re-factoring this into a mediator.

T

8  Announcements and General Discussion / Public Demos, Tools and Applications / Re: Notification Chaining Utility on: April 30, 2008, 10:27:12
Version Update:
*Ability to add your own actions, better documentation and toString function for debugging
*Mediator name now must be supplied, and will generate unique Action notifications names based on the Actions Mediator name.
ChainNotifier("MYCHAINNAME");
would yeld ...
MYCHAINNAME_ACTION_START
MYCHAINNAME_ACTION_STOP
.. etc

This helps the programmer by not having to deal with creating unique Action notifications in a multi-Chain environment. (but can still be overridden)

-- See top post for latest link

T
9  Announcements and General Discussion / Public Demos, Tools and Applications / Re: Notification Chaining Utility on: April 29, 2008, 03:07:32
Yes I did debate this for a while as well, but it in the end I wanted what ever was simpler.
I feel the role it is providing is still one of mediation, talking to the system through notifications, but instead off discussing this with a view it discusses it with itself...lol (may be a stretch here and could lead to madness).
Also I was looking towards allowing action notifications  (which would manipulate the chain) and felt could accomplish this cleaner by using the mediator.

T
10  Announcements and General Discussion / Public Demos, Tools and Applications / Re: Notification Chaining Utility on: April 28, 2008, 04:33:52
Hi Cliff,
The concept behind "Actions" was put in after I realized the potential need for more in-depth means of control flow.
An example of this may be a repeating chain of events and within this repetition certain notifications may wish to be skipped, stopped, paused or moved to the end if certain logic conditions are met etc.
at first was wondering about basing nodes on a tree structure where branches could be active or inactive and processing of events could take interesting paths depending on state logic.

But certainly in its infancy simplicity is best, you press a button and can guarantee a string of events will fire in an asynchronous manner (useful if you're also trying to maintain transitional states)

I like your idea of inter-core communication seems interesting. I am just finishing up an interesting way to manage styles without using any of the flash style manages as I'm trying to do dynamic styles at runtime and this could be a useful method of notifying widgets of the style update.

T
11  Announcements and General Discussion / Public Demos, Tools and Applications / Re: Notification Chaining Utility on: April 28, 2008, 03:54:06
Version Update:

*Cliff Suggestions added
*Naming Changed
*Keywords Changes "ACTION"
*Subclass of mediator
*Docs Changed
*camelCase Adjustments

-- See top post for latest link

T
12  Announcements and General Discussion / Public Demos, Tools and Applications / Notification Chaining Utility on: April 28, 2008, 08:26:59
Hi All,
In an effort to simplify chaining of events within the pureMVC framework, I created a small utility based upon a mediator.
Its purpose is to accept a list of notifications in the order in which you would like them to be processed.
As the Chain Notifier is asynchronous it can be used for transitions or server-side communication, it merely responds to user defined notifications before moving to the next link in its chain keeping things simple and in one place.

In this example the Chain Notifier is within the execution body of a command.
but could be setup where ever you load your mediators.

ApplicationFacade
:
        override protected function initializeController( ) : void
        {
            super.initializeController();           
            registerCommand( STARTUP, StartUpCommand );
            registerCommand( STAGE_INITIALIZED, StageInitializedCommand );
        }

StageInitializedCommand
:
public class  StageInitializedCommand extends SimpleCommand
{
/**
* Register the Proxies.
*/
override public function execute( note:INotification ) :void
{
// Register the chainNotifier Mediator and establish chain linkages.
var chainNotifier:ChainNotifier = new ChainNotifier();
chainNotifier.AddNode( ApplicationFacade.SPLASH_SHOW, ApplicationFacade.SPLASH_INITIALIZED, note.getBody() ); //include note for startup
chainNotifier.AddNode( ApplicationFacade.PROGRESSBAR_SHOW, ApplicationFacade.PROGRESSBAR_INITIALIZED);
chainNotifier.AddNode( ApplicationFacade.LOGIN_SHOW, ApplicationFacade.LOGIN_INITIALIZED);
facade.registerMediator( chainNotifier ); //onRegister will start first notification
}
} ///class
In my example the note.Body was supplied so my splash screen would have a stage VO.
the SPLASH_INITIALIZED notification is what triggers the next link ie: PROGRESSBAR_SHOW and so on.
obviously the last one LOGIN_INITIALIZED does not have anthing to trigger and so is a little superfluous.. :-)

SplashCanvasMediator using chain notification
:
override public function handleNotification( note:INotification ):void
{
var stageVO:StageVO = note.getBody() as StageVO;
switch ( note.getName() )
{
case ApplicationFacade.STAGE_RESIZED:
canvas.setSize(stageVO.screenW, stageVO.screenH);
break;
case ApplicationFacade.SPLASH_SHOW:
//sendNotification will cause chain to next() using canvas as body for next chain link
canvas.init(stageVO.screenW, stageVO.screenH, styleProxy.style);
this.sendNotification( ApplicationFacade.SPLASH_INITIALIZED, canvas );
break;
}
}
as it integrates into the framework using notifications the ChainNotifier can be dropped in place with a minimal of effort and helps maintain a loosely coupled system.

Syntax Overview:
 
Main ChainNotifier Constructor
 the class is conceptually a asynchronous queuing system referred to as a chain
 transition between nodes (links) is controlled through the use of notifications inthe pureMVC framework
 
 You can choose to override the default generated action trigger notifications names if needed, but should not be needed
 Base action names are appended to the Mediator name to insure unique action names for any givin ChainNotifier
 in this example , ChainNotifier("MYCHAINNAME"); ... would yeld MYCHAINNAME_ACTION_START, MYCHAINNAME_ACTION_STOP .. etc
 
 public function ChainNotifier( qname:String,
          qstart:String="_ACTION_START",
          qstop:String="_ACTION_STOP",
          qcontinue:String="_ACTION_CONTINUE",
          qend:String="_ACTION_END",
          qnext:String="_ACTION_NEXT",
          qprev:String="_ACTION_PREV",
          qclear:String="_ACTION_CLEAR",
          qsetactive:String="_ACTION_SETACTIVE" ) :void
 
 eg: var chainNotifier:ChainNotifier = new ChainNotifier("MYCHAINNAME");
 
 @param qname - name of chain, If using defaults this name will be added to Action notification names
 @param qstart - Action start at the beginning of the queue and send first initial notification
 @param qstop - Action pause at current queue position, receiving of notifications except Actions, will be paused
 @param qcontinue - Action continue from pause position,activation of notifications will be enabled
 @param qend - Action skip to end node and send notification
 @param qnext - tAction node Move to nextAction Node and send notification , default behavior
 @param qprev - Action node Move back and repeat send notification
 @param qclear - Action will remove all nodes in array and free memory (no resart from this unless addNode/addAction is used
 @param qsetactive - experimental,not yet implemented with notifications however, can be triggered as method on the class
                     Active/Inactive will skip Inactive Nodes

* Notes: note.Body() and noteType() are sent to next link from prev notifyListener
*      Start will override all commands (pause, continue)
*       All Actions can be activated through the use of notifications and notification names overridden at constructor time
*      onRegister will start first notification, if you addNodes after this you will need to Start()

Function addNode
 This function provides the main method for sequentially adding notifications
 when its notifyListener notification is recived it moves to the next in the chain.
 This nex link then emits its notifySender notifications and waits for ITS notifyListener

 If you wish to use commands,  simply register your commands to take the chain links notifySender.
 when the command is called, at some point, either in the command or what the command is activating will
 need to send notification for the chain to be moved to next next point.

 eg. addNode( ApplicationFacade.SPLASH_SHOW, ApplicationFacade.SPLASH_INITIALIZED, note.getBody() ,note.getType());
     optional note.getBody() ,note.getType() can be set for the first Node to pass through, to the next node in the chain
     otherwise body and type are used from the received notifyListener and passed through to the next node in the chain
 
 @param notifySender  - the notification you wish to send when this link in the chain is triggered
 @param notifyListener - the notification this link will listen for to move to next link in chain
 @param body - an optional  notification body object to pass ( default is previous links notification body)
 @param type -  and optional notification type string to pass ( default is previous links notification type)
 @param active - to set a node inactive or active (testing whether this is useful) ( maybe placed before node function in a different release )

Function addAction
 This function provides a method to add Function callbacks triggered by notifications
 The Class uses this internaly  for adding the default Actions
 Although this is a little outside the box of its intended use it does provide a powerful
 triggering mechanism from within PureMVC the framework

 eg. addAction( "MY_ACTION_NOTIFICATION", myFunction);
     myFunction(node:ChainNotifierNode=null):void //function prototype for any addAction

 @param notifyListener - the notification this Action will listen for to call nFunction
 @param nFunction -  the function to call when triggered by notifyListener notifications

Flow Overview:
The constructor sets up Action notifications that can be used to control internal ChainNotifier behavior (if needed)
AddNode creates a node within the ChainNotifier supplying its name and start/next notification scheme.
OnRegister generates the first Action (if addNode includes a note body this is also sent with the notification)
dynamic listNotificationInterests register interest in the current index and Actions.
Upon receiving handleNotification either an Action is issued or the chain is moved to the next item and notification sent

In its basic operation it should not be necessary to use Actions , only if you want to get fancy or controll chain other next()
installation
Simply copy the code into your view area and replace package naming
The code was designed using multi-core but can be replaced easily to standard (remove multicore name)

Comments or suggestions are welcome, if developers feel this is a worthy tool to be included I'll work with Cliff to create repository and package accordingly (as a utility)

Zip File
Latest Version
http://www.trilec.com/opensource/ChainNotifier_1.2.zip

Previous
http://www.trilec.com/opensource/ChainNotifier_1.1.zip
http://www.trilec.com/opensource/ChainNotifier_1.0.zip


EDIT1: Removed Superfluous Naming and Added SetActive(), a few optimizations and added passing of getType()
EDIT2: AddNode documentation ,
EDIT3: Action Wording change in Docs and Code, Cliffs notes addressed
EDIT4: Version update, better wording of examples

 Enjoy
Curtis [Trilec] 
13  PureMVC Manifold / Demos and Utils / Re: Calendar - A PureMVC AS3 / Flex / Django Demo on: April 25, 2008, 09:58:18
I Care Steve... and when the clouds part and rays of light bath your keyboard in a sunlit glow, a mere 80% will seem trivial as it recedes in the shadow of 100% ... Hmmm the ecstasy.



14  Announcements and General Discussion / General Discussion / Re: What is multicore? on: April 19, 2008, 03:39:05
Hi Kit,
 Have you tried looking in the Forums, scan for "MultiCore" this should give a a good Q'nA overview, also
you will notice under the multicore Framwork section a Release Notes as well as the API Docs.

to give you a starting point I have scaned the forums and sniped a few quotes

you don't need MultiCore if you want your entire loaded module to be treated as a single view component with a single mediator for it.

The reason for MultiCore is so that an entire set of the Core actors can run in the same VM with another one, (possibly written by a different vendor without coordination) without having collisions in Notification namespace. These Cores are isolated and do not communicate via notifications sent through a shared Facade for this reason.

The MultiCore demo creates an interface called IWidget that the W1idgetShell in the main app uses to communicate with any Widget. It also creates an interface called IWidgetShell which the Witget uses to communicate with the WidgetShell. That's it. No need to come up with a scheme to be sure notification names are unique inside the two Cores, they call interface methods.
The MultiCore version is still 'experimental' because I haven't yet had the chance to port the unit tests. It has all the same functionality as the standard version and. Knowing the changes I had to mak I feel very confident. But feeling confident and seeing the green bar in FlexUnit are 2 different things, thus the current status 

Hope that helps
T
15  Announcements and General Discussion / Architecture / Interesting AS3 Singleton Code on: April 17, 2008, 04:21:03
:
package
{
    public class Singleton
    {
        public static var instance:Singleton;
        public static function getInstance():Singleton
        {
            if( instance == null ) instance = new Singleton( new SingletonEnforcer() );
            return instance;
        }
        public function Singleton( pvt:SingletonEnforcer )
        {
            // init class
        }
    }
}
internal class SingletonEnforcer{}


Note: The class "SingletonEnforcer" is actually placed within the same .as file as the Singleton class, but placed outside the package{} parenthesis, therefore, the class "SingletonEnforcer" can only be accessed from within this .as file, so if the Singleton's constructor is called from anywhere else, you'll get an error.

reference: http://blog.pixelbreaker.com/category/flash/actionscript-30/

Also some interesting stuff on Performance Tuning by Gary Grossman

...it became clear that class constructors are interpreted, not JIT compiled, so all I had to do was move the code out of the constructor, into an init() function, and call if after the constructor, this shaved a huge amount of time off the initial build ...

T
Pages: [1] 2 3 4