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 / Getting Started / Re: Best Practices for Array of Proxy objects? on: June 23, 2008, 05:18:53
I am working in the same way as the TS. I traverse down the nodes, and instantiate new proxies for each node.

I rather only have one proxy object, but were afraid to use the type descriminator, because that would "break" the puremvc model.

But, if this is confirmed by mister puremvc himself, I think I will go back to a single proxy for all tree objects
2  Announcements and General Discussion / Architecture / Re: Asynchronous command chaining on: April 13, 2008, 04:10:10
I implemented the spicelib into my PureMVC project.

I have a command which needs to send and process about 100 request to a httpremoteobject. If I execute all these at the same time, te buffers in apache will run dry and array index out of bounds exceptions are thrown. So to make these request sequential, I use the SequentialTaskGroup from spicelib in my command:

Command excerpt
:
var taskSequence:SequentialTaskGroup = new SequentialTaskGroup();
for(i = 0; i < numOfStatuses;i++)
{
  for(j = 0; j < numOfProjects; j++)
  {
  var status:RemoteStatus = statuses.getItemAt(i) as RemoteStatus;
  var project:RemoteProject = projects.getItemAt(j) as RemoteProject;
  var projectStatus:ProjectStatus = new ProjectStatus(project,status);
  var issueProxy:IssueProxy = new IssueProxy(projectStatus);
  facade.registerProxy(issueProxy);
  taskSequence.addTask(new LoadIssuesTask(issueProxy));
 
  }
}
taskSequence.addEventListener(TaskEvent.COMPLETE, doComplete);
taskSequence.start();

My task class invokes the load function in the issueProxy and also implements the IResponder interface to tell the task it is completed:
:
public class LoadIssuesTask extends Task implements IResponder
{
protected var issueProxy:IssueProxy;

public function LoadIssuesTask(issueProxy:IssueProxy)
{
this.issueProxy = issueProxy;
setCancelable(false);
setSkippable(false);
setSuspendable(false);
}

protected override function doStart () : void
{
    var token:AsyncToken = issueProxy.load();
    token.addResponder(this);
}

public function result(data:Object):void
{
complete();
}

public function fault(info:Object):void
{
}
}

Now all my http request are executed sequentially
3  Announcements and General Discussion / Getting Started / Re: strongly typed objects in array collection on: November 29, 2007, 07:24:55
Thanks for your quick and helpfull reply!. I really enjoy working with the PureMVC, especially with the expertise available on the forum.
4  Announcements and General Discussion / Getting Started / Re: strongly typed objects in array collection on: November 29, 2007, 05:12:41
I can see your point and PureMVC should not be responsible to manage the flex events.

But, because I am somewhat lazy and do not want to sendout notifications to every component mediator listening to the proxy I solved this a bit different :)

My remoteService returns an ID from the added object. In the event result handler I retrieve the object from the java backend and add it to the arraycollection.

But sending out refresh notifications is not really a big deal either. Which option is best?

I am planning to integrate messaging as well later. My proxyies will listen to incoming messages and will change the datamodel. Is it better to use notifications for this as well?
5  Announcements and General Discussion / Getting Started / Re: strongly typed objects in array collection on: November 28, 2007, 11:18:44
Back again for one simple question.

I added an item to the database through the remote service. When I retrieve the list again, the data object is renewed, but the changes are not passed to listening components.

Is it better not to updatethelist from the server, but to add the user to the arraycollection manually? (this updates listening components :))
6  Announcements and General Discussion / Getting Started / Re: strongly typed objects in array collection on: November 02, 2007, 09:38:10
Ok, I got every thing setup correctly now, and it seems that value that holds an array collection is cast to an array collection resulting in a nested array colleciton.

In the Architecture 101 demo, values are added using addItem method. Should I do this as well?

:
package nl.qnh.qanban.model
{
import mx.collections.ArrayCollection;
import mx.rpc.events.ResultEvent;
import mx.rpc.remoting.RemoteObject;
import mx.utils.ArrayUtil;

import org.puremvc.interfaces.IProxy;
import org.puremvc.patterns.proxy.Proxy;

public class KanbanBoardProxy extends Proxy implements IProxy
{
public static const NAME:String = 'KanbanBoardProxy';

private var qanbanServiceRO: RemoteObject;

public function KanbanBoardProxy()
{
super(NAME, new ArrayCollection());
qanbanServiceRO = new RemoteObject("qanbanServiceRemote");
qanbanServiceRO.addEventListener("result", getKanbanBoardListEventHanlder);
qanbanServiceRO.getKanbanBoardList();

}

public function getKanbanBoardListEventHanlder(event:ResultEvent):void
{
kanbanBoards.source = ArrayUtil.toArray(qanbanServiceRO.getKanbanBoardList.lastResult);
trace(kanbanBoards);
}

public function get kanbanBoards():ArrayCollection
{
return data as ArrayCollection;
}

override public function getProxyName():String
{
return NAME;
}

}
}

What should I do to prevent this? I am still a novice concernign action script, but very eager to learn :)
7  Announcements and General Discussion / Getting Started / Re: strongly typed objects in array collection on: November 01, 2007, 04:02:30
Thank you for your good reply. However, my Flex Builder 3 prevents me from debugging somehow. Even when I run the application server in debug mode, and start the form from application server, nothing happens when the code reaches the breaklines. I will look into it further later today.

Kind regards,

Bart
8  Announcements and General Discussion / Getting Started / strongly typed objects in array collection on: October 30, 2007, 02:45:33
I have a Java Swing GUI background using a framework (JGoodies) that is very similar to PureMVC and because of the good documentation, i choose to use PureMVC. But enough with the kudo's...

I have a remote service call to a Spring bean which returns a list of objects. With xdoclet 2 I created the VO objects to be used by PureMVC. The VO objects have a source reference to the java class.

My Proxy has an arraycollection as data value and this is filled nicely in the constructor. This works very well. however when I want to display the arraycollection in a DataGrid with no columns defined, I can only see 1 row with information about the arraycollection instead of the 5 items in the arraycollection. When defining the columns and their dataFields, no rows are shown.

I have been searching for hours on how to get the objects out of my arraycollection and on to the screen. Could anyone give me some tips to get me started?
Pages: [1]