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 / Architecture / Re: Best practice for XML-fed widgets on: February 02, 2009, 10:17:46
Thanks a lot, Cliff... some useful ideas here.

My layout uses a single "canvas" of three columns. The XML specifies which "slot" a widget should go into (via attributes ie. column="1", row="2").

I'm using "WidgetType" definitions to determine which class of widget to create -  for example, VIDEO would create VideoWidget, RSS creates an RssWidget and so on, all of which extend a "BaseWidget" class, making use of the flash.utils.getDefinitionByName() method which turns strings into Class references.

The only complication is that these widgets have varying default sizes, and once their content loads (an RSS feed for example), they generate their display and some will expand or contract to fit, moving everything below them in their column if need be. I can expand a story in, say, the "NewsWidget" which would move everything below it downwards.

I've had no problem generating the widgets and adding them to the view. It is the maintenance of the overall column heights and positioning of the widgets themselves that I am struggling with... in terms of who should be looking after all that - the proxy, the mediator or the WidgetCanvas view component that contains the actual visual elements?

I will investigate further, and thanks again for your advice... Great to have the main man taking such an interest in the PureMVC posse at large!

From snowed-under London, warm regards

SJ

2  Announcements and General Discussion / Architecture / Best practice for XML-fed widgets on: February 02, 2009, 03:41:38
Hi guys,

I'm just wondering what the best approach is for building a screenful of expandable widgets in Flash, in terms of keeping track of dimensions, position, loading status etc. The only slight complication is that the layout of the widgets and the content that populates each one of them, as well as the assets file required to build them graphically, are loaded independently.

I have read that many architects prefer to have their Mediators as "dumb" as possible, so I don't want my WidgetMediator doing too much work to create them, but at the same time, I don't want any individual view components flexing their little muscles too much either, as that would just be contrary to what I think PureMVC is all about.

I'm trying to figure out how a data proxy can fit into the equation to keep track of everything.

The app loads a single config file, which then contains paths to 2 things:

1. a shared library which includes fonts (no widgets can even be initialised until this happens)
2. a path to the "widget list" - which in turn contains the setup for each widget, and a path to its XML feed.

Should I use a Proxy to create a "virtual layout" as various responses are received, and sending a notification when enough data has been received to create something visual? Or is it OK to have a Mediator picking up on the relevant notifications (such as config loaded, widget list loaded, assets initialised etc.) and doing the layout work itself?

Any advice welcome. I'll be happy to share source code when the app is complete.

Cheers

SJ



Pages: [1]