author suo
  class UIDataCenter { protected _datas : Map = new Map ( ) ; private _isLoading : boolean = false ; private _isLoaded : boolean = false ; private _isOpened : boolean = false ; private _openParam : any = null ; constructor ( ) { } public set openParam ( param ) { this . _openParam = param ; } public get openParam ( ) : any { return this . _openParam ; } public dispose ( ) { if ( this . _datas != null ) { for ( var i = 0 ; i < this . _datas . length ; i ++ ) { var data = this . _datas . getValueByIndex ( i ) ; if ( data != null ) { data . dispose ( ) ; data = null ; } } this . _datas . dispose ( ) ; this . _datas = null ; } this . _openParam = null ; } public onInit ( ) { for ( var i = 0 ; i < this . _datas . length ; i ++ ) { var dataClass = this . _datas . getKey ( i ) ; this . _datas . addValue ( dataClass , new dataClass ( ) ) ; } } public onShow ( ) { } public onHide ( ) { if ( this . _datas != null ) { for ( var i = 0 ; i < this . _datas . length ; i ++ ) { var data = this . _datas . getValueByIndex ( i ) ; if ( data != null ) { data . dispose ( ) ; data = null ; this . _datas . addValue ( this . _datas . getKey ( i ) , null ) ; } } } } public addData ( className ) { if ( className == null ) { return ; } this . _datas . addValue ( className , null ) ; } public getData ( className ) { if ( this . _datas == null ) { return null ; } return this . _datas . getValueByKey ( className ) ; } public isExist ( className ) { if ( this . _datas == null ) { return false ; } return this . _datas . isExist ( className ) ; } public get isLoading ( ) : boolean { return this . _isLoading ; } public set isLoading ( value ) { this . _isLoading = value ; } public get isLoaded ( ) : boolean { return this . _isLoaded ; } public set isLoaded ( value ) { this . _isLoaded = value ; } public set isOpened ( value ) { this . _isOpened = value ; } public get isOpened ( ) : boolean { return this . _isOpened ; } }