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
1  Announcements and General Discussion / General Discussion / PureMVC notification or Flash Event? on: July 06, 2010, 02:05:47
This is probably a easy one but.. i am confused all of a sudden about how I should handle this scenario.  I have a UserManager component that is similar to the EmployeeAdminDemo.  Basically the view component has a mode property that controls weather certain buttons, fields are displayed and enabled.  If a user is editing his own profile then certain controls like, userID, status and role should be disabled.  Also, if a user is an admin or super user then they will have access to certain controls that a regular user will not have.  Should I be managing this property and the responses to its changes using the custom event way or should I use the PureMVC communication system to send notifications to the view component's mediator?  Or does this even make a difference?

Thanks.
2  Announcements and General Discussion / Architecture / Re: Flex databinding of VO's (model <> view) , good or bad? on: February 19, 2010, 08:36:16
Did some more research last night and I think what I need to do is as stated in this post.  http://forums.puremvc.org/index.php?topic=1365.0

By creating a custom view component that comes with its built in VO? Also, this would probably help some when I have to validate all my fields too.  Well... we'll see how it works out.
3  Announcements and General Discussion / Architecture / Re: Flex databinding of VO's (model <> view) , good or bad? on: February 18, 2010, 03:07:56
Gotcha.  I think I am doing what you said.  My proxy has a VO that is bindable.  The mediator sets the components locale VO copy to the proxy's VO.  However, looking at the EmployeeAdmin demo I see that a new UserVO is created and sent back on Submit().  I was thinking that the approach described in this topic would eliminate the need to send VO's back and forth because we would be working with the same copy.  This may be my inexperience showing but I thought that the bindable communication was both ways. 
So that if I have this...

[Bindable] public var currentProject:ProjectVO = new ProjectVO;
<mx:TextInput id="pd_projectCode" text="{currentProject.projectCode}"/>

it would mean that and changes to the pd_projectCode.text are also reflected on the currentProject.projectCode.  My view component has alot of fields so was trying to prevent having to get assign all the component values to my VO to be sent back to the proxy.

Is this possible?
4  Announcements and General Discussion / Architecture / Re: Flex databinding of VO's (model <> view) , good or bad? on: February 17, 2010, 08:52:16
Could someone please post and example of extending the VO to show it can by bound between the view and the proxy?

Thanks
5  Announcements and General Discussion / General Discussion / Time for Pipes? on: January 20, 2010, 01:29:17
Hello,
I haven't delved much into the Pipes Utility for being afraid of being overwhelmed.  However, after a small refactor today, I think it may be time to make the plunge.  My application initially showed a data grid with summary data.  When the user clicked on an item the state would change sliding up the grid and showing a tab navigator with tabs showing the details of the selected grid item.  The change I made was to now show the details in a pop-up TitleWindow.  However, I now realize that I want to give the user the ability to work with more than one item at a time and still interact with the main application.  Would this be a scenario where the Pipes utility is relevant?

Thank you
6  Announcements and General Discussion / General Discussion / Re: final proxy classes (a question about style) on: January 08, 2010, 01:49:16
Ok. So here's what I have done.  I tried to follow what Cliff said.  Please hang with me.

I have created a ProjectSummaryVO that will just hold the project summary data used to list summary project data on the MainScreen's datagrid after successfull login. The ProjectSummaryProxy is responsible for getting the project summary data when the application starts up.
My MainScreen view has an instance of the ProjectSummaryVO named currentProject that is populated each time the user clicks a project item on the grid.  I have a custom ProjectEvent that is dispatched sending along the currentProject.

:
// MainScreenView.as
[Bindable] public var currentProject:ProjectSummaryVO = new ProjectSummaryVO;

// happens when user selects a project item on the data grid
public function selectProjectHandler(event:ListEvent):void {

// populate currentProject from selected item
currentProject = event.itemRenderer.data as ProjectSummaryVO;

// go get this project's details
this.dispatchEvent(new ProjectEvent(ProjectEvent.GET_PROJECT_DETAIL, currentProject));
}

The ProjectEvent is heard by the MainScreenMediator.  The MainScreenMediator then calls the facade to register a unique ProjectDetailProxy using the projectID passed via the event.

:

// MainScreen Mediator
override public function onRegister():void {
appProxy = facade.retrieveProxy(ApplicationProxy.NAME) as ApplicationProxy;
loginProxy = facade.retrieveProxy(LoginProxy.NAME) as LoginProxy;
projectProxy = facade.retrieveProxy(ProjectProxy.NAME) as ProjectProxy;

// listen for main screen events
mainScreen.addEventListener(LogoutEvent.LOGOUT, tryLogout);
mainScreen.addEventListener(ProjectEvent.GET_PROJECT_DETAIL, getProjectDetail);
}

