Ext.define('Ext.ux.folderorganizer.TreeSelModel', {
	extend: 'Ext.selection.TreeModel',
	onKeyPress: function(e, t) {
		var key = e.getKey(),
		selected, 
		checked;
        
		if (key === e.SPACE) {
			e.stopEvent();
			selected = this.getLastSelected();
			if (selected) {
				this.view.onCheckChange(selected);
			}
		}
		else if (key === e.ENTER) {
			e.stopEvent();
			selected = this.getLastSelected();
			if (selected) {
				if (!selected.isExpanded()) {
					selected.expand();
				}
			}
		}
		else {
			this.callParent(arguments);
		}
	}
});
