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: How to use resourceManager in Mediators  (Read 10740 times)
akmansoor
Newbie
*
Posts: 9


View Profile Email
« on: November 10, 2008, 03:35:06 »

I am using resourceManager in my views using resourceManager.getString("myResource","myLabel")
How do I use the same in my mediators.

Thanks,
Mansoor Achire
Logged
puremvc
Global Moderator
Hero Member
*****
Posts: 2871



View Profile WWW Email
« Reply #1 on: November 10, 2008, 05:11:25 »

The exact same way. Its just a question of what you do with the resource string afterwards. in the mediator you'd make the call and set the result on a public property of the view component.

Its best not to have the mediator set somedeeply nested implementation specific property like "myComp.mainPanel.tititle" but instead to expose a bindable public top level property in MyComp like instanceTitle and have the mediator set that property. Thin inside MyComp, have mainPanel's title property bind to instanceTitle. This encapsulates the component implementation specifics and exposes a clear API for its client (the mediator) to deliver the required resources.

Later, if the component is refactored to use some other implementation and mainPanel goes away, the mediator will not fail or have to be modified beyond changes you may make to the actual resource property names.

-=Cliff> 
Logged
akmansoor
Newbie
*
Posts: 9


View Profile Email
« Reply #2 on: November 11, 2008, 07:57:20 »

I am not able to use resourceManager in mediators, it is giving compilation error undefined property. In view I am able to use it.
Logged
akmansoor
Newbie
*
Posts: 9


View Profile Email
« Reply #3 on: November 11, 2008, 09:02:52 »

I understood that resourceManager is part of UIcomponent. This is why i am not able to access it in my mediator.
It works when I try
ResourceManager.getInstance().getString("resources", "myKey");

Thanks,
Mansoor Achire
Logged
Pages: [1]
Print