참고 자료
void ![](http://demo.qooxdoo.org/2.0.1/apiviewer/resource/apiviewer/image/open.gif)
_disposeArray(String field
)
Disposes all members of the given array and deletes the field which refers to the array afterwards.
void ![](http://demo.qooxdoo.org/2.0.1/apiviewer/resource/apiviewer/image/open.gif)
_disposeMap(String field
)
Disposes all members of the given map and deletes the field which refers to the map afterwards.
void ![](http://demo.qooxdoo.org/2.0.1/apiviewer/resource/apiviewer/image/open.gif)
_disposeObjects(arguments varargs
)
Disconnects and disposes given objects from instance.
void ![](http://demo.qooxdoo.org/2.0.1/apiviewer/resource/apiviewer/image/open.gif)
_disposeSingletonObjects(arguments varargs
)
Disconnects and disposes given singleton objects from instance.
/*
* class
*/
qx.Class.define("mc.testClass",
{
extend:qx.ui.core.Widget,
/*
*****************************************************************************
CONSTRUCTOR
*****************************************************************************
*/
construct:function (eventContext) {
this.base(arguments);
/*destruct에 추가 될부분*/
this.__array = qx.data.Array();
this.__map = [];
this.__map['testKey'] = new qx.ui.form.Button("MyObject");
this.__myObject = new qx.ui.form.Button("MyObject");
this.__layout = new qx.ui.layout.Canvas();
/*------------------------*/
this._setLayout(this.__layout);
// 이벤트를 호출할 객체.
if (eventContext) {
this.setEventTarget(eventContext);
}
this._createChildControl("layout_main"); // getChildControl 대신 _CreateChildControl 사용
},
/*
*****************************************************************************
EVENTS
*****************************************************************************
*/
events:{
},
/*
*****************************************************************************
PROPERTY
*****************************************************************************
*/
properties:{
eventTarget:{
init:null,
nullable : true
},
preloader:{
init:mc.util.PreLoader.getInstance(),
nullable : true
}
},
/*
*****************************************************************************
STATICS
*****************************************************************************
*/
statics:{
},
/*
*****************************************************************************
MEMBERS
*****************************************************************************
*/
members:{
__array: null,
__map:null,
__myObject:null,
__layout:null,
//override
_createChildControlImpl 에서 생성된놈은 this가 해제시 자동 해제 됨
// new 될때마다 id가 생겨야됨.
_createChildControlImpl : function(id, hash)
{
var control,
preloader = mc.util.PreLoader.getInstance();
switch(id)
{
// 레이아웃 생성
case "layout_UserInfo":
var layout = new qx.ui.layout.VBox();
control = new qx.ui.container.Composite(layout);
control.add(this.getChildControl("control_UserInfoLabel")); // _createChildContrl; 대신 getControl 를 사용
// 아이템 여러개 생성시
for (var i = 0; i < 10; i++) {
control.add(this.getChildControl("control_test#"+i)); // i 대신 스트링이든 뭐든 가능
}
this._add(control, {left:0, top:0});
break;
// 콘트롤 생성
case "control_UserInfoLabel":
control = new qx.ui.form.Button(this.tr("my Button")); // 다국어 설정시 예제
break;
case "control_test":
control = new qx.ui.form.Button("SHOP");
break;
// 조사중 하면 될까?
case "myArray":
control = qx.data.Array();
break;
}
return control || this.base(arguments, id);
}
},
/*
*****************************************************************************
DESTRUCT
*****************************************************************************
*/
destruct:function () {
try {
this.setPreloader(null);
this.setEventTarget(null);
}
finally {
// 직접 생성한 객체 해제 _createChildControlImpl 에서 생성된놈은 this가 해제시 자동 해제 됨
this._disposeMap("__map");
this._disposeObjects("__myObject", "__layout");
this._disposeArray("__array");
// this._disposeSingletonObjects();
}
}
});