Ext.define('Ext.ux.folderorganizer.DmdEditor', {

	extend: 'Ext.window.Window',
	height: 400,
	width: 600,
	autoScroll: true,
	closable: false,
	collapsible: true,
	layout: {
		type: 'fit'
	},
	initComponent: function() {

		var me = this;

		var model = me.store.model;

		var editor = Ext.create('Ext.ux.entity.Form', {
			model: me.store.model,
			action: me.action,
			keys: ip2.extractKeys(me.store.model, me.record),
			dataParent: me.wrapper,
			preventHeader: true,
			listeners: {
				'storewrite': {
					fn: function(self, operation, record) {
						me.fireEvent('datachanges', operation.action, record);
					}
				},
				'removed': function(win) {
					me.close();
				},
				'recordloaded': function(form, record) {
					if (me.action != 'new') {
						me.setTitle(form.getFormTitles());
					}
				}
			}
		});

		me.items = editor;

		me.callParent();
	}
});
