<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/>.
*/
-->
<SimpleVisTool xmlns="weave.visualization.tools.*" 
	     xmlns:mx="http://www.adobe.com/2006/mxml"
	     xmlns:ui="weave.ui.*" 
	     layout="absolute"
		 xmlns:settings="weave.ui.settings.*" xmlns:LinkableObjectList="weave.ui.LinkableObjectList.*">
	<mx:Script>
		<![CDATA[
			import mx.containers.Canvas;
			import mx.events.ChildExistenceChangedEvent;
			import mx.events.FlexEvent;
			import mx.events.IndexChangedEvent;
			import mx.events.SliderEvent;
			import mx.managers.CursorManager;
			
			import weave.Weave;
			import weave.api.getCallbackCollection;
			import weave.api.linkBindableProperty;
			import weave.core.LinkableString;
			import weave.core.LinkableVariable;
			import weave.core.SessionManager;
			import weave.core.UIUtils;
			import weave.ui.AttributeSelectorPanel;
			import weave.ui.DraggablePanel;
			import weave.utils.BitmapText;
			import weave.utils.ColumnUtils;
			import weave.utils.CustomCursorManager;
			import weave.utils.DebugUtils;
			import weave.visualization.layers.PlotLayer;
			import weave.visualization.layers.SelectablePlotLayer;
			import weave.visualization.plotters.AxisPlotter;
			import weave.visualization.plotters.CircleGlyphPlotter;
			import weave.visualization.plotters.GaugePlotter;
			import weave.visualization.plotters.styles.SolidFillStyle;
		
		
			public var _plotter:GaugePlotter = null;
			
			override protected function childrenCreated():void
			{
				super.childrenCreated();
				cRampEditor.colorRamp = _plotter.colorRamp;
				
				visualization.marginBottom.addGroupedCallback(this, handleMarginChange);
				linkBindableProperty(visualization.marginBottom, marginLabel, "height");
			}
			
			override protected function constructor():void
			{
				super.constructor();
				_plotter = initDefaultPlotter(GaugePlotter) as GaugePlotter;
				
			
				//_plotter.dynamicColorColumn.addGroupedCallback(this, handleDynamicColorColumnChange);
				
				// by default this tool only displays the probed records.
				plotLayer.subsetFilter.globalName = Weave.DEFAULT_PROBE_KEYSET;
				plotLayer.selectionFilter.removeObject();
				plotLayer.probeFilter.removeObject();

				getCallbackCollection(visualization.zoomBounds).addImmediateCallback(this, invalidateAxes);
				getCallbackCollection(_plotter).addImmediateCallback(this, invalidateAxes);
				invalidateAxes();
				
				initColumnDefaults(_plotter.meterColumn);
				toolTitle.addImmediateCallback(this, updateTitle);
				_plotter.meterColumn.addGroupedCallback(this, updateMarginLabel, true);
				visualization.bottomMarginClickCallbacks.addGroupedCallback(this, handleMarginLabelClick);
				
				Weave.properties.axisFontColor.addGroupedCallback(this,updateMarginLabel);
				Weave.properties.axisFontSize.addGroupedCallback(this,updateMarginLabel);
				
				visualization.marginBottom.value    = DEFAULT_MARGIN_BOTTOM;
			}
			
			override public function getSelectableAttributeNames():Array
			{
				return ["Gauge Column"];
			}
			override public function getSelectableAttributes():Array
			{
				return [_plotter.meterColumn]
			}
			
			private function invalidateAxes():void
			{
				updateTitle();
			}
			
			private function updateTitle():void
			{
				if (_plotter == null)
					title = "Gauge";
				if (toolTitle.value == null)
					title = "Gauge of " + ColumnUtils.getTitle(_plotter.meterColumn);
			}
			
			[Bindable]
			private var marginLabelText:String = "";
			
			private function handleMarginLabelClick():void
			{
				AttributeSelectorPanel.openToolSelector(this,_plotter.meterColumn);
			}
			
			private function showLinkCursor():void
			{
				if (Weave.properties.enableToolControls.value)
					CustomCursorManager.showCursor(CustomCursorManager.LINK_CURSOR);
			}
			
			private function updateMarginLabel():void
			{
				if (!parent)
					return callLater(updateMarginLabel);
				
				marginLabelText = ColumnUtils.getTitle(_plotter.meterColumn);
				
				marginLabel.setStyle("color", Weave.properties.axisFontColor.value);
				marginLabel.setStyle("fontSize", Weave.properties.axisFontSize.value);
			}
			
			private static const DEFAULT_MARGIN_BOTTOM:int = 25;
			private function handleMarginChange():void
			{
				marginLabelCheckBox.selected = visualization.marginBottom.value != 0;
			}
			
		]]>
	</mx:Script>
	<mx:TextArea id="marginLabel"
				 fontWeight="bold" click="handleMarginLabelClick()" 
				 paddingLeft="5" paddingRight="5"
				 text="{marginLabelText}" width="100%"
				 rollOver="showLinkCursor();"
				 horizontalScrollPolicy="off" verticalScrollPolicy="off"
				 rollOut="CursorManager.removeAllCursors()"
				 wordWrap="true" selectable="false" editable="false"
				 borderThickness="0" backgroundAlpha="0"
				 bottom="20"
				 textAlign="center"
				 toolTip="{marginLabelText} &#13;&#09;Click here to select a different attribute."/>
	<ui:ControlPanel>
		<mx:VBox id="attributesPanel" label="Attributes for Gauge" >
			<ui:DynamicColumnComponent visTool="{this}" label="Gauge column:" initialize="(event.target as DynamicColumnComponent).dynamicObject = _plotter.meterColumn"/>
		</mx:VBox>
		<mx:VBox id="advControlsPanel" label="Advanced">
			<mx:CheckBox id="marginLabelCheckBox" label="Show attribute name" change="visualization.marginBottom.value = marginLabelCheckBox.selected ? DEFAULT_MARGIN_BOTTOM : 0;" toolTip="Click to hide the title."/>
			<ui:ColorRampEditor id="cRampEditor"/>
		</mx:VBox>
	</ui:ControlPanel>
