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 ... 6
1  Announcements and General Discussion / Fabrication / Re: Quetion for "respondTo"? on: April 01, 2009, 08:28:03
Hi pavelj,

Thanks for trying Fabrication. And sorry about the "simple_routing" demo. That demo started off as a basic demo. But the different routing features have grown in size and I am afraid that demo is a little complex now.

still have no idea where is listening for respondToShellMessageCountProxy created.
SimpleModuleConstants.SHELL_MESSAGE_COUNT_PROXY seems has the right syntax but can't find where is implemented as note name.

To answer your question. The missing link is that notifications can also be handled via registering them with commands. The startup command of the module does this,

:
registerCommand(FabricationRoutingDemoConstants.RECEIVE_MESSAGE, UpdateMessageCountsCommand);

As a result the UpdateMessageCountsCommand is fired when the RECEIVE_MESSAGE notification is routed into the module. This command then increments the corresponding proxy based on the source of the notification. Hope that helps.

peace,
darshan
2  Announcements and General Discussion / Fabrication / Re: Reaction to FlexEvent? on: April 01, 2009, 08:18:33
Yup, like Ondina said, Fabrication initializes with creationComplete event in FlexApplication. Thats the reason your creationComplete handler isn't firing. The code in your creationComplete handler would be better placed in your startup command.

peace,
darshan
3  Announcements and General Discussion / Fabrication / Re: SOLVED: Routed Notification triggers registered command 4 times on: April 01, 2009, 08:15:21
@gunslinger4hire

Glad you got it solved. I one of the things that might help with lots of module is to use module groups. This is present in 0.6 but not documented well right now. The idea is to assign a group name to a module. So routed notifications stay with a group, similar to created a subnet on lan. See this post[1] for more.

peace,
darshan

[1] : http://forums.puremvc.org/index.php?topic=874.msg4000#msg4000
4  Announcements and General Discussion / Fabrication / Re: Question regarding using Fabrication and PureMVC Console together on: April 01, 2009, 08:06:51
Hey Tony,

What is the best way to deal with this inheritance issue so that I can use PureMVC console to debug my Fabrication application?

The issue with inheritance with KapLab PureMVC console is a little hard. I am extending out the main actors in PureMVC with custom subclasses for Model, View, and Controller. And as you have noticed the KapLab classes do similar things for the logging. I wasn't able to get the source code for the KapLab console so not sure if there is a plausible solution...

One thing you can do to see the flow of notifications in an application, is to use Interceptors[1]. You could setup an Interceptor with something like,

:
override public function intercept():void {
   trace(notification.getName() " + with body " + notification.getBody());
   proceed();
}

peace,
darshan

[1] : http://code.google.com/p/fabrication/wiki/Interceptors
5  Announcements and General Discussion / Fabrication / Re: Trouble strongly typing custom Notifications on: March 23, 2009, 08:42:09
@robmccardle, Thanks for trying Fabrication.

I haven't changed the sendNotification signature in Fabrication from the one in PureMVC. This can't be done in as3 because the override modifier does not allow changing the signature of a method implemented in a parent class. The PureMVC classes implement the sendNotification signature typed to string.

You need to use
:
notifyObservers(new ContextMenuNotification(ContextMenuNotification.ADD_MENU));
Then if you use Reflexive notification interests then with a respondTo like,
:
public function respondToAddMenu(note:ContextMenuNotification):void {

}

you do not need to cast note to ContextMenuNotification. If this were a routed notification then routeNotification supports both string and custom INotification arguments.

peace,
darshan
6  Announcements and General Discussion / Fabrication / Re: Issues with Fabrication, please help on: March 23, 2009, 08:30:28
@Ondina, @Steffen. Thanks for your kind words. Yeah, I understand the layering creates a barrier to entry to a lot of people. Hopefully projects like Steffen's gem, we help lower this barrier.

@Steffen. I haven't tried the updated gem yet, will try it out tomorrow.

We investigated this further and found a bug report at your google project which really looks like our problem: http://code.google.com/p/fabrication/issues/detail?id=4 is this fixed or

I haven't been able to figure out a solution to that bug so far, without a monkey path to the flex framework. The problem relates to a MXML Container component nesting. The Container class of the flex framework traps the childAdd event with a capture phase listener and does not bubble it up. To do reflexive mediator registration I am listening for a top level childAdd event that matches the created component to the expected component via the ./../.re syntax. With that event bubbling up Fabrication can't detect when the component becomes available. I am open to any suggestions/workarounds at this point...

peace,
darshan
7  Announcements and General Discussion / Fabrication / Re: Issues with Fabrication, please help on: March 22, 2009, 11:41:56
Hi Steffen,

Sorry for the late reply. I thought I was subscribed to this forum, but wasn't and missed your posts.

1. Release 0.6 of fabrication do not include AirApplication, as workaround we got the source code from subversion and this helped us create an Fabrication AirApplication. If you are using air use the 0.6 air swc.

This is because I bundled the air swc and the flex swc separately. If you bundle the air classes which extend WindowedApplication in the swc, and use them in a flex only project then the compiler complains about not being able to find the WindowedApplication and other air classes.

2. ReactTo do not seam to work when you have a non referred component which uses ReactTo...

I am not sure I am completely clear about this. I use reflection to get a list of reaction handlers. Perhaps cross module references are not working with this. Can you post some sample code?

3. onRegister never executes when using Reflexive mediators with mx states. We have downloaded your demo Using Reflexive mediators with Application states and extracted the states-code to a component referenced in the application mxml file.

States should also work with Reflexive mediators. Can you post the mxml you used.

Last I would love to know what the intentions are with Fabrication. Is it going to be further improved/developed on or is left for others to pick up? The reason I ask is, that we would really like to use Fabrication in production.

To be honest Fabrication has not really received a lot of feedback or users. I am using it in nearly all my flash/flex work so I intend to keep it alive as much as I can. If you feel you or anyone else would like to contribute, I would be happy to add you guys to the project.

One of things I do not know though is whether Fabrication is being used in any production systems. Having said that it is really a layer on PureMVC so it should work fine.

From a technical point of view, there is one of feature that I see being added in the future. As soon as I can find time to implement it.

Shorten the reactTo and respondTo syntax using namespaces.
:
// instead of this
public function respondToValueChanged(note:INotification):void {

}

// use namespaces like this
notification function valueChanged(note:INotification):void {

}

// and similar reaction methods
reaction function myButtonClick(event:MouseEvent):void {

}

Apart from that nothing much is on the horizon apart from bug fixes.

peace,
darshan
8  Announcements and General Discussion / Fabrication / Re: Need help with Flex ModuleManager and fabrication FlexModules on: March 04, 2009, 10:53:14
Hey Tony,

I am waiting for the FlexModule's initialize event to fire to trigger the startup command. You can take a look at an example in the svn[1], simple_routing_with_module_manager. It uses ModuleManager instead of  loading with FlexModuleLoader. The important code is in the ModulesContainerMediator,

:
                private function moduleReadyListener(event:ModuleEvent):void {
                        var module:IModuleInfo = event.module;
                        var moduleDescriptor:ModuleDescriptor = event.module.data as ModuleDescriptor;
                        var moduleInstance:Object = event.module.factory.create();
                       
                        moduleInstance.router = applicationRouter;
                        moduleInstance.defaultRouteAddress = applicationAddress;
                        moduleInstance.id = moduleDescriptor.getElementID();
                       
                        moduleInstance.addEventListener(FabricatorEvent.FABRICATION_CREATED, moduleCreated);
                        moduleInstance.addEventListener(FabricatorEvent.FABRICATION_REMOVED, moduleRemoved);
                       
                        modulesContainer.addChild(moduleInstance as DisplayObject);
                }
               
                private function moduleCreated(event:FabricatorEvent):void {
                        event.target.removeEventListener(FabricatorEvent.FABRICATION_CREATED, moduleCreated);
                        trace("moduleCreated " + event.target);
                }
               

The addChild makes the module's initialize event to fire. If however you need to initialize the module without adding it to the DisplayList then your approach is fine as well. Just make sure to set the router on the module before you initialize it else it will throw an error.

peace,
darshan
9  Announcements and General Discussion / Fabrication / Re: First release of fabricator gem, feedback please! on: March 04, 2009, 10:45:48
Hey Steffen,

I tried the gem and got everything to compile properly. Great job, this is going to really speed up my development process. And I have no problem with you/anyone using fabricator or fabrication in the name.

