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  Announcements and General Discussion / General Discussion / disconnecting pipes on: June 04, 2010, 08:33:48
So I read the whole thread on disconnecting pipes but still didn't find what I was looking for. Here is what I am currently doing:

:
//remove the pipe
var shellJunction:Junction = QueryMessage(message).getBody() as Junction;

//disconnect the input pipe
var pipeIn:Pipe = junction.retrievePipe(PipeAwareModule.SHELL_IN) as Pipe;
var shellOut:TeeSplit = shellJunction.retrievePipe(PipeAwareModule.STD_OUT) as TeeSplit;
shellOut.disconnectFitting(pipeIn);

So this disconnects the pipe coming out of the shell into the module. I wanted to also disconnect the pipe for traffic out of the module to the shell but the TeeMerge on the shell doesn't have a "disconnectFitting" method. It only has a "disconnect" method. How do I go about disconnecting the module input pipe from the shell without disconnecting all other input pipes to the shell?
2  Announcements and General Discussion / Getting Started / Good way to load Model befor View on: May 07, 2010, 11:45:21
Generally, I render the view component, then call its command on CREATION_COMPLETE. The command first initializes the mediator and then the proxy and calls the methods on the proxy to get the required data. I initialize the mediator first so that it can catch the responses from the proxy. I make sure the view component is completely created so the mediator can set the data on it.

I find this to be acceptable in most situations but on some more complex pages I find that my page loads with empty fields and then they get populated because the view rendered and then the proxy got its data. I would prefer that when I go to a "new page/tab" that the first thing that happens is that the proxy registers and starts the asynchronous calls to the service layer/db. While I am waiting for a reply, the view component can get rendered and then the mediator created. When the mediator is created it will set all the data on the view component from the proxy. The mediator will still have its listeners on the proxy to set the data if it comes in after the mediator is created.

Is this the best way to do this? Its annoying to call the proxy prep command, then wait for the view to hit CREATION_COMPLETE, and then call the view prep command. I also have to write extra code in the mediator to initially set the proxy data that came in before its creation.

I'm just fishing for better ways to do this!
3  Announcements and General Discussion / General Discussion / [Flex 4] AS code can't reference view component? on: May 06, 2010, 12:39:44
So I ported my project from Flex 3 to Flex 4. I'm trying to simply load a module in an application and setup its mediator to use it. I keep getting this error:

TypeError: Error #1009: Cannot access a property or method of a null object reference.
   at mx.core::UIComponent/getStyle()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\core\UIComponent.as:10372]
   at spark.components::Label/createTextLinesFromTextBlock()[E:\dev\4.0.0\frameworks\projects\spark\src\spark\components\Label.as:831]
   at spark.components::Label/createTextLines()[E:\dev\4.0.0\frameworks\projects\spark\src\spark\components\Label.as:808]
   at spark.components::Label/http://www.adobe.com/2006/flex/mx/internal::composeTextLines()[E:\dev\4.0.0\frameworks\projects\spark\src\spark\components\Label.as:474]
   at spark.components.supportClasses::TextBase/measure()[E:\dev\4.0.0\frameworks\projects\spark\src\spark\components\supportClasses\TextBase.as:533]
   at mx.core::UIComponent/measureSizes()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\core\UIComponent.as:8042]
   at mx.core::UIComponent/validateSize()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\core\UIComponent.as:7966]
   at mx.managers::LayoutManager/validateSize()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\managers\LayoutManager.as:617]
   at mx.managers::LayoutManager/doPhasedInstantiation()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\managers\LayoutManager.as:709]
   at mx.managers::LayoutManager/doPhasedInstantiationCallback()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\managers\LayoutManager.as:1072]

