| Package | mx.core |
| Class | public class ComponentDescriptor |
| Inheritance | ComponentDescriptor Object |
| Subclasses | UIComponentDescriptor |
MXML 파일내의 대부분의 태그는, UIComponent object의 트리를 설명하는 것입니다. 예를 들어,<mx:Application> 태그는 UIComponent object를 나타내, 그 child containers와 컨트롤도 모두 UIComponent object입니다.
MXML 컴파일러는, 각각의 MXML 태그를 UIComponentDescriptor 인스턴스에 컴파일 합니다. 엄밀하게는, MXML 컴파일러는 ActionScript 데이터 구조를 자동 생성합니다. 이것은, UIComponentDescriptor object의 트리가 됩니다.
실행시에, Container 클래스의 createComponentsFromDescriptors() Methods는, 컨테이너의 childDescriptors 배열의 UIComponentDescriptor object내의 정보를 사용해, 컨테이너의 아이인 실제의 UIComponent object, 및 한층 더 깊은 자손을 작성합니다. 컨테이너의 property creationPolicy 의 값에 따라서는, 어플리케이션의 기동시에 컴퍼넌트의 일부가 표시될 때, 또는 어플리케이션의 개발자가 수동으로 createComponentsFromDescriptors() Methods를 호출했을 때에, 자손이 작성되는 일이 있습니다.
통상, ComponentDescriptor 또는 UIComponentDescriptor 인스턴스를 스스로 작성할 것은 없습니다. Container 클래스의 childDescriptors 배열을 경유해, MXML 컴파일러가 자동 생성한 인스턴스에 액세스 할 수 있습니다.
See also
| property | 정의 | ||
|---|---|---|---|
![]() | constructor : Object
특정의 object 인스턴스의 클래스 object 또는 constructor 함수에의 참조입니다.
| Object | |
| document : Object
컴퍼넌트가 작성되는 문서 object에의 참조입니다.
| ComponentDescriptor | ||
| events : Object
MXML 로 지정된, 컴퍼넌트의 event 핸들러의 이름과 값의 페어를 포함한 object입니다.
| ComponentDescriptor | ||
| id : String
MXML 로 지정된 컴퍼넌트의 식별자입니다.
| ComponentDescriptor | ||
| properties : Object
[read-only]
MXML 로 지정된, 컴퍼넌트의 property의 이름과 값의 페어를 포함한 object입니다.
| ComponentDescriptor | ||
| propertiesFactory : Function
MXML 로 지정된, 컴퍼넌트의 property의 이름과 값의 페어를 포함한 object를 돌려주는 함수입니다.
| ComponentDescriptor | ||
![]() | prototype : Object
[static]
클래스 또는 함수 object의 prototype object에의 참조입니다.
| Object | |
| type : Class
MXML 로 지정된 컴퍼넌트의 클래스입니다.
| ComponentDescriptor | ||
| Methods | 정의 | ||
|---|---|---|---|
| ComponentDescriptor (descriptorProperties:Object )
constructor 입니다.
| ComponentDescriptor | ||
![]() | hasOwnProperty (name:String ):Boolean
object로 지정된 property가 정의되고 있는지 어떤지를 나타냅니다.
| Object | |
| invalidateProperties ():void
캐쉬된
properties property를 무효화합니다. | ComponentDescriptor | ||
![]() | isPrototypeOf (theClass:Object ):Boolean
Object 클래스의 인스턴스가, Parameters로서 지정된 object의 prototype 체인내에 있을지 어떨지를 나타냅니다.
| Object | |
![]() | propertyIsEnumerable (name:String ):Boolean
지정된 property가 존재해, 열거 가능한가 어떤가를 나타냅니다.
| Object | |
![]() | setPropertyIsEnumerable (name:String , isEnum:Boolean = true):void
루프 처리에 대한 다이나믹 property의 가용성을 설정합니다.
| Object | |
| toString ():String
"ComponentDescriptor_" 및
id property의 값을 포함한 string를 돌려줍니다. | ComponentDescriptor | ||
![]() | valueOf ():Object
지정된 object의 원시적치를 돌려줍니다.
| Object | |
| document | property |
| events | property |
public var events:Object MXML 로 지정된, 컴퍼넌트의 event 핸들러의 이름과 값의 페어를 포함한 object입니다.
예를 들어, 다음과 같은 코드를 작성한다고 합니다.
<mx:DataGrid id="dg" initialize="fetchData(); initDataGrid();" change="changeHandler(event);"/>
기술자의 events property는 이 object입니다.
{ initialize:"__dg_initialize", change:"__dg_change" }
컴퍼넌트에 MXML event 핸들러가 지정되어 있지 않은 경우,event property는 null 가 됩니다.
string "__dg_initialize" 및 "__dg_change" 는, MXML 컴파일러가 자동 생성하는 event 핸들러 Methods의 이름입니다. 이러한 Methods의 본체에는, event 속성의 값으로 해서 지정된 ActionScript 명령문(statement)가 들어갑니다. 예를 들어, 자동 생성된 initialize 핸들러는 다음과 같이 됩니다.
public function __dg_initialize(event:mx.events.FlexEvent) :void
{
fetchData();
initDataGrid();
}
자동 생성된 event 핸들러가 항상 이름으로 지정되면 상정하지 말아 주세요. 이것은, Flex 의 장래의 버젼으로 변경될 가능성이 있습니다.
Container Methods createComponentsFromDescriptors() 는 이 property를 사용해, 자동 생성된 event 핸들러를 addEventListener() 를 사용해 등록합니다.
| id | property |
public var id:String MXML 로 지정된 컴퍼넌트의 식별자입니다.
예를 들어, 다음과 같은 코드를 작성한다고 합니다.
<mx:TextInput id="firstName" text="Enter your first name here"/>
기술자의 id property는 string "firstName" 입니다.
컴퍼넌트에 MXML ID 가 지정되어 있지 않은 경우,id property는 null 가 됩니다.
id property의 값은, MXML 컴파일러에 의해 자동 생성된 MXML 문서 object의 Public 변수의 이름이 됩니다. 이 변수의 값은, 이 기술자로부터 작성된 UIComponent object에의 참조입니다. 이것에 의해, 예를 들어 TextInput 컨트롤의 text property를, 이 TextInput 인스턴스를 포함한 문서내의 임의의 장소로부터 firstName.text 로서 참조할 수 있습니다.
id 가 지정되고 있는 경우, 그것은 empty의 string는 아니게 되어, DisplayObject object의 name 가 됩니다. id 가 지정되어 있지 않은가 empty의 경우, DisplayObject object의 name 는,NameUtil.createUniqueName() Methods로부터 돌려주어진,"Button3" 와 같은 자동 생성된 string인 채입니다. 이 name 는,toString() Methods로부터 돌려주어지는 string의 생성에 사용됩니다. 이것을 사용해,getChildByName() 를 호출해 부모로부터 컴퍼넌트를 찾아낼 수도 있습니다.
See also
| properties | property |
properties:Object [read-only]MXML 로 지정된, 컴퍼넌트의 property의 이름과 값의 페어를 포함한 object입니다.
예를 들어, 다음과 같은 코드를 작성한다고 합니다.
<mx:TextInput width="150" text="Hello"/>
기술자의 properties property는 이 object입니다.
{ width:150, text:"Hello" }
컴퍼넌트에 MXML property가 지정되어 있지 않은 경우,properties property는 null 가 됩니다. 이 경우, 컴퍼넌트는 디폴트의 property치를 사용합니다.
이 object는,propertiesFactory property로 지정된 함수를 호출하는 것에 의해 작성된 이후의 액세스를 위해서(때문에) 캐쉬됩니다. 다만, Repeater 가 같은 기술자로부터 복수의 컴퍼넌트 인스턴스를 작성할 때는, 컴퍼넌트 인스턴스 마다 properties object의 최신 복사를 작성해, 컴퍼넌트 인스턴스가 배열 또는 object 참조의 property치를 공유하지 않게 할 필요가 있습니다. Repeater 는, 기술자에 대해서 invalidateProperties() Methods를 호출하는 것에 의해 이것을 실현합니다.
public function get properties():Object
See also
| propertiesFactory | property |
public var propertiesFactory:Function MXML 로 지정된, 컴퍼넌트의 property의 이름과 값의 페어를 포함한 object를 돌려주는 함수입니다.
예를 들어, 다음과 같은 코드를 작성한다고 합니다.
<mx:TextInput width="150" text="Hello">
기술자의 propertiesFactory property는 이 함수입니다.
function() :Object { return { width:150, text:"Hello" }; }
컴퍼넌트에 MXML property가 지정되어 있지 않은 경우,propertiesFactory property는 null 가 됩니다. 이 경우, 컴퍼넌트는 디폴트의 property치를 사용합니다.
propertyFactory 가 실제의 object는 아니고, object를 돌려주는 함수인 것은, ComponentDescriptor object의 트리를 단계적으로 「deploy」할 수 있도록(듯이) 하기 (위해)때문에입니다. 문서의 기술자 트리의 모든 기술자가 기동시에 작성되면, 기동 시간이 길어집니다.
properties property는, 이 팩토리 함수에 의해 작성된, 캐쉬된 object를 돌려줍니다.
메모:click="doSomething();" 등의 event 핸들러는,properties object는 아니고,events object에 포함할 수 있습니다.
See also
| type | property |
public var type:Class MXML 로 지정된 컴퍼넌트의 클래스입니다.
예를 들어, 다음과 같은 코드를 작성한다고 합니다.
<mx:TextInput/>
기술자의 type property는 클래스 mx.controls.TextInput 입니다.
MXML 컴파일러에 의해 작성된 ComponentDescriptor object의 경우, 모든 MXML 태그가 mx:TextInput 와 같은 태그명을 가지기 (위해)때문에, property는 null 가 되지 않습니다.
MXML 태그와 그 대응 클래스의 매핑은, XML namespace과 그 namespace에 관련지을 수 있었던 "manifest" 파일 (존재하는 경우)에 의해 정해집니다. 예를 들어, mx:prefix 에 의해 나타내지는 표준 Flex namespace http://www.adobe.com/2006/mxml는, (flex-config.xml 파일로) 마니페스트 파일 mxml-manifest.xml 에 관련지을 수 있고 있어 이 파일은 다음의 태그를 가집니다.
<component id="TextInput" class="mx.controls.TextInput"/>
이것은, 태그명 mx:TextInput 를 클래스 mx.controls.TextInput 에 MAP 합니다. 마니페스트 파일을 사용하는 것으로써, 단일의 XML namespace의 컴퍼넌트를 복수의 ActionScript 패키지의 클래스에 MAP 할 수 있습니다.
| ComponentDescriptor | () | constructor |
public 함수 ComponentDescriptor(descriptorProperties:Object )constructor 입니다.
ParametersdescriptorProperties:Object — ComponentDescriptor object의 property, 예를 들어 type,id,propertiesFactory,events 등의 이름과 값의 페어를 포함한 object입니다.
|
| invalidateProperties | () | Methods |
public function invalidateProperties():void
캐쉬된 properties property를 무효화합니다. 다음에 properties property를 읽어들일 때,propertiesFactory property의 값으로 지정된 함수로부터 property가 재생성됩니다.
| toString | () | Methods |
public function toString():String
"ComponentDescriptor_" 및 id property의 값을 포함한 string를 돌려줍니다.
String —
"ComponentDescriptor_" 및 id property의 값을 포함한 string입니다.
|
코멘트가 추가되었을 경우, 메일로 받기. | 코멘트 리포트
현재의 페이지: http://flexdocs.kr/docs/flex2/langref/mx/core/ComponentDescriptor.html