Ext.define("Portfolio.designer.ui.domainModelBaseDatatypeManager", {
	extend: "Ext.panel.Panel",
	alias: ["widget.ip2DomainModelBaseDatatypeManager"],
	layout: {
		type: "hbox",
		align: "stretch"
	},
	requires: [
		"Portfolio.designer.ui.domainModelBaseDatatypeGrid",
		"Portfolio.designer.ui.domainModelColumnTypeComboBox"
	],
	config: {
		commonProperties: null,
		baseGrid: null,
		designer: null,
		entityManager: null
	},
	initComponent: function() {

		var i_self = this;
		var i_designer = i_self.getDesigner();
		var i_entityManager = i_self.getEntityManager();

		var i_commonProperties = Ext.create("Portfolio.designer.ui.domainModelEntityColumnCommonProperties", {
			designer: i_designer,
			entityManager: i_entityManager,
			flex: 1,
			split: true
		});

		var i_baseGrid = Ext.widget("ip2DomainModelBaseDatatypeGrid", {
			designer: i_designer,
			itemId: "grid",
			border: false,
			split: true,
			flex: 2,
			listeners: {
				select: {
					fn: function(i_view, i_record) {

						var i_commonProperties = i_self.getCommonProperties();
						if (i_commonProperties) {
							i_commonProperties.setRecord(i_record);
							i_commonProperties.updateValues(i_record);
						}
					}
				}
			}
		});

		i_self.callParent();

		i_self.add([
			i_baseGrid,
			i_commonProperties
		]);

		i_self.setCommonProperties(i_commonProperties);
		i_self.setBaseGrid(i_baseGrid);
	}
});
