topleft topright

Welcome, Guest. Please login or register.
May 25, 2013, 11:12:33 AM
Home Help Search Login Register
News: ATTENTION: Spambots must die! Humans must visit http://contact.futurescale.com to request forum access.

Pages: [1]
Print
Author Topic: How to use resourceManager in Mediators  (Read 2758 times)
akmansoor
Newbie
*
Posts: 9


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

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: 2790



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

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 AM »

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 AM »

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
Jump to:  



Login with username, password and session length

Powered by SMF 1.1.11 | SMF © 2006-2007, Simple Machines LLC
Copyright © 2006-2008 Futurescale, Inc.