<commit_before>package ras3r.reaction_view.helpers
{
	import fl.controls.*;
	import flash.text.*;
	import ras3r.*;
	import ras3r.utils.*;

	dynamic public class TextInputHelper extends ObjectProxy
	{
		static public var default_options:Hash = new Hash;

		static public function create (options:Object = null) :TextInputHelper
		{
			options = default_options.merge(options);
			var text_input:TextInputHelper = new TextInputHelper();

			// set "upSkin" style from "background" option
/*			if (options.background) text_input.setStyle('upSkin', options.remove('background'));*/

			// apply TextFormat from options.format hash
			apply_text_format_to(text_input, options);

			// prevent text=null
			if (options.hasOwnProperty('text')) options.text ||= '';

			// assign TextInput properties from options hash
			options.apply(text_input);

			return text_input;
		}

		static public function apply_text_format_to (text_input:*, options:Object) :void
		{
			if (options.format)
			{
				// use Hash object for hash.apply
				var format:Hash = new Hash(options.remove('format'));
				// is a custom font defined?
				// if so, set default embedFonts = true
				options.embedFonts = Boolean(format.font && options.embedFonts !== false);
				// get default text format
				var tf:Object = text_input.getStyle('textFormat');
				tf ||= new TextFormat();
				// update text format
				format.apply(tf);
				// apply new textFormat, embedFonts styles
				text_input.setStyle('embedFonts', options.remove('embedFonts'));
				text_input.setStyle('textFormat', tf);
			}
			else
			{
				text_input.setStyle('embedFonts', false);
			}
		}

		// >>> PUBLIC PROPERTIES
		// set "upSkin" style from "background" option
		public function set background (skin:Class) :void
		{
			display_object.setStyle('upSkin', skin);
		}

		public var display_object:TextInput = new TextInput();

		public function TextInputHelper ()
		{
			super(display_object);
		}
	}
}
<commit_msg>more helper refactoring<commit_after>package ras3r.reaction_view.helpers
{
	import fl.controls.*;
	import flash.text.*;
	import ras3r.*;
	import ras3r.utils.*;

	dynamic public class TextInputHelper extends Helper
	{
		static public var default_options:Hash = new Hash;

		static public function create (options:Object = null) :TextInputHelper
		{
			return (Helper.create(TextInputHelper, options) as TextInputHelper);
		}

		static public function apply_text_format_to (text_input:*, options:Object) :void
		{
			if (options.format)
			{
				// use Hash object for hash.apply
				var format:Hash = new Hash(options.remove('format'));
				// is a custom font defined?
				// if so, set default embedFonts = true
				options.embedFonts = Boolean(format.font && options.embedFonts !== false);
				// get default text format
				var tf:Object = text_input.getStyle('textFormat');
				tf ||= new TextFormat();
				// update text format
				format.apply(tf);
				// apply new textFormat, embedFonts styles
				text_input.setStyle('embedFonts', options.remove('embedFonts'));
				text_input.setStyle('textFormat', tf);
			}
			else
			{
				text_input.setStyle('embedFonts', false);
			}
		}

		// >>> PUBLIC PROPERTIES
		// set "upSkin" style from "background" option
		public function set background (skin:Class) :void
		{
			display_object.setStyle('upSkin', skin);
		}

		public var display_object:TextInput = new TextInput();

		// prevent text=null
		public function get text () :String
		{
			return display_object.text;
		}

		public function set text (t:String) :void
		{
			t ||= '';
			display_object.text = t;
		}


		// >>> PUBLIC METHODS
		public function TextInputHelper ()
		{
			super(display_object);
		}
	}
}

{'fraction_non_alphanumeric': 0.11977186311787072, 'fraction_numerical': 0.0016295491580662683, 'mean_word_length': 3.592269326683292, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 12, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, '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': '3631000', 'n_tokens_mistral': 1327, 'n_tokens_neox': 1114, 'n_words': 290}