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 / Re: Timer and Proxy on: November 22, 2009, 01:54:09
Ah i see there http://forums.puremvc.org/index.php?topic=799.msg3754#msg3754 that both are acceptable.
I will go for the proxy this time.
2  Announcements and General Discussion / General Discussion / Timer and Proxy on: November 22, 2009, 01:16:49
Hello coders  :)

I have a requirement where a timer is ran in the background of my app.
Every minutes it makes an http call to a web server.

In case of a particular state in my app: when at least two users are connected to my session i should make a different http call and increment a clock counter (every second) of a ViewComponent.

At the beginning i started doing the ticking in a clockMediator calling the proxy when needed and updating the view as well.

Should i instead have the the timer and counting of "total seconds" and "total seconds with multi users" in the proxy ? Emitting a notification every seconds when multi user condition is true ?.

Thanks for your wise advices,

Greg


3  Announcements and General Discussion / General Discussion / Re: Board Architecture, refactoring and planning on: November 17, 2009, 12:05:07
Thanks i made it dynamic all good.

An other ( ;D) question bothering me.

I have a boardview (canvas) with shapes drawn on it.
I keep drawn shapes in a boardProxy shapeList arrayCollection. They are just a copy of the real shapes attached to the canvas on the view.

Now, i draw a selectArea on the board ==> View action.
Then i detect the shapes inside this area: i look for all shapes from the boardProxy that have x,y,... matching the inner area of my selectArea surface ===> This happen in the mediator since i need to get the shapes from the proxy.
All shapes matching are added to selectedShape ArrayCollection in the boardProxy.

If i want to detect mouse down on the group selectArea surface i will have to do it in the mediator again. On click down i have to 'copy' all Selected Shapes positions for proper positionnement on mouveMove:

shape.x = originalePos.x + (dest.x - localClickPoint.x);               
shape.y = originalePos.y + (dest.y - localClickPoint.y);

So basically it is Visual but it requires boardProxy to get the List of Selected Shapes.


Should i have my onMultiSelectAreaMouseUP / DOWN / MOVE in my View taking a mouseEvent AND a shape Array Collection as an extra parameter ?

Should i keep those in the mediator ? Accessing and Manipulating the view components from getViewComp() ?



I am trying to give more responsibilities to my views, i was doing to much view work in the mediator.

Thank you for your time,

Greg



4  Announcements and General Discussion / General Discussion / Re: Board Architecture, refactoring and planning on: November 14, 2009, 01:07:26
Can a view component be a dynamic canvas created at run time ?
5  Announcements and General Discussion / General Discussion / Re: Board Architecture, refactoring and planning on: November 14, 2009, 10:42:17
Thank you for taking the time to answer my post !

It's quite interesting, let's take for now the current way copy paste work:  http://screenr.com/AvB


Copy
====
Application mediator listen for ctrl c/ctrl v
catch ctrl c and starts a copyShapesCommand
Command look into currentBoardProxy BoardProxy for selectedShapes arraycollection.
It clones those to copyShapes in currentBoardProxy

Paste
====
PasteCommand
Look into currentBoardProxy for copyShapes
Get the bounded box coordinates around all shapes (w,y,width, height) on the current BoardView.
Activate copy shapes select skin
Push the current copyShapes to boardProxy selectedShapes.
Tellsthe BoardMediator to draw the multiselectArea on the boardView.

I guess i indeed coupled my BoardView and BoardMediator too much. The 'bounded select box' should be drawn by my view not the mediator !
Gonna do some re-factoring for next versions !

This board app is very good to plan a good architecture.

Greg



6  Announcements and General Discussion / General Discussion / Re: View updates itself -- should this be avoided? on: November 11, 2009, 12:13:07
I would keep this one on view side since it does not come from the action of a notification nor imply some change on a proxy.

I may be wrong.
7  Announcements and General Discussion / General Discussion / Board Architecture, refactoring and planning on: November 11, 2009, 12:02:50
Greetings Architects  ;D

