<commit_before><?xml version="1.0" encoding="utf-8"?>
<s:TitleWindow xmlns:fx="http://ns.adobe.com/mxml/2009" 
				  xmlns:s="library://ns.adobe.com/flex/spark" 
				  xmlns:mx="library://ns.adobe.com/flex/mx" 
				  xmlns:input="org.openforis.collect.ui.component.input.*"
				  xmlns:component="org.openforis.collect.ui.component.*"
				  >
	<fx:Script>
		<![CDATA[
			import mx.collections.ArrayCollection;
			import mx.collections.IList;
			
			import org.openforis.collect.event.UIEvent;
			import org.openforis.collect.i18n.Message;
			import org.openforis.collect.metamodel.proxy.CodeListItemProxy;
			import org.openforis.collect.util.CollectionUtil;
			
			public static const STATE_LOADING:String = "loading";
			public static const STATE_DEFAULT:String = "default";
			public static const STATE_VALUES_SORTING_ALLOWED:String = "valuesSortingAllowed";
			
			private var _multiple:Boolean = false;
			private var _editable:Boolean = true;
			private var _codeInputField:TextCodeInputField;
			private var _items:IList = null;
			private var _selectedItems:ArrayCollection = null;
			private var _notSelectedItems:ArrayCollection = null;

			public function selectionChangeHandler(event:UIEvent):void {
				var item:CodeListItemProxy = CodeListItemProxy(event.obj);
				if ( ! multiple ) {
					for each(var itm:Object in items) {
						if(itm != item) {
							//reset selection
							itm.selected = false;
							CollectionUtil.removeItem(_selectedItems, itm);
						}
					}
				}
				if ( item.selected ) {
					_selectedItems.addItem(item);
				} else {
					CollectionUtil.removeItem(_selectedItems, item);
				}
				dispatchEvent(new Event("selectionChange"));
			}
			
			protected function applyHandler(event:Event):void {
				dispatchEvent(new Event("apply")); 
			}
			
			[Bindable]
			public function get multiple():Boolean {
				return _multiple;
			}

			public function set multiple(value:Boolean):void {
				_multiple = value;
			}

			[Bindable]
			public function get codeInputField():TextCodeInputField {
				return _codeInputField;
			}
			
			public function set codeInputField(value:TextCodeInputField):void {
				_codeInputField = value;
			}

			[Bindable]
			public function get editable():Boolean {
				return _editable;
			}
			
			public function set editable(value:Boolean):void {
				_editable = value;
			}
			
			[Bindable]
			public function get items():IList {
				return _items;
			}
			
			public function set items(value:IList):void {
				_items = value;
			}

			[Bindable]
			public function get selectedItems():ArrayCollection {
				return _selectedItems;
			}
			
			public function set selectedItems(value:ArrayCollection):void {
				_selectedItems = value;
			}
			
			[Bindable]
			public function get notSelectedItems():ArrayCollection {
				return _notSelectedItems;
			}
			
			public function set notSelectedItems(value:ArrayCollection):void {
				_notSelectedItems = value;
			}
			
		]]>
	</fx:Script>
	
	<fx:Metadata>
		[Event(name="selectionChange", type="flash.events.Event")]
	</fx:Metadata>
	
	<s:states>
		<s:State name="loading" />
		<s:State name="default" />
		<s:State name="valuesSortingAllowed" />
	</s:states>
	
	<s:Group id="loadingContainer" 
			 includeIn="loading" 
			 itemCreationPolicy="immediate">
		<component:LoadingContent height="100" width="200" />
		<s:Button 
				id="cancelLoading" 
				bottom="0" 
				horizontalCenter="0" 
				useHandCursor="true" 
				buttonMode="true" 
				label="{Message.get('global.cancel')}" 
				/>
	</s:Group>
	
	<s:Scroller includeIn="default" 
				width="100%"
				maxHeight="400">
		<input:CodeListItemsDataGroup
			id="dataGroup" 
			dataProvider="{items}"
			editable="{editable}"
			sortable="false"
			selectionChange="selectionChangeHandler(event)"
			multipleSelection="{multiple}"
			apply="applyHandler(event)"
			currentState="vertical"
			width="100%" 
			/>
	</s:Scroller>
	
	<s:VGroup includeIn="valuesSortingAllowed" width="100%">
		
		<s:Label text="Select one or more values:&#13;(drag and drop selected items to reorder them)" />
		
		<s:Scroller width="100%"
					maxHeight="300"
					id="selectedItemsDataGroupScroller">
			<input:CodeListItemsDataGroup
				id="selectedItemsDataGroup" 
				dataProvider="{selectedItems}"
				editable="{editable}"
				sortable="true"
				selectionChange="selectionChangeHandler(event)"
				apply="applyHandler(event)"
				currentState="vertical"
				width="100%" 
				/>
		</s:Scroller>
		
		<s:Line width="100%">
			<s:stroke>
				<s:SolidColorStroke color="#000000" weight="1" caps="square"/>
			</s:stroke>
		</s:Line>
		
		<s:Scroller width="100%"
					minHeight="30"
					maxHeight="{400 - selectedItemsDataGroupScroller.height}">
			<input:CodeListItemsDataGroup
				id="notSelectedItemsDataGroup" 
				dataProvider="{notSelectedItems}"
				selectionChange="selectionChangeHandler(event)"
				apply="applyHandler(event)"
				editable="{editable}"
				sortable="false"
				currentState="vertical"
				width="100%" 
				/>
		</s:Scroller>
		
	</s:VGroup>
	
	
	<s:HGroup excludeFrom="loading" 
			  itemCreationPolicy="immediate" 
			  horizontalAlign="center" 
			  verticalAlign="middle"
			  width="100%" gap="30"
			  >
		<s:Button id="applyButton" 
				  label="{Message.get('global.apply')}" 
				  enabled="{editable}" 
				  click="applyHandler(event)" 
				  buttonMode="true"
				  useHandCursor="true"
				  />
	</s:HGroup>
	
	
