<commit_before><?xml version="1.0" encoding="utf-8"?>
<!--
/*
    Weave (Web-based Analysis and Visualization Environment)
    Copyright (C) 2008-2011 University of Massachusetts Lowell

    This file is a part of Weave.

    Weave is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License, Version 3,
    as published by the Free Software Foundation.

    Weave is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with Weave.  If not, see <http://www.gnu.org/licenses/>.
*/
-->
<mx:HBox
    xmlns:mx="http://www.adobe.com/2006/mxml"
    xmlns="weave.ui.*"
	verticalAlign="middle"
    horizontalScrollPolicy="off"
	verticalScrollPolicy="off"
	creationPolicy="all"
	width="100%"
	addedToStage="handleAddedToStage()"
    >
    <mx:Script>
    	<![CDATA[
			import mx.controls.Label;

			private static const _groups:Dictionary = new Dictionary(true);
			
			/**
			 * This is the label component that will appear to the left of the other children of the Indent component.
			 */
			public const labelComponent:Label = new Label();
			
			public function set labelFontWeight(value:String):void
			{
				labelComponent.setStyle('fontWeight', value);
			}
			
			private var _group:* = undefined;
			private var _grouped:Boolean = true;
    	
			/**
			 * @inheritDoc
			 */
    		override protected function createChildren():void
    		{
    			super.createChildren();
				
				labelTextAlign = "right";
    			addChildAt(labelComponent, 0);
    		}
			
			/**
			 * @private
			 */
			private function handleAddedToStage():void
			{
				// If there is no group set and grouped was not set to false,
				// group this Indent componet with others having the same parent.
				if (_grouped && parent && _group === undefined)
					setGroup(parent);
			}
			
			/**
			 * Set this to false if this Indent component should not be grouped with others having the same parent.
			 * @default true
			 */
			public function set grouped(value:Boolean):void
			{
				_grouped = value;
				handleAddedToStage();
			}
			
			/**
			 * Set this to an IndentGroup to coordinate the indentation of several Indent components.
			 */
			public function set group(indentGroup:Object):void
			{
				setGroup(indentGroup);
			}
			
			/**
			 * @private
			 */
			private function setGroup(newGroup:Object):void
			{
				var array:Array;
				// remove from existing group
				if (_group)
				{
					array = _groups[_group] as Array;
					array.splice(array.indexOf(this), 1);
				}
				
				_group = newGroup;
				
				// add to new group
				if (_group)
				{
					array = _groups[_group] as Array;
					if (!array)
						_groups[_group] = array = [];
					array.push(this);
				}
				
				invalidateSize();
			}
			
			/**
			 * @inheritDoc
			 */
			override public function validateSize(recursive:Boolean=false):void
			{
				if (_group)
				{
					// find the maximum measuredWidth of all grouped Indent components
					var array:Array = _groups[_group] as Array;
					var max:Number = 0;
					var item:Indent;
					for each (item in array)
						max = Math.max(max, item.labelComponent.measuredWidth);
					for each (item in array)
						item.labelComponent.width = max;
					
					if (_group is IndentGroup)
						(_group as IndentGroup).measuredIndent = max;
				}
				super.validateSize(recursive);
			}

			/**
			 * This controls the textAlign style of the label component.
			 */
			public function set labelTextAlign(value:String):void
			{
				labelComponent.setStyle("textAlign", value);
			}
			
			/**
			 * Set this to ungroup the Indent component and specify an explicit indentation.
			 */
    		[Bindable] public function get indent():int
			{
				return labelComponent.width;
			}
    		public function set indent(value:int):void
			{
				group = null; // remove from group
				labelComponent.width = value;
			}
    		
			/**
			 * This is the label that will appear to the left of the other children of the Indent component.
			 */
    		override public function get label():String { return labelComponent.text; }
    		override public function set label(value:String):void { labelComponent.text = value; }
    	]]><commit_msg>Indent now works properly if the Label is swapped out for another component.<commit_after><?xml version="1.0" encoding="utf-8"?>
