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

Pages: [1]
Print
Author Topic: Context aware UI component  (Read 7087 times)
simon.hjorth
Newbie
*
Posts: 4


View Profile Email
« on: March 03, 2009, 01:26:28 »

Hi all,

I'd like some advice concerning how to achieve a context aware UI component.
Say we have some modules who all, in one or more of their views, want to give the user the ability to create a note containing one or more relevant tags, as well as viewing/editing notes relevant to the context. We could then have a Note module containing a create/edit/view note UI-component, a mediator and a proxy that takes care of storing and retrieving notes. Every module in need of this functionality could request the UI-component from the Note module (through pipes) and add it to the modules own view.
The question now is, what if the Note UI-component needs to be context aware when creating and showing notes. I.e. it should only show notes relevant to the context of the view it is currently residing in, in the module to which it has been exported. As the context of the view changes (i.e. a user selects a different row in a table) so should the Note UI-component.
How do we pass this context, from the module's view to the imported UI-component? and how do we continue to do so as the context changes.
Should the UI-component/Note-module, through it's Mediator and Commands somehow be aware of which module it has been exported to, and request the current context (through pipes) of this module before executing any actions, such as retrieving and storing notes? Or should the module utilizing the Note UI-component consequently (through pipes) notify the Note module of it's current context every time the context changes, so that this can be taken into consideration when retrieving and storing notes? Or something completely different perhaps :-)

Is there a best practices way of doing this?

Thanks in advance
Regards,
Simon
Logged
simon.hjorth
Newbie
*
Posts: 4


View Profile Email
« Reply #1 on: March 13, 2009, 04:53:14 »

Any suggestions/ideas? :-)
Logged
puremvc
Global Moderator
Hero Member
*****
Posts: 2871



View Profile WWW Email
« Reply #2 on: March 14, 2009, 07:32:51 »

When a selection is made, send a message down the pipe to the Note module, with a ref erence to the note to edit/view. In the module turn the message into a notification the mediator for the note editor is interested in, which displays the note in the note editor ui.

-=Cliff>
Logged
Pages: [1]
Print