</s:TitleWindow>
<commit_msg>Fixed bug opening code list editor<commit_after><?xml version="1.0" encoding="utf-8"?>
<s:TitleWindow xmlns:fx="http://ns.adobe.com/mxml/2009" 
				  xmlns:s="library://ns.adobe.com/flex/spark" 
				  xmlns:mx="library://ns.adobe.com/flex/mx" 
				  xmlns:input="org.openforis.collect.ui.component.input.*"
				  xmlns:component="org.openforis.collect.ui.component.*"
				  >
	<fx:Script>
		<![CDATA[
			import mx.collections.ArrayCollection;
			import mx.collections.IList;
			
			import org.openforis.collect.event.UIEvent;
			import org.openforis.collect.i18n.Message;
			import org.openforis.collect.metamodel.proxy.CodeListItemProxy;
			import org.openforis.collect.util.CollectionUtil;
			
			public static const STATE_LOADING:String = "loading";
			public static const STATE_DEFAULT:String = "default";
			public static const STATE_VALUES_SORTING_ALLOWED:String = "valuesSortingAllowed";
			
			private var _multiple:Boolean = false;
			private var _editable:Boolean = true;
			private var _codeInputField:TextCodeInputField;
			private var _items:IList = null;
			private var _selectedItems:ArrayCollection = null;
			private var _notSelectedItems:ArrayCollection = null;

			public function selectionChangeHandler(event:UIEvent):void {
				var item:CodeListItemProxy = CodeListItemProxy(event.obj);
				if ( ! multiple ) {
					for each(var itm:Object in items) {
						if(itm != item) {
							//reset selection
							itm.selected = false;
							CollectionUtil.removeItem(_selectedItems, itm);
						}
					}
				}
				if ( item.selected ) {
					_selectedItems.addItem(item);
				} else {
					CollectionUtil.removeItem(_selectedItems, item);
				}
				dispatchEvent(new Event("selectionChange"));
			}
			
			protected function applyHandler(event:Event):void {
				dispatchEvent(new Event("apply")); 
			}
			
			[Bindable]
			public function get multiple():Boolean {
				return _multiple;
			}

			public function set multiple(value:Boolean):void {
				_multiple = value;
			}

			[Bindable]
			public function get codeInputField():TextCodeInputField {
				return _codeInputField;
			}
			
			public function set codeInputField(value:TextCodeInputField):void {
				_codeInputField = value;
			}

			[Bindable]
			public function get editable():Boolean {
				return _editable;
			}
			
			public function set editable(value:Boolean):void {
				_editable = value;
			}
			
			[Bindable]
			public function get items():IList {
				return _items;
			}
			
			public function set items(value:IList):void {
				_items = value;
			}

			[Bindable]
			public function get selectedItems():ArrayCollection {
				return _selectedItems;
			}
			
			public function set selectedItems(value:ArrayCollection):void {
				_selectedItems = value;
			}
			
			[Bindable]
			public function get notSelectedItems():ArrayCollection {
				return _notSelectedItems;
			}
			
			public function set notSelectedItems(value:ArrayCollection):void {
				_notSelectedItems = value;
			}
			
		]]>
	</fx:Script>
	
	<fx:Metadata>
		[Event(name="selectionChange", type="flash.events.Event")]
	</fx:Metadata>
	
	<s:states>
		<s:State name="loading" />
		<s:State name="default" />
		<s:State name="valuesSortingAllowed" />
	</s:states>
	
	<s:Group id="loadingContainer" 
			 includeIn="loading" 
			 itemCreationPolicy="immediate">
		<component:LoadingContent height="100" width="200" />
		<s:Button 
				id="cancelLoading" 
				bottom="0" 
				horizontalCenter="0" 
				useHandCursor="true" 
				buttonMode="true" 
				label="{Message.get('global.cancel')}" 
				/>
	</s:Group>
	
	<s:Scroller includeIn="default" 
				width="100%"
				maxHeight="400">
		<input:CodeListItemsDataGroup
			id="dataGroup" 
			dataProvider="{items}"
			editable="{editable}"
			sortable="false"
			selectionChange="selectionChangeHandler(event)"
			multipleSelection="{multiple}"
			apply="applyHandler(event)"
			currentState="VERTICAL"
			width="100%" 
			/>
	</s:Scroller>
	
	<s:VGroup includeIn="valuesSortingAllowed" width="100%">
		
		<s:Label text="Select one or more values:&#13;(drag and drop selected items to reorder them)" />
		
		<s:Scroller width="100%"
					maxHeight="300"
					id="selectedItemsDataGroupScroller">
			<input:CodeListItemsDataGroup
				id="selectedItemsDataGroup" 
				dataProvider="{selectedItems}"
				editable="{editable}"
				sortable="true"
				selectionChange="selectionChangeHandler(event)"
				apply="applyHandler(event)"
				currentState="VERTICAL"
				width="100%" 
				/>
		</s:Scroller>
		
		<s:Line width="100%">
			<s:stroke>
				<s:SolidColorStroke color="#000000" weight="1" caps="square"/>
			</s:stroke>
		</s:Line>
		
		<s:Scroller width="100%"
					minHeight="30"
					maxHeight="{400 - selectedItemsDataGroupScroller.height}">
			<input:CodeListItemsDataGroup
				id="notSelectedItemsDataGroup" 
				dataProvider="{notSelectedItems}"
				selectionChange="selectionChangeHandler(event)"
				apply="applyHandler(event)"
				editable="{editable}"
				sortable="false"
				currentState="VERTICAL"
				width="100%" 
				/>
		</s:Scroller>
		
	</s:VGroup>
	
	
	<s:HGroup excludeFrom="loading" 
			  itemCreationPolicy="immediate" 
			  horizontalAlign="center" 
			  verticalAlign="middle"
			  width="100%" gap="30"
			  >
		<s:Button id="applyButton" 
				  label="{Message.get('global.apply')}" 
				  enabled="{editable}" 
				  click="applyHandler(event)" 
				  buttonMode="true"
				  useHandCursor="true"
				  />
	</s:HGroup>
	
	
</s:TitleWindow>

{'fraction_non_alphanumeric': 0.12829509671614936, 'fraction_numerical': 0.011875843454790824, 'mean_word_length': 3.3523884103367267, 'pattern_counts': {'":': 0, '<': 77, '<?xml version=': 2, '>': 77, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 14}, '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': '6039009', 'n_tokens_mistral': 4570, 'n_tokens_neox': 3435, 'n_words': 579}