I want to re-factorise some of my code (edoboard.com) as i am starting to feel the need for a better architecture and i realised i was doing many things badly even within the boundaries PureMVC (mixing mediator and proxy roles, not enough commands and so on.

Here is a simplified diagram of the current classes.
http://i34.tinypic.com/24fxuft.png



On the view side i have Tabs, each Tab holding a Canvas where i can draw and manipulate shapes.

Therefore we have a BoardManagerMediator handling the following actions: close tab, add tab, duplicate tab. It also keeps reference to a proxy called BoardManagerProxy.

BoardManagerProxy keeps a list of BoardMediators (one boardMediator = one tab).
It also have attributes like 'currentBoardMediator' 'currentShape' 'selectedShapes' ...

1.Is it the good place to hold these  ?
2.What about the naming, does it make sense ?

Shapes

When i add a shape the BoardMediator i s responsible for listening to the mouse down / move / up events. It looks in a toolbarProxy to see the current selected shape and starts drawing it on mouse down.

That is just  the instantiation of a Circle Shape and resizing its width/height on mouse move until a mouse up.

On mouse up the boardMediator pushes the shape to Shape list boardProxy, and send a Notification (with the new shape as the body) to the BoardManagerMediator.

The boardManagerMediator update the current Shape attribute on its boardManagerProxy. The shapeid counter (boardManagerProxy) is also incremented.

3. I definitely forgot a lot of things but is there any big architecture flaws so far ?

Each Shape needs a mediator and a Model (proxy) ?.

Sample of a simpleShapeModel

:

package com.roguedevelopment.objecthandles.example
{
import com.roguedevelopment.objecthandles.IMoveable;
import com.roguedevelopment.objecthandles.IResizeable;

public class SimpleDataModel implements IResizeable, IMoveable
{
[Bindable] public var x:Number = 10;
[Bindable] public var y:Number  = 10;
[Bindable] public var height:Number = 50;
[Bindable] public var width:Number = 50;
[Bindable] public var rotation:Number = 0;
}
}

Should the proxy hold the model ? Or should the model be also a proxy ?

Actually i need a minimalist mediator since all rotation/move stuff are handled by an external library (objecthandle).

My mediator will just keep a reference to the model and offers functions like update fill color, opacity etc. These functions will be called by the boardMediator. we do not want all shapes to listen for the update color notification and check if its for them.

So at the end my boardProxy will hold a list of ShapeMediator ?


Multi selection

I want to redo my multi selection to handle ctrl key to remove a shape from a selection and shift to add one. I was going to do it from the shape mediator.


The shape know when it receives a mouse down event with ctrl/shift key activated. That means all shapes listen for ctrl/shift key ?

It then fires an event like 'add_to_selection_group' which is catch by the boardMediator. The boardMediator send a addShapeToGroupCommand

Maybe it is at the boardMediatorManager level that we should look for the ctrl/shift key ?

Anyway our addShapeToGroupCommand will get a hand on the currentBoardMediator from boardManagerProxy and manipulate it to redraw the selection area, and update the boardManagerMediator proxy selectedShapes attribute.

That is way too long and maybe not very intelligible, but i have no occasion to share these design questions :)

Looking to have some good design i can be happy to look at.

Thanks !

Greg

8  Announcements and General Discussion / General Discussion / Re: Use case shift key state and mediators on: November 10, 2009, 10:22:11
Ok and they still keep their local boolean.
I created a keyBoardProxy to hold the variable in the mean time but using notifications fired from application Mediator is cleaner.

Greg
9  Announcements and General Discussion / General Discussion / Use case shift key state and mediators on: November 09, 2009, 03:05:28
Hello Pure Flexers,

I wanted to share a small design question i am on.
I have several mediators who need to know the state of shift key (stage) at a given time.

For now each mediator was listening for key down event and updating a local boolean isShiftKeyActive.
Each mediator also have their own proxy.
I was thinking of adding a sharedProxy unique for all mediators which will have other properties and actions than a shift key state holder.

What do you think ?  ???
10  Announcements and General Discussion / Public Demos, Tools and Applications / Re: Edoboard advance whiteboard for Math: PureMVC AFCS Degrafa on: June 18, 2009, 01:29:20
Thanks guys,

Ondina > Are you from France ? Paris ?

Cliff> You mean the function grapher ? f(x). About getting back actions, ctrl-z will be added tommorow ;)

If you know any geek or not so geek math teachers we would also love to get feedbacks from them.

Next big steps:
A scientific calculator (first use case of multicore)
Then we will start tackling  physic and electronic, playing with on off switch in real time seems so fun !




11  Announcements and General Discussion / Public Demos, Tools and Applications / Edoboard advance whiteboard for Math: PureMVC AFCS Degrafa on: June 18, 2009, 07:19:02
Hi there,

About 10 months after i came around here starting to learn as3 and PureMVC, we finally have something to show.

Edoboard is an education oriented collaborative platform, especially useful for tutoring Math online.

It uses PureMVC single Core (multi core on the todo list for better modularity), AFCS for collaboration between users actions and Degrafa for shapes and skinning.

There are still a lot of thing to improve and some architecture to refactorise, but PureMVC really helped me in organizing the code.

I am open to any critics and suggestions.

Quick Walk through: http://www.youtube.com/watch?v=PTLpVFuWq7A

You can test it online by clicking "test" on http://www.edoboard.com


Cheers, :)

12  Announcements and General Discussion / General Discussion / PopupManager, and recurring popup, design question on: March 11, 2009, 11:22:17
Hi all,

I saw a topic on using a PopupManager with static methods to close and create popup given its Component CLass and MediatorClass.
In my case i have a popup that a user can call then close then call again ect.., this popup is kind of expensive to instantiate so for now i was just "hiding it" and keeping only one mediator handling the hide unhide.
But that is uncompatible with the popup manager way of doing things.

How would you handle such Popups ?

Thanks a lot

Greg
13  Announcements and General Discussion / General Discussion / Re: CoCoMo and PureMVC advices needed on: December 22, 2008, 12:46:25
I did manage to create and connect to a room, but also got side tracked doing a demo for a new utility.

-=Cliff>

Hi cliff,
Did you connect in the standard cocomo way or with puremvc using some kind
of cocomo mediator / model ?
14  Announcements and General Discussion / General Discussion / Re: CoCoMo and PureMVC advices needed on: November 28, 2008, 01:02:52
Any news after this nice week ?  ;D
15  Announcements and General Discussion / Architecture / Re: Mediator with multiple views, toolbar stack ? on: November 25, 2008, 07:19:25
I did not know about states looking at it right now,
Thanks  :D
Pages: [1] 2