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 / Public Demos, Tools and Applications / Member Database - AIR/Flex/PureMVC on: March 24, 2010, 07:27:58
I just created 'Simple Member Database' application. This demo illustrates how you can use Flex, PureMVC and Adobe AIR local SQL database to create simple member management system.

http://mariusht.com/blog/2010/03/23/memberdatabase-air-application-flex-puremvc/

Mariush T.
http://mariusht.com
2  PureMVC Manifold / MultiCore Version / Custom Messages - my code looks cleaner now on: January 20, 2010, 09:41:04
Hi Cliff,

You can see here handlePipeMessage method from PipeWorks demo (LoggerJunctionMediator.as)
:
override public function handlePipeMessage( message:IPipeMessage ):void
        {
            if ( message is LogMessage )
            {
                sendNotification( ApplicationFacade.LOG_MSG, message );
            }
            else if ( message is UIQueryMessage )
            {
                switch ( UIQueryMessage(message).name )
                {
                    case LoggerModule.LOG_BUTTON_UI:
                        sendNotification(ApplicationFacade.CREATE_LOG_BUTTON)
                        break;

                    case LoggerModule.LOG_WINDOW_UI:
                        sendNotification(ApplicationFacade.CREATE_LOG_WINDOW )
                        break;
                }
            }
        }

and the source code for one of your custom messages
:
package org.puremvc.as3.multicore.demos.flex.pipeworks.common
{
    import mx.core.UIComponent;
   
    import org.puremvc.as3.multicore.utilities.pipes.messages.Message;

    public class UIQueryMessage extends Message
    {
        public static const GET:String = 'get';
        public static const SET:String = 'set';
       
        public function UIQueryMessage( action:String, name:String, component:UIComponent=null)
        {
            var headers:Object = { action:action, name:name };
            super( Message.NORMAL, headers, component );
        }
       
        public function get action():String
        {
            return header.action as String;
        }

        public function get name():String
        {
            return header.name as String;
        }

        public function get component():UIComponent
        {
            return body as UIComponent;
        }
       
    }
}

Below you can see one of my custom messages and the way i access their types in any JunctionMediator

:
package com.mariusht.contactmanager.common.messages
{
import com.mariusht.contactmanager.common.model.vo.ContactVO;

import org.puremvc.as3.multicore.utilities.pipes.messages.Message;

public class ContactMessage extends Message
{
protected static const NAME:String = 'ContactMessage';

public static const ADD_CONTACT:String = NAME + '/message/contact/add';
public static const CONTACT_ADDED:String = NAME + '/message/contact/added';
public static const CONTACT_ADD_FAILED:String = NAME + '/message/contact/add/failed';

public static const UPDATE_CONTACT:String = NAME + '/message/contact/update';
public static const CONTACT_UPDATED:String = NAME + '/message/contact/updated';
public static const CONTACT_UPDATE_FAILED:String = NAME + '/message/contact/update/failed';

public static const REMOVE_CONTACT:String = NAME + '/message/contact/remove';
public static const CONTACT_REMOVED:String = NAME + '/message/contact/removed';
public static const CONTACT_REMOVE_FAILED:String = NAME + '/message/contact/remove/failed';

public function ContactMessage(type:String, contact:ContactVO=nulll)
{
                        // add headers if needed
super(type, null, contact);
}

public function get contact():ContactVO
{
return body as ContactVO;
}
}
}

JunctionMediator.as
:
override public function handlePipeMessage(message:IPipeMessage):void
{
switch(message.getType())
{
case ScreenMessage.GET:
//
break;
case ContactMessage.CONTACT_ADDED:
contactsProxy.addContact( ContactMessage(message).contact );
break;
case ContactMessage.CONTACT_UPDATED:
contactsProxy.updateContact( ContactMessage(message).contact );
break;
case ContactMessage.CONTACT_REMOVED:
contactsProxy.removeContact( ContactMessage(message).contact );
break;
case ItemMessage.ITEM_ADDED:
itemsProxy.addItem( ItemMessage(message).item );
break;
case ItemMessage.ITEM_UPDATED:
itemsProxy.updateItem( ItemMessage(message).item );
break;
case ItemMessage.ITEM_REMOVED:
itemsProxy.removeItem( ItemMessage(message).item );
break;
}
}

I really like using 'switch case' rather 'if, else if' statements in handlePipeMessage method. It makes my code cleaner.

Let me know what you think.

Mariush T.
http://mariusht.com/blog/

