package <%= base_package %>.views.<%= class_name.pluralize.dcfirst %> { import flash.events.Event; import flash.events.MouseEvent; import mx.events.FlexEvent; import mx.events.ListEvent; import mx.core.Application; import org.restfulx.Rx; import org.restfulx.utils.RxUtils; import extras.framework.Presenter; import com.fourD.core.FourDComponent; import com.fourD.animators.FourDTweenCollection; import <%= base_package %>.models.constant.URL; import <%= base_package %>.models.presentation.<%= class_name.pluralize %>Model; import <%= base_package %>.views.<%= class_name.pluralize.dcfirst %>.<%= class_name.pluralize %>View; public class <%= class_name.pluralize %>Presenter extends Presenter { // all the tweens you could ever desire :) public var t:FourDTweenCollection; public function get <%= class_name.pluralize.dcfirst %>View():<%= class_name.pluralize %>View { return this.view as <%= class_name.pluralize %>View; } /** * Presenter Constructor. * Creates the <%= class_name.pluralize %>class_name from the RxEvent data. * This allows common RESTful functions (show, create, update, delete) * to be reused by multiple views, thereby following the DRY principle. */ public function <%= class_name.pluralize %>Presenter() { } /** * Handle view creation complete initialization * * @param event creation complete event * */ override protected function onCreationComplete(event:FlexEvent):void { // This should ideally be done through some sort of event map // but that's too complicated for me to think about right now... /* components = [view.<%= class_name.dcfirst %>IndexView, // view.<%= class_name.dcfirst %>ShowView, view.<%= class_name.dcfirst %>EditIndexView, view.<%= class_name.dcfirst %>EditShowView] visibleComponents = [view.<%= class_name.dcfirst %>EditIndexView]; */ } /** * This is where you define what can be found in that params object * p Object looks like this: [{tween:myTween, view:myView, dispatchLocal:ACTION, dispatchGlobal:GLOBAL_URL, when:onComplete}] */ override protected function executeTweenParams(p:Object=null):void { var childView:*; if (p.view) { childView = p.view; } if (p.dispatchLocal) { } if (p.dispatchGlobal) { globalDispatcher } } //-State changing (i.e. Navigation) methods for <%= class_name %> public function goto<%= class_name %>Show(action:String="show", resource:Object=null, result:String=null):void { } public function goto<%= class_name %>Index(action:String="show", resource:Object=null, result:String=null):void { } public function goto<%= class_name %>EditShow(action:String="show", resource:Object=null, result:String=null):void { } public function goto<%= class_name %>EditIndex(action:String="show", resource:Object=null, result:String=null):void { } //-Listener methods... /* private function onNewClick(event:MouseEvent):void { model.newResource(); } private function onSaveClick(event:MouseEvent):void { model.save(); } private function onDestroyClick(event:MouseEvent):void { model.destroy(); } private function onResourceSelectorChange(event:ListEvent):void { openResource(<%= class_name.pluralize %>(resourcesSelector.selectedItem)); } */ } }