</SimpleVisTool><commit_msg>Fixed display bug with guage tool attribute label<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/>.
*/
-->
<SimpleVisTool xmlns="weave.visualization.tools.*" 
	     xmlns:mx="http://www.adobe.com/2006/mxml"
	     xmlns:ui="weave.ui.*" 
	     layout="absolute"
		 xmlns:settings="weave.ui.settings.*" xmlns:LinkableObjectList="weave.ui.LinkableObjectList.*">
	<mx:Script>
		<![CDATA[
			import mx.containers.Canvas;
			import mx.events.ChildExistenceChangedEvent;
			import mx.events.FlexEvent;
			import mx.events.IndexChangedEvent;
			import mx.events.SliderEvent;
			import mx.managers.CursorManager;
			
			import weave.Weave;
			import weave.api.getCallbackCollection;
			import weave.api.linkBindableProperty;
			import weave.core.LinkableString;
			import weave.core.LinkableVariable;
			import weave.core.SessionManager;
			import weave.core.UIUtils;
			import weave.ui.AttributeSelectorPanel;
			import weave.ui.DraggablePanel;
			import weave.utils.BitmapText;
			import weave.utils.ColumnUtils;
			import weave.utils.CustomCursorManager;
			import weave.utils.DebugUtils;
			import weave.visualization.layers.PlotLayer;
			import weave.visualization.layers.SelectablePlotLayer;
			import weave.visualization.plotters.AxisPlotter;
			import weave.visualization.plotters.CircleGlyphPlotter;
			import weave.visualization.plotters.GaugePlotter;
			import weave.visualization.plotters.styles.SolidFillStyle;
		
		
			public var _plotter:GaugePlotter = null;
			
			override protected function childrenCreated():void
			{
				super.childrenCreated();
				cRampEditor.colorRamp = _plotter.colorRamp;
				
				visualization.marginBottom.addGroupedCallback(this, handleMarginChange);
			}
			
			override protected function constructor():void
			{
				super.constructor();
				_plotter = initDefaultPlotter(GaugePlotter) as GaugePlotter;
				
			
				//_plotter.dynamicColorColumn.addGroupedCallback(this, handleDynamicColorColumnChange);
				
				// by default this tool only displays the probed records.
				plotLayer.subsetFilter.globalName = Weave.DEFAULT_PROBE_KEYSET;
				plotLayer.selectionFilter.removeObject();
				plotLayer.probeFilter.removeObject();

				getCallbackCollection(visualization.zoomBounds).addImmediateCallback(this, invalidateAxes);
				getCallbackCollection(_plotter).addImmediateCallback(this, invalidateAxes);
				invalidateAxes();
				
				initColumnDefaults(_plotter.meterColumn);
				toolTitle.addImmediateCallback(this, updateTitle);
				_plotter.meterColumn.addGroupedCallback(this, updateMarginLabel, true);
				visualization.bottomMarginClickCallbacks.addGroupedCallback(this, handleMarginLabelClick);
				
				Weave.properties.axisFontColor.addGroupedCallback(this,updateMarginLabel);
				Weave.properties.axisFontSize.addGroupedCallback(this,updateMarginLabel);
				
				visualization.marginBottom.value    = DEFAULT_MARGIN_BOTTOM;
			}
			
			override public function getSelectableAttributeNames():Array
			{
				return ["Gauge Column"];
			}
			override public function getSelectableAttributes():Array
			{
				return [_plotter.meterColumn]
			}
			
			private function invalidateAxes():void
			{
				updateTitle();
			}
			
			private function updateTitle():void
			{
				if (_plotter == null)
					title = "Gauge";
				if (toolTitle.value == null)
					title = "Gauge of " + ColumnUtils.getTitle(_plotter.meterColumn);
			}
			
			[Bindable]
			private var marginLabelText:String = "";
			
			private function handleMarginLabelClick():void
			{
				AttributeSelectorPanel.openToolSelector(this,_plotter.meterColumn);
			}
			
			private function showLinkCursor():void
			{
				if (Weave.properties.enableToolControls.value)
					CustomCursorManager.showCursor(CustomCursorManager.LINK_CURSOR);
			}
			
			private function updateMarginLabel():void
			{
				if (!parent)
					return callLater(updateMarginLabel);
				
				marginLabelText = ColumnUtils.getTitle(_plotter.meterColumn);
				
				marginLabel.setStyle("color", Weave.properties.axisFontColor.value);
				marginLabel.setStyle("fontSize", Weave.properties.axisFontSize.value);
			}
			
			private static const DEFAULT_MARGIN_BOTTOM:int = 35;
			private function handleMarginChange():void
			{
				marginLabelCheckBox.selected = visualization.marginBottom.value != 0;
				marginLabel.height = visualization.marginBottom.value;
			}
			
		]]>
	</mx:Script>
	<mx:TextArea id="marginLabel"
				 fontWeight="bold" click="handleMarginLabelClick()" 
				 paddingLeft="5" paddingRight="5"
				 text="{marginLabelText}" width="100%"
				 rollOver="showLinkCursor();"
				 horizontalScrollPolicy="off" verticalScrollPolicy="off"
				 rollOut="CursorManager.removeAllCursors()"
				 wordWrap="true" selectable="false" editable="false"
				 borderThickness="0" backgroundAlpha="0"
				 bottom="0"
				 textAlign="center"
				 toolTip="{marginLabelText} &#13;&#09;Click here to select a different attribute."/>
	<ui:ControlPanel>
		<mx:VBox id="attributesPanel" label="Attributes for Gauge" >
			<ui:DynamicColumnComponent visTool="{this}" label="Gauge column:" initialize="(event.target as DynamicColumnComponent).dynamicObject = _plotter.meterColumn"/>
		</mx:VBox>
		<mx:VBox id="advControlsPanel" label="Advanced">
			<mx:CheckBox id="marginLabelCheckBox" label="Show attribute name" change="visualization.marginBottom.value = marginLabelCheckBox.selected ? DEFAULT_MARGIN_BOTTOM : 0;" toolTip="Click to hide the title."/>
			<ui:ColorRampEditor id="cRampEditor"/>
		</mx:VBox>
	</ui:ControlPanel>
</SimpleVisTool>
{'fraction_non_alphanumeric': 0.10077767978834282, 'fraction_numerical': 0.005211256313637457, 'mean_word_length': 4.299065420560748, 'pattern_counts': {'":': 0, '<': 39, '<?xml version=': 2, '>': 39, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, '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': '8079', 'n_tokens_mistral': 4444, 'n_tokens_neox': 3574, 'n_words': 723}