3  PureMVC Manifold / MultiCore Version / Generate some test data on: January 06, 2010, 10:14:14
Hi,

For SingleCore Version:
I would add some test data in UserProxy constructor like this:
public function UserProxy( )
        {
            super( NAME, new ArrayCollection );

            // generate some test data           
            addItem( new UserVO('lstooge','Larry', 'Stooge', "larry@stooges.com", 'ijk456',DeptEnum.ACCT) );
            addItem( new UserVO('cstooge','Curly', 'Stooge', "curly@stooges.com", 'xyz987',DeptEnum.SALES) );
            addItem( new UserVO('mstooge','Moe', 'Stooge', "moe@stooges.com", 'abc123',DeptEnum.PLANT) );
        }


Application doesn't work when i try to do the same thing for Multicore Version.

Do you add some test data in onRegister() method? like this:
private function onRegister():void
{
            // generate some test data           
            addItem( new UserVO('lstooge','Larry', 'Stooge', "larry@stooges.com", 'ijk456',DeptEnum.ACCT) );
            addItem( new UserVO('cstooge','Curly', 'Stooge', "curly@stooges.com", 'xyz987',DeptEnum.SALES) );
            addItem( new UserVO('mstooge','Moe', 'Stooge', "moe@stooges.com", 'abc123',DeptEnum.PLANT) );
}

It seems to be working this way.

Mariush T.
http://mariusht.com/blog/
4  PureMVC Manifold / MultiCore Version / Call the proxy methods through JunctionMediator? on: November 19, 2009, 07:47:29
Hi,

I would like to know if calling proxy methods through JunctionMediator is a good practice?

Scenario 1:
I send a message to the module, junctionMediator receives a message and call proxy methods.

Scenario 2:
I send  a message to the module, junctionMediator receives a messages and sends out note. Corresponding command is triggered which call proxy methods.

Thank You,
Mariush T.
http://mariusht.com/blog/
5  Announcements and General Discussion / Public Demos, Tools and Applications / NoteList - text notes manager on: November 13, 2009, 04:10:57
I want to share my latest application - NoteList - text notes manager.

It's an Adobe AIR application built on PureMVC(Multicore with Pipes) framework.

Why i built it?
I used to write my thoughts(notes) in text files, but after a while i had to many files all over my hard disk and it was hard to find what i was looking for. I wanted simple way to manage my thoughts :).

I encourage you to install and try it on your own.
http://mariusht.com/products/notelist/

I appreciate your Feedback!

Cliff, once again thank you for PureMVC framework.

Mariush T.
http://mariusht.com/blog/
6  Announcements and General Discussion / Architecture / Shared proxy in modular application? on: August 05, 2009, 10:34:18
Hi,
I am trying to create an application where main view shows users(in a list component) and cars for each user(in datagrid component).

Application has 7 modules:
MainDisplayModule - module with list, datagrid component and buttons 'Add User', 'Remove User', 'Edit User', 'Add Car', 'Remove Car', 'Edit Car'

UserCreatorModule - module with UserCreator(popup window) component - FirstName, Age textInputs, OK and Cancel button
UserEditorModule - module with UserEditor(popup window) component - FirstName, Age textInputs, OK and Cancel button
UserRemoverModule - module UserRemover(popup window) component - FirstName label, OK and Cancel button

CarCreatorModule - module with CarCreator(popup window) component - Make, Model, Year textInputs, OK and Cancel button
CarEditorModule - module with CarEditor(popup window) component - Make, Model, Year textInputs, OK and Cancel button
CarRemoverModule - module CarRemover(popup window) component - Make, Model, Year label, Ok and Cancel button

Having separate modules for popups gives me States and Substates in this application :).
Modules are connected with Pipes and each core(module) has its own StateMachine.

I have CarsProxy with methods addCar(car:CarVO), removeCar(car:carVO), getCars(), cars() and UsersProxy with methods addUser(user:UserVO), removeUser(user:UserVO), getUsers(), users().

Proxies add, remove and retrieve records from/to MySQL server.

Should I place CarsProxy, UsersProxy in a common library?

I dont know but i was thinking about creating another module(ServiceModule) and connecting it with modules. Modules could send and receive messages from/to ServiceModule. Is it a good practice?
Do you have a different approach?

I use Flex/Multicore, StateMachine, Pipes Utility.

Mariush T.
http://mariusht.com/blog/
7  Announcements and General Discussion / Architecture / Application needs architecture on: July 22, 2009, 09:38:14
I have problem with architecture of LiteFtpClient application(Flex/Multicore PureMVC, Pipes, StateMachine). You can see mockup below.