<!--
/*
    Weave (Web-based Analysis and Visualization Environment)
    Copyright (C) 2008-2011 University of Massachusetts Lowell

    This file is a part of Weave.

    Weave is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License, Version 3,
    as published by the Free Software Foundation.

    Weave is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with Weave.  If not, see <http://www.gnu.org/licenses/>.
*/
-->
<mx:HBox
    xmlns:mx="http://www.adobe.com/2006/mxml"
    xmlns="weave.ui.*"
	verticalAlign="middle"
    horizontalScrollPolicy="off"
	verticalScrollPolicy="off"
	creationPolicy="all"
	width="100%"
	addedToStage="handleAddedToStage()"
    >
    <mx:Script>
    	<![CDATA[
			import mx.controls.Label;
			import mx.core.IUIComponent;
			import mx.core.UIComponent;

			private static const _groups:Dictionary = new Dictionary(true);
			
			/**
			 * This is the label component that will appear to the left of the other children of the Indent component.
			 */
			public const labelComponent:Label = new Label();
			
			public function set labelFontWeight(value:String):void
			{
				labelComponent.setStyle('fontWeight', value);
			}
			
			private var _group:* = undefined;
			private var _grouped:Boolean = true;
    	
			/**
			 * @inheritDoc
			 */
    		override protected function createChildren():void
    		{
    			super.createChildren();
				
				labelTextAlign = "right";
    			addChildAt(labelComponent, 0);
    		}
			
			/**
			 * @private
			 */
			private function handleAddedToStage():void
			{
				// If there is no group set and grouped was not set to false,
				// group this Indent componet with others having the same parent.
				if (_grouped && parent && _group === undefined)
					setGroup(parent);
			}
			
			/**
			 * Set this to false if this Indent component should not be grouped with others having the same parent.
			 * @default true
			 */
			public function set grouped(value:Boolean):void
			{
				_grouped = value;
				handleAddedToStage();
			}
			
			/**
			 * Set this to an IndentGroup to coordinate the indentation of several Indent components.
			 */
			public function set group(indentGroup:Object):void
			{
				setGroup(indentGroup);
			}
			
			/**
			 * @private
			 */
			private function setGroup(newGroup:Object):void
			{
				var array:Array;
				// remove from existing group
				if (_group)
				{
					array = _groups[_group] as Array;
					array.splice(array.indexOf(this), 1);
				}
				
				_group = newGroup;
				
				// add to new group
				if (_group)
				{
					array = _groups[_group] as Array;
					if (!array)
						_groups[_group] = array = [];
					array.push(this);
				}
				
				invalidateSize();
			}
			
			/**
			 * @inheritDoc
			 */
			override public function validateSize(recursive:Boolean=false):void
			{
				if (_group)
				{
					// find the maximum measuredWidth of all grouped Indent components
					var array:Array = _groups[_group] as Array;
					var max:Number = 0;
					var item:Indent;
					for each (item in array)
						max = Math.max(max, IUIComponent(item.getChildAt(0)).measuredWidth);
					for each (item in array)
						item.getChildAt(0).width = max;
					
					if (_group is IndentGroup)
						(_group as IndentGroup).measuredIndent = max;
				}
				super.validateSize(recursive);
			}

			/**
			 * This controls the textAlign style of the label component.
			 */
			public function set labelTextAlign(value:String):void
			{
				labelComponent.setStyle("textAlign", value);
			}
			
			/**
			 * Set this to ungroup the Indent component and specify an explicit indentation.
			 */
    		[Bindable] public function get indent():int
			{
				return IUIComponent(numChildren > 0 ? getChildAt(0) : labelComponent).width;
			}
    		public function set indent(value:int):void
			{
				group = null; // remove from group
				IUIComponent(numChildren > 0 ? getChildAt(0) : labelComponent).width = value;
			}
    		
			/**
			 * This is the label that will appear to the left of the other children of the Indent component.
			 */
			[Bindable] override public function get label():String { return labelComponent.text; }
    		override public function set label(value:String):void { labelComponent.text = value; }
    	]]>
{'fraction_non_alphanumeric': 0.096537365768135, 'fraction_numerical': 0.005478851632697786, 'mean_word_length': 2.674315619967794, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 2, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, 'xml': 8}, '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': '4531404', 'n_tokens_mistral': 3329, 'n_tokens_neox': 2562, 'n_words': 855}