Futurescale, Inc. PureMVC Home

The PureMVC Framework Code at the Speed of Thought


Welcome, Guest. Please login or register.
October 19, 2017, 01:55:41 AM
Home Help Search Login Register
News: Please DM @puremvc on Twitter to gain forum access. Spambots are why we can't have nice things.
Pages: [1] 2 3
Print
Author Topic: Fabrication 0.4 released  (Read 30081 times)
Darshan Sawardekar
Sr. Member
****
Posts: 85


View Profile Email
« on: October 17, 2008, 08:50:52 AM »

Hi All,

I have released Fabrication 0.4. And its now on Google Code[1]. This is an important step forward in PureMVC application development. You can read about it here[2]. Enjoy.

peace,
darshan

[1] : http://fabrication.googlecode.com
[2] : http://www.codedrunks.com/index.php/2008/10/17/fabrication-04-released/
Logged
Jason MacDonald
Sr. Member
****
Posts: 243


View Profile
« Reply #1 on: October 17, 2008, 09:43:44 AM »

Awesome news! Thanks, Darshan!
« Last Edit: October 17, 2008, 11:43:04 AM by jasonmac » Logged
Jason MacDonald
Sr. Member
****
Posts: 243


View Profile
« Reply #2 on: October 17, 2008, 11:11:22 AM »

With the elimination of the ApplicationFacade, does one register all their commands in the StartupCommand now? So essentially the old ApplicationFacade has moved to the StartupCommand? I haven't tested yet, but I wonder how well the StartupManager utility will play with Fabrication. I think it should be fine.

Just trying to wrap my head around building large apps (many commands) using Flash with Fabrication. I assume only our old "JunctionMediator" mediator extends FlashMediator. The rest of our mediators still extend PMVC's Mediator unless we need the routing of Fabrication?

Just want to make sure I understand correctly.
Logged
Darshan Sawardekar
Sr. Member
****
Posts: 85


View Profile Email
« Reply #3 on: October 18, 2008, 07:26:59 AM »

Quote
With the elimination of the ApplicationFacade, does one register all their commands in the StartupCommand now? So essentially the old ApplicationFacade has moved to the StartupCommand? I haven't tested yet, but I wonder how well the StartupManager utility will play with Fabrication. I think it should be fine.
Yes the registration of commands needs to happen in the StartupCommand with Fabrication. The StartupManager utility works fine with it, I am using it as well. PureMVC is a very extensible framework with such aspects. Fabrication only adds behaviours at the typical extension points like, FlexApplication/FlashApplication, FlexMediator, SimpleFabricationCommand, etc.

Quote
Just trying to wrap my head around building large apps (many commands) using Flash with Fabrication. I assume only our old "JunctionMediator" mediator extends FlashMediator. The rest of our mediators still extend PMVC's Mediator unless we need the routing of Fabrication?

There is no need for the JunctionMediator at all. The routing of pipe messages happens entirely underneath the system. You indicate interest in a notification implicitly by writing a respondToNotificationName method in your mediator(for your environment). When you do a routeNotification the respondTo method will be called automatically. You can find more information here[1].

Btw, If you are familiar with Flex also check out the link I mentioned[1]. Fabrication 0.4 added Reflexive mediator registration for Flex deferred component instantiation. I am looking for feedback for applying this to Flash projects. Flash components do not seem to have support for deferred instantiation, but I am not very familar with the those components, so i may be wrong. I am thinking more on the lines of something to support the MovieClips hierarchy of Flash.

Let's say you have MovieClip assets that are placed on the stage. This may be deep and possibly design driven. And additionally not explicitly given top level instance names. I should be able to mediate components/display objects in this hierarchy in an easy way.

I am just thinking out loud here. It would be great if you can share your thoughts on the workflow with flash projects with PureMVC.

peace,
darshan

[1] : http://www.codedrunks.com/index.php/2008/10/17/fabrication-04-released/
Logged
Jason MacDonald
Sr. Member
****
Posts: 243


View Profile
« Reply #4 on: October 18, 2008, 11:21:07 AM »

Quote
There is no need for the JunctionMediator at all. The routing of pipe messages happens entirely underneath the system.

Sorry I may have mislead you with that statement. What I meant was the that we are replacing our old JunctionMediator with the Fabrication style mediator, but my other Mediators could remain the same (extending just Mediator) unless they needed the functionality of routing. Since my project is already well underway, I'm trying to add fabrication into my existing code and was just "speaking out load" about where I could avoid changing old code.
Logged
freakinruben
Newbie
*
Posts: 4



View Profile
« Reply #5 on: October 20, 2008, 05:43:59 AM »

Hi Darshan,

