author suo
  class UIControlCenter { protected _ui : BaseUIManager = null ; protected _dataCenter : UIDataCenter = null ; protected _viewCenter : UIViewCenter = null ; protected _controls : Map = new Map ( ) ; constructor ( ui , dataCenter , viewCenter ) { this . _ui = ui ; this . _dataCenter = dataCenter ; this . _viewCenter = viewCenter ; } public dispose ( ) { if ( this . _controls != null ) { for ( var i = 0 ; i < this . _controls . length ; ++ i ) { var control = this . _controls . getValueByIndex ( i ) ; if ( control != null ) { control . dispose ( ) ; control = null ; } } this . _controls . clear ( ) ; this . _controls = null ; } this . _viewCenter = null ; this . _dataCenter = null ; this . _ui = null ; } public onInit ( ) { var control = null ; var i = 0 ; for ( i = 0 ; i < this . _controls . length ; ++ i ) { var controlClass = this . _controls . getKey ( i ) ; control = new controlClass ( ) ; control . init ( this . _dataCenter , this . _viewCenter ) ; this . _controls . addValue ( controlClass , control ) ; } for ( i = 0 ; i < this . _controls . length ; ++ i ) { control = this . _controls . getValueByIndex ( i ) ; if ( control != null ) { control . onInit ( ) ; } } } public onShow ( ) { for ( var i = 0 ; i < this . _controls . length ; ++ i ) { var control = this . _controls . getValueByIndex ( i ) ; if ( control != null ) { control . onShow ( ) ; } } } public onOpenAgain ( ) { for ( var i = 0 ; i < this . _controls . length ; ++ i ) { var control = this . _controls . getValueByIndex ( i ) ; if ( control != null ) { control . onOpenAgain ( ) ; } } } public onHide ( ) { for ( var i = 0 ; i < this . _controls . length ; ++ i ) { var control = this . _controls . getValueByIndex ( i ) ; if ( control != null ) { control . onHide ( ) ; control . dispose ( ) ; this . _controls . addValue ( this . _controls . getKey ( i ) , null ) ; } } } public addControl ( className ) { if ( null == className ) { return ; } this . _controls . addValue ( className , null ) ; } public getControl ( className ) { if ( null == this . _controls ) { return null ; } return this . _controls . getValueByKey ( className ) ; } public isExist ( className ) { if ( null == this . _controls ) { return false ; } return this . _controls . isExist ( className ) ; } }