// create a unique proxy for this project's details
public function getProjectDetail(event:ProjectEvent):void {
facade.registerProxy(new ProjectDetailsProxy(event.project);
}

Like Cliff said, when I register the new ProjectDetailsProxy I make a service call to get the project details.

:
// ProjectDetailsProxy //

// remote object instance references
private var project:ProjectDetailVO = new ProjectDetailVO();

// constructor takes project
public function ProjectDetailsProxy(currentProject:ProjectSummaryVO) {
project.projectID = currentProject.projectID;
super(currentProject.projectID.toString(), project);
}     


// configure the proxy when registered
public override function onRegister():void {
        projectService  = new RemoteObject("ProjectService");
        projectService.source = "TSProjectRunwayServiceLibrary.com.tspr.business.ProjectService";
        projectService.getOperation("getProjectDetails").addEventListener(ResultEvent.RESULT, projectDetailsLoaded);
        projectService.getOperation("getProjectDetails").addEventListener(FaultEvent.FAULT, projectDetailsFailed);
         
        // immediately get the project details           
       getProjectDetails(this.projectVO.projectID);
}

Ok. So now a new ProjectDetailsProxy is created each time the user clicks on a different project.  My question is now. Am I overwriting an existing ProjectDetailsProxy when I click one project, click another project and then click back on the previous one?  Since the same projectID is being used as the ID.  Or should I be asking the facade if a ProjectDetailsProxy exists with this projectID before creating another one?  If the facade still has a reference to the proxy then that would keep me from having to go back to the database for the same project details, However, how many proxys is too much? When should I start deleting them?

Thanks for your patience.
7  Announcements and General Discussion / General Discussion / Re: final proxy classes (a question about style) on: January 06, 2010, 09:19:13
I think this is what I need to do but still need some help on how.  I have an application that manages projects.  Upon logging in my ProjectProxy goes and gets all of the data from the project_tbl and sends it to the MainScreen Mediator. 

1.  The MainScreen has a projectList array collection that holds all of the project data. The MainScreen view's initial state has a ADG that shows only some of the project data.  When the user clicks on an item the state changes, sliding up the ADG and showing a TabNavigator with 4 tabs that shows the project detail.  The first tab is General Info showing all of the data for the project stored in the MainScreen's projectList array. The MainScreen also has a currentProject VO that holds the currently selected project.  Is it ok to store this data in the view?  When the user edits a project I am going back to the database to get the updated project data.  I feel this may not be the most efficient way.

2. How should I manage getting the data for the other tabs ie. Resource Tab, Financial Info Tab, Comments Tab?  The ADG is still shown to the user.  When the user clicks on a different project I need to go and get the data for these other tabs.  Should I have a ProjectDetailsProxy that holds a ResourceTabVO, FinancialTabVO, CommentsTabVO?  Or should each of these tabs have its own proxy?  Should I have a proxy for the ADG which shows the summary data?

Thanks for listening.
8  Announcements and General Discussion / General Discussion / Passing Around Data on: October 06, 2009, 06:30:29
Hi.  Is this an ok way to pass around data?

:
         
        //IN APPLICATION MEDIATOR
        // user was returned from the login proxy
        case LoginProxy.LOGIN_COMPLETE:
        // create a user instance from the body
        var user:UserVO = body as UserVO;
        // set the global application user
        appProxy.appUser = user;
        // the main screen view component has a label welcoming the user so I need to get the main screen mediator
        var mainScreenMediator:MainScreenMediator = facade.retrieveMediator( MainScreenMediator.NAME ) as MainScreenMediator;
        // main screen exposes a public variable called 'appUser' that is set by its mediator
        mainScreenMediator.setUser( user );
        // change the view to the main screen
        changeView( ApplicationFacade.MAIN_SCREEN );
        break;
9  PureMVC Manifold / Demos and Utils / Re: Loadup - A PureMVC AS3 Utility on: October 05, 2009, 01:05:46
Thanks Phillip... Unfortunately, I tried that also but get the same results.  I have just elected to just get the projects after PureMVC starts up and use a notification to send the data to my login view and just pop a database down message to the user if the projects cant be loaded.  I may not have had the best scenario for the utility.  Maybe somewhere down the line i will retry it.  I have learned a lot however, just be trying to implement it though.  Thanks for the help!
10  PureMVC Manifold / Demos and Utils / Re: Loadup - A PureMVC AS3 Utility on: October 05, 2009, 06:45:54
I don't understand.  I am doing what is being done in the LoadUpAsOrdered demo.  In the LoadResourcesCommand,  a customer proxy is created as an ILoadupProxy and then registered with the facade.  That same proxy reference is passed to the makeAndRegisterLoadupResource method to create a LoadupResourceProxy.  The only difference I can see is that no data is actually being passed in the mediator to the notification.  Is it that my scenario is not the right one for the loadup utility?  Or maybe i am just lost  ???
11  PureMVC Manifold / Demos and Utils / Re: Small Sequencing Issue on: October 02, 2009, 07:21:17
Sounds as if the Proxy isn't registered.

By the way, you should define the notification constant on the Proxy so that the Proxy isn't bound to the ApplicationFacade. The Proxy can then be reused in other applications without relying on a constant that it depends on to be defined elsewhere.

-=Cliff>

Thank you. I registered the ProjectProxy in the LoadResourcesCommand

:
public class LoadResourcesCommand extends SimpleCommand implements ICommand
{
private var monitor:LoadupMonitorProxy;

public override function execute( note:INotification ):void {
facade.registerProxy( new LoadupMonitorProxy() );
this.monitor = facade.retrieveProxy( LoadupMonitorProxy.NAME ) as LoadupMonitorProxy;

var projectProxy:ILoadupProxy = new ProjectProxy();
facade.registerProxy( projectProxy );

makeAndRegisterLoadupResource( ProjectProxy.NAME, projectProxy);
this.monitor.loadResources();
}

private function makeAndRegisterLoadupResource( proxyName :String, appResourceProxy:ILoadupProxy ):LoadupResourceProxy {
var r:LoadupResourceProxy = new LoadupResourceProxy( proxyName, appResourceProxy );
facade.registerProxy( r );
monitor.addResource( r );
return r;
}
}

I did what you said and defined the notification constant in the ProjectProxy.

:
        public function loaded( asToken:Object=null ):void {       
        var projects:Array = [];
        for each ( var item:Object in asToken.result ) {
        projects.push( { label: item.domain, data: item.domain } );
        sendNotification( ApplicationFacade.LOADING_STEP, asToken.result.length / projects.length * 100 );
        }
        // set the proxy's data to be retrieved from interested mediators
setData( projects );

// send the project's loaded notification.  mediators can get its data from the facade using the NAME passed in the body
sendNotification( ProjectProxy.PROJECTS_RETRIEVED, ProjectProxy.NAME );
        }

... and then to get the data ...
:
            case ProjectProxy.PROJECTS_RETRIEVED:
            var projects:Array = facade.retrieveProxy( body as String ).getData() as Array;
            loginForm.domainSource = ( projects );
            break;

but the projects is still null.
12  PureMVC Manifold / Demos and Utils / Re: Small Sequencing Issue on: October 02, 2009, 06:33:54
Yes.  It is the ILoadupProxy.  I am setting its data with results from the remote call.  I can see where the data is populated.  However, trying to retrieve it from the mediator by the name is giving me a null exception.
13  PureMVC Manifold / Demos and Utils / Re: Small Sequencing Issue on: October 01, 2009, 02:58:00
Hi. Been away for a while. But thank you for responding.  The following gives me a null proxy object.  The facade isn't able to find it based on the name.  Am I doing something wrong?
:
                [b]Project Proxy[/b]
// setting the name
public static const NAME:String = "ProjectProxy";

        // set the proxy's data to be retrieved
setData( projects );

// send the project's loaded notification.  mediators can get its data from the facade using the NAME passed in the body
sendNotification( ApplicationFacade.PROJECTS_LOADED, ProjectProxy.NAME );

                [b]LoginMediator[/b]
            case ApplicationFacade.PROJECTS_LOADED:
            projectProxy = facade.retrieveProxy( body as String ) as ProjectProxy;
            loginForm.domainSource = ( projectProxy.getData() as Array );
            break;
14  PureMVC Manifold / Demos and Utils / Re: Small Sequencing Issue on: August 27, 2009, 11:29:42
Yes.  I got rid of that error. By sending my ILoadupProxy (ProjectProxy.NAME) in the resource loaded command notification. 

But... this brings me right back to an earlier question.  I have to send another notification from the ProjectProxy to get its data. So my ApplicationFacade reacts to the ApplictionFacade.PROJECTS_LOADED note and changes to the Login view (just until I figure out the STATE MACHINE) and my LoginMediator responds to the ProjectProxy.PROJECTS_RETRIEVED note and tries to populate the combo box with the data from the ProjectProxy.  Everything seems to be working.   I'm just wondering if it is ok to do it this way.

Thanks.

:
ProjectProxy
        // remote login procedure is successfull
        public function loaded( asToken:Object=null ):void {       
        var projects:Array = [];
        for each ( var item:Object in asToken.result ) {
        projects.push( { label: item.domain, data: item.domain } );
        }
setData( projects );
sendNotification( ApplicationFacade.PROJECTS_LOADED, ProjectProxy.NAME );
sendNotification( ProjectProxy.PROJECTS_RETRIEVED, data );
        }

ApplicationFacade
case ApplicationFacade.PROJECTS_LOADED:
       app.appView.selectedIndex = 2;
break;

LoginMediator
case ProjectProxy.PROJECTS_RETRIEVED:
       loginForm.projectSource = ( body as Array );
break;
 
15  PureMVC Manifold / Demos and Utils / Re: Small Sequencing Issue on: August 27, 2009, 07:45:13
I see my answer.  Right in the documentation.  Thanks.
Pages: [1] 2