I had a few issues with getting the gem install. I was getting errors like
:
...rubygems.rb:578:in `report_activate_error': Could not find RubyGem newgem (>= 1.2.3) (Gem::LoadError)

I tried updating newgem which seemed to have problem with a similar error but for the cucumber gem instead, etc.
:
...rubygems.rb:578:in `report_activate_error': Could not find RubyGem cucumber (>= 0.1.8) (Gem::LoadError)

What finally worked for me,
:
gem update rails (to get the newer version of active support which was reported by cucumber)
gem install newgem
gem install cucumber
gem install fabricator

I think there are some dependencies issues with the gem install. But after that I got the pureapp command working fine. Looking forward to the items on your todo list. ;-)

peace,
darshan
10  Announcements and General Discussion / Fabrication / Re: The modules with proxies have error when load both on: March 01, 2009, 12:20:54
Hey Mark,

This looks like an issue with incompatible Flex sdks. I suggest recompiling the shell, and all modules with the same sdk. That might help.

peace,
darshan
11  Announcements and General Discussion / Fabrication / Re: "Router was not set on the module" error on: March 01, 2009, 12:15:43
The problem is with the FlexModuleLoader usage. The applicationRouter is not set on the module loader. However the applicationRouter is created after creationComplete in Fabrication. So you will have to use it with the actionscript syntax and after fabrication is ready. I suggest doing this in/via the startup command.

peace,
darshan
12  Announcements and General Discussion / Fabrication / Re: Question for "resolver add child"? on: February 25, 2009, 02:26:26
Hi Mark,

I am not completely clear about your question. If I understand you right, you want the mediator the ConfirmMediator to be registered with PureMVC only once. This registration only happens when the confirm form item is added to the application. The registration and return links basically add/remove this form item using Flex states.

With the code,
:
registerMediator(new ConfirmMediator(resolve(application)..confirm));

you are indicating that the ConfirmMediator should be registered when the confirm component is created. Correspondingly the mediator is removed when the confirm component is removed. A new instance of the ConfirmMediator is only registered when the confirm component. This demo shows that if at any point in time you remove your viewComponent the mediator is removed, and if you later add it back the Mediator for it gets registered also. So if you don't removed the confirm component the registration and mediator will be registered only once.

peace,
darshan
13  Announcements and General Discussion / Fabrication / Re: Question for "resolver add child"? on: February 23, 2009, 10:14:37
Hey Mark,

I think you forgot the attachment.

peace,
darshan
14  Announcements and General Discussion / Fabrication / Re: Question for the Demo code? on: February 21, 2009, 08:12:41
Use fab:states when the flex compiler complains about mx:states. This is generally when the parent of the mxml document is an IFabrication. For other flex mxml components mx:states will work fine.

peace,
darshan
15  Announcements and General Discussion / Fabrication / Re: Starting on a PureMVC multicore Fabrication generator gem on: February 21, 2009, 08:08:46
...One obvious problem is that I would like to support custom packages for all application and component code, that means that I have to parse generated code to obtain the correct package etc for the new code or require it as a parameter which can be a bit cumbersome.

You are right about the need to parse some code. You could get away with some of it if the parent classes are Fabrication only.

Would it be usefull if the component generators could generate a complete module with startupcommand, proxy, mediator etc with the correct namespace etc and perhaps optional parameters like datatype for the proxy. And the same idea for just a proxy or mediator generator?

I think the main project/module level fabrication command should at least generate,
  • MainApplication/Module.as/mxml
  • MainApplicationStartupCommand
  • MainApplicationConstants
  • MainApplicationMediator

The rest are a little project specific. Like there may be multiple proxies, mediators which would be hard to scaffold out. I have had projects where there wasn't any Proxy, and/or only one Mediator, but thats probably an exception than a rule.

Does this makes sense? The idea is that all the skeleton code gets generated, and perhaps som default usage code, which easily can be removed / modified?
I think it makes a lot of sense. The exact granularity is something that will come only after a little bit of experimentation. I remember the earlier version Rails scaffolds were not very clean. But the newer ones are pretty usable especially with some of the REST support.

For the custom base classes that Jason mentioned you could read something like a .extensions file in the project directory like,

:
command:foo.controller.MyBaseCommand
mediator:foo.view.MyBaseMediator
proxy:foo.view.MyBaseProxy

When not specified, the defaults are the Fabrication base classes.

peace,
darshan
Pages: [1] 2 3 ... 6