I was reading on the adobe forum about this and they said in response to someones similar issue:
[http://forums.adobe.com/message/2792526#2792526]

The main point of modules is to make the main application SWF smaller.  When using modules you have to realize that any mention of a class in the application code links in those classes and all dependent classes.  We sort of assumed that folks knew that and have made changes to the styles system in Flex 4 that require that you know that.

And again, in reference to someones specific problem:

You are using the module class in the main app which sort of defeats the point of having a module as it will link testModule into the main app.  When that happens in Flex 4, the styles don't get set up properly.  You should use an interface instead of the module class.

The basic idea I gather is that you cant reference the module view component in any other code. Which brings me to a lot of problems and two questions:

1. Is that true?
2. If it is, how do I strongly type the view component in the mediator? Do I have to write an interface for every module?
4  Announcements and General Discussion / General Discussion / Submodules in a Core? on: April 28, 2010, 09:13:29
Scenario: I am working on a system that is going to be used to integrate different systems into one. It basically has three levels.

[Tier #1] This part is kind of "like" a portal environment like JBoss or Sharepoint. It only acts as a frame upon which to hang other applications. It provides authentication for and navigation within applications that are plugged into it.

[Tier #2] This is basically a set of related modules. Depending on a user's permissions they may or may not have access to all of the modules in this set. But they are all tightly related and use the same classes. Likewise, each user may or may not have access to each set of modules as a whole. In fact, depending on the client, the entire set of modules may not be present on the server. A set of modules would not directly relate to a portal in a portal environment but could include multiple tabs.

[Tier #3] This is each module inside a set of modules. To keep users from loading apps that they wont use or don't even have permission to I made these modules.

So I am using MultiCore and it made sense to make each set in Tier #2 a core to keep all the related classes together. The way Tier #1 handles navigation is that a user should be allowed to switch from any Tier #3 module to another, even if it is in a different set (this makes sense in the application). The question is how to I initialize the Facade for that Core and how do I alert it to which module to default to. Here are the two solutions I have developed:

[Solutions]
1. Have each module in the core initialize the facade and the facade handles each of their start up commands. There is no main application for each core.
2. Have a main application for the core that is capable of loading each module in it. Inform the main application which module to start with.

So I implemented Solution #1 and it works great. But here is what I was wondering:

[Questions]
1. In MultiCore does module = core? Is it bad design to have a module that is not a core? I'm kind of unclear as to what a "core" is. Is it an application? Is it a piece of an application, and if so, is it expected to have a lot of communication with other cores or be fairly independent?
2. Is my implementation abusing MultiCore because there is no main application for each core in Tier #2?
3. If I went with Solution #2, how would I tell the core what module to load up? (is url params the only way)
4. What is in a module? If I have multiple modules that use the same proxie does each of their SWF files contain that proxy? Can/How do you specify what classes are associated with a particular module?

In the end this might just be a paradigm shift on how I handle navigation, but I still need to know more about MultiCore. I know an initial reaction might be "well, if these are different applications then treat them like they are". And I might go that rout, but this system needs to be more integrated than a standard OS or portal environment. Thus the fuzzy distinctions. And I won't have time for a while to remake Tier #1 to be like that anyways.

So...thoughts?
5  Announcements and General Discussion / Getting Started / Newbie Questions on: April 27, 2010, 09:29:24
I've been using Flex since January but I just started using PureMVC Multicore a few days ago. I feel like i have a good grasp on the general architecture, but here are a few questions about specifics:

1. Where does filter and sort functions go? I am leaning toward the view since it doesn't actualy alter the data but changes the way it is displayed, or rather what portion is displayed. But I could see it going in the model.

2. Where do i put the processing for getting data from forms (especialy dynamicaly generated forms with unknown number of elements)? It would be nice to have a "code behind" to do this but i don't want to abuse the mediator as one. (on that note, is there a good way to get data from a dynamicaly generated form... binding a model isn't always practical?)

3. On a similar note as #2, where do i put more complex visual manipulations like drag and drop operations? Is it wrong to create a code behind like file?

4. Should I embed icons in the model or the view? I could see them as data but technicaly they are visual data.

5. I am used to the DAO concept and try to keep them to just queries. If i need further data manipulation i create toolkit like classes that help them out. Is there a good design to do this in the Model? Is this a case of using a Proxy to modify the data and use a Delegate like a DAO?

6. What is the standard use of delegates and their relationship to proxies?

7. I don't find myself using commands all that much. When I made up my own MVC architecture in previous projects I did a lot in the Controller. It just seems weird. I feel like I either used to put to much in the Controller or now I don't put enough. Thoughts?

-erik
Pages: [1]