Initial window


Ftp address, username, password were entered. Application is in a process of connecting to the server(logging, getting directories), popup window is visible.


User can browse through files and folders in CONNECTED mode.


'New Folder' was clicked, popup window is visible


User is able to rename files, 'Rename' button was clicked


'OK' button was clicked in 'Delete File/Folder' popup window. 'delete item' request was sent to the server, application is waiting for response from the server. Popup window is still visible, 'OK' button is disabled.


I got following questions:

-should i create modules and StateMachines for each popup window? Maybe i am wrong, but i think it would be good to have FSMs(similar to that one below) for each popup window, application then can have States and SubStates.


-If i have modules for popups, when i should load them? Should i load modules one by one after user is successfully connected or maybe when for example, 'New Folder' button was clicked and popup window is about to be created.

- Do you add any view components into shell application? Should shell application only be responsible for loading, unloading, connecting and disconnecting modules?

-What are steps in your application development? Do you start with designing User Interfaces, Use Cases, States, etc?
I started with User Interfaces(screenshots) then i worked on States. Later i created SubStates, now i need modules since i have SubStates.

-How should i name modules, popup windows? DeletingModules or DeleteModule, FolderDeletingWindow...?

-How do you know how many modules you need? Is there any rule?
It looks like i need modules for states with substates.

+--DISCONNECTED
+--DISCONNECTING
+--CONNECTING
+--GETTING_DIRECTORIES
+--CONNECTED
   +--CREATING
   +--DELETING
      +--INITIALIZATION
      +--DELETING
      +--CLOSING
      +--FAILING
   +--RENAMING
   +--UPLOADING


Am i wrong?

I think i should have MainModule, BrowsingModule, DeletingModule and couple more for each popup windows.

MainModule, Main FSM Diagram, user is 'DISCONNECTED'.


BrowsingModule, Below FSM diagram can only happened when user(application) is in CONNECTED state.


DeletingModule, FSM Diagram for 'Delete' popup window


-Do you know any links to real world applications with source codes, any tutorials on how to architect this type applications?

I would like to to here your thoughts.

NOTE!!! Above application is for my practice purpose only(not for a client) and I will be happy to share source code with the community at the end.

Mariush T.
http://mariusht.com/blog/
8  Announcements and General Discussion / General Discussion / Can Proxy send StateMachine.ACTION Notification? on: July 13, 2009, 01:22:53
Hi,

Can Proxy send StateMachine.ACTION notification that triggers the StateMachine to begin a transition between States? If yes, do you have any real world scenarios when this happens. I know from your presentation http://puremvc.tv/#P003/ that Command or Mediator can send StateMachine.ACTION Notification, but i am not sure about Proxy.

Mariush T.
http://mariusht.com/blog/


9  Announcements and General Discussion / Public Demos, Tools and Applications / Module to Module communication (Flex/Multicore PureMVC/Pipes) on: July 08, 2009, 02:52:55
I just made a very simple demo where modules can talk to each other even if they are NOT connected to Shell/Application. Modules are loaded dynamically and connected with pipes (Module->Pipe->Module).

It's a perfect demo for beginners.
http://mariusht.com/blog/2009/07/08/module-to-module-communication/

Mariush T.
http://mariusht.com/blog/
10  Announcements and General Discussion / Architecture / Converting Array into XML in Proxy or in Command? on: June 03, 2009, 04:28:58
Hi,
I am retrieving an array of objects(categories and subcategories) from MySQL database.
I want to convert this array into hierarchical xml data(please see demo).
 
http://mariusht.com/blog/2009/04/30/converting-array-of-objects-into-hierarchical-xml-data/
http://mariusht.com/files/blog/array_into_xml/demo/ArrayIntoXml.html

Can you tell me where i should put logic for above conversation? Should i do it in Proxy or maybe in Command?

Thank You,
Mariush T.
11  Announcements and General Discussion / Getting Started / PureMVC actors and their responsibilities on: May 23, 2009, 07:34:58
Hi,
I have been studying PureMVC for a couple days now and I think i got good understanding about the framework.
I made a simplified diagram of core actors: facade, mediator, command, proxy and their responsibilities.
I want to put below picture on my blog http://mariusht.com/blog/ but i am not sure if i got this right.

Do you think i should add anything or maybe remove something from my list?


Any help is appreciated.  Thanks.

Mariush T.
Pages: [1]