Ext.define("Portfolio.designer.ui.domainModelBaseDataTypeComboBox", {
	extend: "Ext.form.ComboBox",
	alias: ["widget.ip2DomainModelBaseDataTypeComboBox"],
	displayField: "key",
	valueField: "key",
	emptyText: "",
	matchFieldWidth: false,
	listConfig: {
		getInnerTpl: function() {
			return "{key} - {value}";
		},
		width: 400
	},
	config: {
		types: null,
		designer: null
	},
	initComponent: function() {

		var me = this;

		var i_designer = me.getDesigner();
		var o_types = i_designer.normal.types || {};
		var a_data = [];

		me.store = Ext.create("Ext.data.Store", {
			fields: ["key", "value"],
			renderer: function(s_key) {
				var i_record = this.store.findRecord("key", s_key);
				return (i_record ? i_record.get("value") : s_key);
			}
		});

		me.callParent();

		me.renderer = this.store.renderer;

		Ext.Object.each(o_types, function(s_key, o_value) {
			a_data.push({
				key: s_key,
				value: ip2.i18n(o_value.title || "")
			});
		});

		me.store.loadData(a_data);
	}
});
