Created
July 2, 2013 19:54
-
-
Save k0t0vich/5912552 to your computer and use it in GitHub Desktop.
This file contains 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 some.gui.display.component { | |
import some.core.controllers.IBaseController; | |
import some.core.display.DisplayObjectContainerProxy; | |
import some.core.managers.process.IProgressProcessable; | |
import some.core.utils.ClassUtils; | |
import some.core.utils.UID; | |
import some.gui.controller.ComponentController; | |
import flash.errors.IllegalOperationError; | |
import flash.events.Event; | |
import flash.events.EventDispatcher; | |
[Event( name="componentConstruct", type="some.gui.events.ComponentEvent" )] | |
[Event( name="componentDestruct", type="some.gui.events.ComponentEvent" )] | |
[Event( name="componentError", type="some.gui.events.ComponentErrorEvent" )] | |
/** | |
* @author some | |
*/ | |
public final class ComponentInfo extends EventDispatcher { | |
use namespace $internal; | |
$internal static var internalCall:Boolean = false; | |
public function ComponentInfo() { | |
if ( !internalCall ) { | |
Error.throwError( IllegalOperationError, 2012, ClassUtils.getClassName( this ) ); | |
} | |
super(); | |
internalCall = false; | |
} | |
public const id:String = UID.generate(); | |
private var _name:String; | |
public function get name():String { | |
return this._name; | |
} | |
private var _component:Component; | |
public function get component():Component { | |
return this._component; | |
} | |
private var _proxy:DisplayObjectContainerProxy; | |
public function get proxy():DisplayObjectContainerProxy { | |
if ( !this._proxy && this._component ) this._proxy = this._component.proxy; | |
return this._proxy; | |
} | |
private var _controller:ComponentController; | |
public function get controller():ComponentController { | |
return this._controller; | |
} | |
private var _properties:ComponentProperties; | |
public function get properties():ComponentProperties { | |
return this._properties; | |
} | |
private const _parameters:Object = new Object(); | |
public function get parameters():Object { | |
var result:Object = new Object(); | |
for ( var i:String in this._parameters ) { | |
result[ i ] = this._parameters[ i ]; | |
} | |
return result; | |
} | |
private var _loader:$LoaderListener; | |
public function get loader():IProgressProcessable { | |
if ( !this._loader ) this._loader = new $LoaderListener(); | |
return this._loader; | |
} | |
public override function dispatchEvent(event:Event):Boolean { | |
throw new IllegalOperationError(); | |
} | |
public override function toString():String { | |
return '[' + ClassUtils.getClassName( this ) + ' name="' + this._name + '"]'; | |
} | |
$internal function $initP(parameters:Object):void { | |
for ( var i:String in parameters ) { | |
this._parameters[ i ] = parameters[ i ]; | |
} | |
} | |
$internal function $init(name:String, component:Component, controller:ComponentController, properties:ComponentProperties, baseController:IBaseController):void { | |
this._name = name; | |
this._component = component; | |
this._controller = controller; | |
this._properties = properties || ComponentProperties.DEFAULT; | |
if ( !this._loader ) this._loader = new $LoaderListener(); | |
this._loader.set$target( this._component ); | |
component.$init( this, this._properties.singleton ? name : name + '-' + this.id ); | |
if ( controller ) { | |
controller.$init( this, baseController ); | |
} | |
} | |
$internal function $clear():void { | |
if ( this._loader ) { | |
this._loader.set$target( null ); | |
} | |
if ( this._controller ) { | |
this._controller.$clear(); | |
} | |
if ( this._component ) { | |
this._component.$clear(); | |
} | |
this._properties = null; | |
this._controller = null; | |
this._component = null; | |
this._name = null; | |
this._proxy = null; | |
} | |
$internal function $dispatchEvent(event:Event):Boolean { | |
return super.dispatchEvent( event ); | |
} | |
private function handler_componentConstruct():void { | |
} | |
private function handler_componentDestruct():void { | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment