Created
March 19, 2010 16:31
-
-
Save destroytoday/337787 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package | |
{ | |
public class BaseMediator extends Mediator | |
{ | |
[Inject] | |
public var signalBus:ApplicationSignalBus; | |
[Inject] | |
public var styleController:StyleController; | |
protected var _view:BaseView; | |
public function BaseMediator() | |
{ | |
} | |
override public function onRegister():void | |
{ | |
signalBus.stylesheetChanged.add(stylesheetChangedHandler); | |
} | |
protected function stylesheetChangedHandler(stylesheet:IStyleSheet):void | |
{ | |
styleController.applyStyle(_view, stylesheet.getStyle('.ExtendingView')); | |
} | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package | |
{ | |
public class ExtendingMediator extends BaseMediator | |
{ | |
public function ExtendingMediator() | |
{ | |
} | |
public function get view():ExtendingView | |
{ | |
return _view as ExtendingView; | |
} | |
[Inject] | |
public function set view(value:ExtendingView):void // <-- Classy! | |
{ | |
_view = value; | |
} | |
override public function onRegister():void | |
{ | |
super.onRegister(); | |
} | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package | |
{ | |
public class BaseMediator extends Mediator | |
{ | |
[Inject] | |
public var signalBus:ApplicationSignalBus; | |
[Inject] | |
public var styleController:StyleController; | |
public function BaseMediator() | |
{ | |
} | |
override public function onRegister():void | |
{ | |
signalBus.stylesheetChanged.add(stylesheetChangedHandler); | |
} | |
protected function stylesheetChangedHandler(stylesheet:IStyleSheet):void | |
{ | |
var view:ExtendingView = this['view'] as ExtendingView; // <-- Ghetto! | |
styleController.applyStyle(view, stylesheet.getStyle('.ExtendingView')); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment