<commit_before><?xml version="1.0" encoding="utf-8"?>
<!--
/*
 * Copyright 2008-2009 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
 -->
<mx:Canvas
	xmlns:mx="http://www.adobe.com/2006/mxml">
	<mx:Script>
		<![CDATA[
			import mx.events.ListEvent;
			import org.broadleafcommerce.admin.catalog.vo.sku.Sku;
			import org.broadleafcommerce.admin.catalog.control.events.sku.EditSkuEvent;
			
			private function handleSkuDataGridItemClick(event:ListEvent):void{
				if(DataGrid(event.currentTarget).selectedItem != null){
					var selectedSku:Sku = Sku(DataGrid(event.currentTarget).selectedItem);
					var ese:EditSkuEvent = new EditSkuEvent(selectedSku, false);
					ese.dispatch();
				}
			}
		]]>
	</mx:Script>
	<mx:DataGrid
		id="skuDataGrid"
		width="100%" 
		height="100%"
		itemClick="handleSkuDataGridItemClick(event)">
		<mx:columns>
			<mx:DataGridColumn
				dataField="id"
				headerText="Id" 
				width="50"/>
			<mx:DataGridColumn
				dataField="name"
				headerText="Name"
				width="160"/>
		</mx:columns>
	</mx:DataGrid>
	
</mx:Canvas><commit_msg>sku list order management complete.<commit_after><?xml version="1.0" encoding="utf-8"?>
<!--
/*
 * Copyright 2008-2009 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
 -->
<mx:Canvas
	xmlns:mx="http://www.adobe.com/2006/mxml">
	<mx:Script>
		<![CDATA[
			import mx.effects.effectClasses.HideShowEffectTargetFilter;
			import mx.core.DragSource;
			import org.broadleafcommerce.admin.catalog.control.events.product.SaveProductEvent;
			import mx.managers.DragManager;
			import org.broadleafcommerce.admin.catalog.model.CatalogModelLocator;
			import org.broadleafcommerce.admin.catalog.model.ProductModel;
			import mx.controls.Alert;
			import mx.events.DragEvent;
			import mx.events.ListEvent;
			import org.broadleafcommerce.admin.catalog.vo.sku.Sku;
			import org.broadleafcommerce.admin.catalog.control.events.sku.EditSkuEvent;
			
			private var productModel:ProductModel = CatalogModelLocator.getInstance().productModel;
			
			private function handleSkuDataGridItemClick(event:ListEvent):void{
				if(DataGrid(event.currentTarget).selectedItem != null){
					var selectedSku:Sku = Sku(DataGrid(event.currentTarget).selectedItem);
					var ese:EditSkuEvent = new EditSkuEvent(selectedSku, false);
					ese.dispatch();
				}
			}
			
			private function handleDragDrop(event:DragEvent):void{
				var dropIndex:int = skuDataGrid.calculateDropIndex(event);
				var selectedIndex:int = DataGrid(event.currentTarget).selectedIndex;
				//if the sku is not dropped to a new position, do not save the product, as nothing has changed
				if(dropIndex != selectedIndex && (dropIndex != (selectedIndex + 1))){
					new SaveProductEvent(productModel.currentProduct).dispatch();
				}
			}
			
 			private function handleDragOver(event:DragEvent):void{
 				var dropIndex:int = skuDataGrid.calculateDropIndex(event);
				var selectedIndex:int = DataGrid(event.currentTarget).selectedIndex;
				//if the sku is not being dragged to a new position, hide the black line
				if(dropIndex == selectedIndex || dropIndex == (selectedIndex + 1)){
					skuDataGrid.hideDropFeedback(event);
					event.preventDefault();
				}
			} 
		]]>
	</mx:Script>
	<mx:DataGrid
		id="skuDataGrid"
		width="100%" 
		height="100%"
		itemClick="handleSkuDataGridItemClick(event)"
		dragDrop="handleDragDrop(event)"
		dragOver="handleDragOver(event)"
		dragEnabled="true"
		dragMoveEnabled="true"
		dropEnabled="true">
		<mx:columns>
			<mx:DataGridColumn
				dataField="id"
				headerText="Id" 
				width="50"/>
			<mx:DataGridColumn
				dataField="name"
				headerText="Name"
				width="160"/>
		</mx:columns>
	</mx:DataGrid>
</mx:Canvas>
{'fraction_non_alphanumeric': 0.11810362911684498, 'fraction_numerical': 0.013006083490664988, 'mean_word_length': 4.176981541802388, 'pattern_counts': {'":': 0, '<': 29, '<?xml version=': 2, '>': 29, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, 'xml': 6}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4561449', 'n_tokens_mistral': 1691, 'n_tokens_neox': 1442, 'n_words': 354}