I've just started to implement this new version. First thing I've noticed is the direct relation with the FlexModuleLoader in FlexModuleFabricator. Because of this relation it is now impossible to load modules without the ModuleLoader (I always used the ModuleManager). In the previous version I could just manually call setDefaultRouter and acceptRouter... Is there any way I could still use the ModuleManager to load my modules (I don't like the overhead of the ModuleLoader...)?

Thanks it advance, and I will give more feedback as soon as I got better knowledge of all the changes  Wink.

Ruben
Logged
Darshan Sawardekar
Sr. Member
****
Posts: 85


View Profile Email
« Reply #6 on: October 20, 2008, 06:12:57 AM »

Jason,

You are right if you just need the message routing, you do not need to extend the FlashMediator/FlexMeditaor. However, If you intend to use Reflexive notification interests, you will need to extend FlashMediator/FlexMediator. Moving forward this is going to the key integration point for new Mediator specific features.

Ruben,

I didn't realize you were using ModuleManager. Serve's me right for developing in the dark, I guess. ;-) In 0.4 the FlexModuleFabricator looks up the router from the parent ModuleLoader so its linked for the moment. I will try to fix this soon. Can you post some sample code, It would help clarify the usage?

peace,
darshan
Logged
Jason MacDonald
Sr. Member
****
Posts: 243


View Profile
« Reply #7 on: October 20, 2008, 06:16:44 AM »

Jason,
However, If you intend to use Reflexive notification interests, you will need to extend FlashMediator/FlexMediator. Moving forward this is going to the key integration point for new Mediator specific features.

I'm using Pure AS3 for the moment so the Reflexive Notes aren't much use to me. But I'll keep in mind that future features will be added to the mediator and update my files accordingly. Thanks for the input.
Logged
Darshan Sawardekar
Sr. Member
****
Posts: 85


View Profile Email
« Reply #8 on: October 20, 2008, 06:19:32 AM »

Jason,

Reflexive notification is supported with AS3 also. The reflexive mediator registration is Flex specific because only Flex components support deferred instantiation.

peace,
darshan
Logged
freakinruben
Newbie
*
Posts: 4



View Profile
« Reply #9 on: October 20, 2008, 06:49:39 AM »

Darshan,

Thanks for your quick response. Here is some code of when I used the old fabrication, so I hope this clarify's it a bit.

Quick description:
My application call's the loadPlugin method for every "plugin" it want's to use. When the application is started, there can be many instances of every "plugin" so when the user wants a new instance, it calls PluginManager.getModule(...) which then returns a new instance of the requested plugin.

The PluginManagerMediator listens to the events of the PluginManager and connects every instance of the plugin that's created.

PluginManager:
Code:
public function loadPlugin(pluginVO:PluginVO) : void
{
var module:IModuleInfo = ModuleManager.getModule(pluginVO.filename);
module.data = pluginVO;
module.addEventListener(ModuleEvent.READY, onModuleLoaded, false, 0, true);
module.addEventListener(ModuleEvent.ERROR, onModuleFailedLoading, false, 0, true);

//add module to the loading queue
modules.push(module);

//dispatch an event that the module is getting loaded
dispatchEvent( new PipeEvent(PipeEvent.PLUGIN_IN_QUEU, pluginVO) );

module.load(ApplicationDomain.currentDomain);
}


protected function onModuleLoaded(e:ModuleEvent) : void
{
var module:IModuleInfo = e.module;
var pluginVO:PluginVO = module.data as PluginVO;

//remove module from loading queue
removeModuleFromQueue( module );

//add module to available modulesList
components[ pluginVO.title ] = module;
pluginVO.loaded = true;
}


/**
* ComponentFactory.
*
* @param name name of the component which should be instantiated
* @return instance of the requested component
*/
public static function getModule (data:ModuleVO):FlexModule
{
var module:IModuleInfo = components[ data.type ] as IModuleInfo;
var component:FlexModule = module.factory.create() as FlexModule;

instance.dispatchEvent( new PluginEvent( component, PluginEvent.CREATED ) );
component.addEventListener(FlexEvent.INITIALIZE, instance.onPluginReady, false, 0, true);

return component;
}

PluginManagerMediator:
Code:
protected function onPluginCreated (event:PluginEvent) : void
{
event.plugin.setDefaultRoute( applicationModuleAddress.getInputName() );
}


protected function onPluginInitialized (event:PluginEvent) : void
{
event.plugin.acceptRouter( applicationRouter );
}
Logged
Jason MacDonald
Sr. Member
****
Posts: 243


View Profile
« Reply #10 on: October 20, 2008, 07:19:06 AM »

One more minor question/curiosity.

Is there a reason FlashApplication extends MovieClip rather than Sprite? MovieClip tends to carry a lot of extra code that isn't needed. Just curious. I can change my local copy to extend Sprite instead of MovieClip but was curious if there was a specific reasoning for it.
Logged
Jason MacDonald
Sr. Member
****
Posts: 243


