SourceTimeSelection.js 1022 Bytes
Ext.define('treps.controller.Times.SourceTimeSelection', {
	extend: 'treps.controller.Times.BaseTimeSelection',

	views: [
		'Steps.TransformationDefinition.TransformationDefinitionPanel'
	],

	containerSelector : 'dataselect_container > container',

	onBeforeSetTime : function(enabled)
	{
		var gridController   = treps.app.getController('Data.Grid.SourceDataGrid');
		var vecDefController = treps.app.getController('Vectors.VecDefGrid');

		var val = enabled;
		if (val)
		{
			var dataGrid = gridController.getSourceGrid();
			var firstColumn = gridController.getFirstColumnDataIndex(dataGrid);
			val = !vecDefController.componentInUse(firstColumn);
			if (!val)
			{
				treps.Messages.showError("First column already in use to define a vector component. Cannot use it for time definition.");
				return false;
			}
		}

                return val;
	},

	onAfterSetTime : function(enabled)
	{
		var gridController   = treps.app.getController('Data.Grid.SourceDataGrid');
		gridController.selectTime(enabled);
	}
});