View Profile
« Reply #11 on: October 20, 2008, 07:26:45 AM »

Btw, If you are familiar with Flex also check out the link I mentioned[1]. Fabrication 0.4 added Reflexive mediator registration for Flex deferred component instantiation. I am looking for feedback for applying this to Flash projects. Flash components do not seem to have support for deferred instantiation, but I am not very familar with the those components, so i may be wrong. I am thinking more on the lines of something to support the MovieClips hierarchy of Flash.

Let's say you have MovieClip assets that are placed on the stage. This may be deep and possibly design driven. And additionally not explicitly given top level instance names. I should be able to mediate components/display objects in this hierarchy in an easy way.

I am just thinking out loud here. It would be great if you can share your thoughts on the workflow with flash projects with PureMVC.

peace,
darshan

[1] : http://www.codedrunks.com/index.php/2008/10/17/fabrication-04-released/

I meant to respond to this earlier, sorry it slipped my mind.

I think the largest problem you'll encounter is the fact that, unlike Flex, there is no Adobe endorsed component framework for Flash that supports deferred instantiation - at least not in the same way Flex does since Flash components do delay rendering but only frame by frame to avoid rendering every time a style changes, instead it defers rending until the next enter_frame event. So any Component Framework that does allow this would be user made and subject to any number of implementations that would be hard to predict. I think to do this in Flash would require also building the skeletal structure of a Flash Component Frame for people to then build visual components off of that would have deferred instantiation inherent in the framework.

There might be a way of doing by manipulating the addChild method, but I'm not sure off the top opf my head. Flash components use a two stage approach to rendering. The first part calls ConfigUI when the component is first created, this allows you to set-up listeners and do any other prerendering set-up. The second part comes when the Stage becomes available to the component (through either addChild or some other method which triggers the ADDED_TO_STAGE event) which then triggers the Draw() method and rendering completes. If you could find a way of adding a listener between the ConfigUI state and Draw() call you might be able to accomplish what you want (adding a mediator at render time but not creation time?) Though to me this isn't really the same thing as deferred instantiation.
« Last Edit: October 20, 2008, 07:34:36 AM by jasonmac » Logged
Darshan Sawardekar
Sr. Member
****
Posts: 85


View Profile Email
« Reply #12 on: October 20, 2008, 07:36:26 AM »

Ruben,

Ok, I think I got it. You need to set the defaultRoute and the router on the module. I think you will need a FabricatorEvent.FABRICATION_CREATING event where you do something like,

Code:
// for setting the module's default route to the shell
event.plugin.defaultRoute = "*"; or event.plugin.defaultRouteAddress = applicationAddress;
event.plugin.router = applicationRouter;

The current FABRICATION_COMPLETE event is fired after the fabrication is created. I will change the FlexModuleFabricator to fix this by tomorrow.

peace,
darshan
Logged
Darshan Sawardekar
Sr. Member
****
Posts: 85


View Profile Email
« Reply #13 on: October 20, 2008, 08:03:23 AM »

Jason,

Thanks for your comments. Regarding extending MovieClip, I have kept it for people who might need to extend MovieClip. Extending Sprite would otherwise require 2 sets of fabricators. There is a slight performance hit which should probably be reasonable as long as the internals use Sprite in animations and drawing stuff.

Your points about the lack of deferred instantiation in CS3 components are valid. And it would be difficult to support all the different variations. I am thinking of sticking to Flash designer specific stuff. The link up between the graphic assets into behaviour from CS3 pov is with the instanceName. I am thinking of trying to target this.

So for instance if the graphic designer placed 2 buttons at different points of time on the timeline. Lets say both these buttons are for the same action, to toggle full screen mode. Now suppose I have a FullScreenButtonMediator which adds a listener to the buttons and provides the full screen toggle behaviour. I want to be able to code something like,

Code:
registerMediator(new FullScreenButtonMediator(resolver(app).re("fullScreenButton.*")));

So the designer has basically indicated behaviour of the button by giving it an instance name like fullScreenButton1, etc. Your thoughts?

peace,
darshan
Logged
Jason MacDonald
Sr. Member
****
Posts: 243


View Profile
« Reply #14 on: October 20, 2008, 10:05:58 AM »

My understanding of the "resolver" aspect of your code is pretty limited atm. I'll have a look at how it works in Flex and see if there's something that could be done. My guess is you need some way of being alerted that a new instance of a button has been created, and I'm not sure the facilities exists out-of-box for this in Flash. If you had a way to injection this behavior into the UIComponent Class (base for all visual components in Flash) then you could certainly do it, but I don't believe Flash components fire off any global events by default. So I'm not sure how you would find out about new instances unobtrusively.
Logged
Pages: [1] 2 3
Print
Jump to: