<commit_before>##########################################
# JSTextField - One line text object
# Coded by kouichi.sakazaki 2013.03.25
##########################################

class JSTextField extends JSControl
	constructor: (frame = JSRectMake(0, 0, 120, 24)) ->
		super(frame)
		@_textSize = 8 
		@_textColor = JSColor("black")
		@_bgColor = JSColor("#f0f0f0")
		@_textAlignment = "JSTextAlignmentCenter"
		@_text = ""
		@_editable = true
		
	setText: (@_text) ->
		if ($(@_viewSelector+"_text").length)
			$(@_viewSelector+"_text").html(@_text)

	setTextSize: (@_textSize) ->
		if ($(@_viewSelector+"_text").length)
			$(@_viewSelector+"_text").css("font-size", @_textSize+"pt")

	setTextColor: (@_textColor) ->
		if ($(@_viewSelector+"_text").length)
			$(@_viewSelector).css("color", @_textColor)
		
	setTextAlignment: (@_textAlignment) ->
		switch @_textAlignment
			when "JSTextAlignmentCenter"
				$(@_viewSelector).css("text-align", "center")
			when "JSTextAlignmentLeft"
				$(@_viewSelector).css("text-align", "left")
			when "JSTextAlignmentRight"
				$(@_viewSelector).css("text-align", "right")
			else
				$(@_viewSelector).css("text-align", "center")
	
	setFrame:(frame)->
		super(frame)
		$(@_viewSelector+"_text").width(frame.size.width)
		$(@_viewSelector+"_text").height(frame.size.height)
	
	setEditable:(@_editable)->
		
		if (!$(@_viewSelector).length)
			return
			
		if (!@_text?)
			@_text = ""
			
		#/////////////////////////////////////////////////////////////////
		if (@_editable == true)
			disp = @_text
			@_text = ""
			tag = "<input id='"+@_objectID+"_text' style='position:absolute;z-index:1;' />"
			x = -4
			y = -4
		else
			if (@_text == "" && $(@_viewSelector+"_text").length)
				@_text = $(@_viewSelector+"_text").val()
			disp = @_text
			tag = "<div id='"+@_objectID+"_text' style='position:absolute;z-index:1;'></div>"
			x = 0
			y = 0
			
		if ($(@_viewSelector+"_text").length)
			$(@_viewSelector+"_text").remove()
		$(@_viewSelector).append(tag)
		$(@_viewSelector+"_text").css("line-height",@_frame.size.height+"px")
		if (@_editable == true)
			$(@_viewSelector+"_text").unbind("click").bind "click", (event) =>
				event.stopPropagation()
			
		@setTextSize(@_textSize)
		@setTextColor(@_textColor)
		@setTextAlignment(@_textAlignment)
		$(@_viewSelector+"_text").css("left", x)
		$(@_viewSelector+"_text").css("top", y)
		
		if (@_editable == true)
			$(@_viewSelector+"_text").val(disp)
		else
			$(@_viewSelector+"_text").html(disp)
			
		#/////////////////////////////////////////////////////////////////
		
		$(@_viewSelector+"_text").width(@_frame.size.width)
		$(@_viewSelector+"_text").height(@_frame.size.height)
		
	viewDidAppear: ->
		@setEditable(@_editable)
		super()
		$(@_viewSelector).css("vertical-align", "middle")
		$(@_viewSelector+"_text").width(@_frame.size.width)
		$(@_viewSelector+"_text").css("line-height",@_frame.size.height+"px")
		@setTextSize(@_textSize)
		@setTextColor(@_textColor)
		@setTextAlignment(@_textAlignment)

<commit_msg>JSTextField update<commit_after>##########################################
# JSTextField - One line text object
# Coded by kouichi.sakazaki 2013.03.25
##########################################

class JSTextField extends JSControl
	constructor: (frame = JSRectMake(0, 0, 120, 24)) ->
		super(frame)
		@_textSize = 8 
		@_textColor = JSColor("black")
		@_bgColor = JSColor("#f0f0f0")
		@_textAlignment = "JSTextAlignmentCenter"
		@_text = ""
		@_editable = true
		
	setText: (@_text) ->
		if ($(@_viewSelector+"_text").length)
			$(@_viewSelector+"_text").val(@_text)

	setTextSize: (@_textSize) ->
		if ($(@_viewSelector+"_text").length)
			$(@_viewSelector+"_text").css("font-size", @_textSize+"pt")

	setTextColor: (@_textColor) ->
		if ($(@_viewSelector+"_text").length)
			$(@_viewSelector).css("color", @_textColor)
		
	setTextAlignment: (@_textAlignment) ->
		switch @_textAlignment
			when "JSTextAlignmentCenter"
				$(@_viewSelector).css("text-align", "center")
			when "JSTextAlignmentLeft"
				$(@_viewSelector).css("text-align", "left")
			when "JSTextAlignmentRight"
				$(@_viewSelector).css("text-align", "right")
			else
				$(@_viewSelector).css("text-align", "center")
	
	setFrame:(frame)->
		super(frame)
		$(@_viewSelector+"_text").width(frame.size.width)
		$(@_viewSelector+"_text").height(frame.size.height)
	
	setEditable:(@_editable)->
		
		if (!$(@_viewSelector).length)
			return
			
		if (!@_text?)
			@_text = ""
			
		#/////////////////////////////////////////////////////////////////
		if (@_editable == true)
			disp = @_text
			@_text = ""
			tag = "<input id='"+@_objectID+"_text' style='position:absolute;z-index:1;' />"
			x = -4
			y = -4
		else
			if (@_text == "" && $(@_viewSelector+"_text").length)
				@_text = $(@_viewSelector+"_text").val()
			disp = @_text
			tag = "<div id='"+@_objectID+"_text' style='position:absolute;z-index:1;'></div>"
			x = 0
			y = 0
			
		if ($(@_viewSelector+"_text").length)
			$(@_viewSelector+"_text").remove()
		$(@_viewSelector).append(tag)
		$(@_viewSelector+"_text").css("line-height",@_frame.size.height+"px")
		if (@_editable == true)
			$(@_viewSelector+"_text").unbind("click").bind "click", (event) =>
				event.stopPropagation()
			
		@setTextSize(@_textSize)
		@setTextColor(@_textColor)
		@setTextAlignment(@_textAlignment)
		$(@_viewSelector+"_text").css("left", x)
		$(@_viewSelector+"_text").css("top", y)
		
		if (@_editable == true)
			$(@_viewSelector+"_text").val(disp)
		else
			$(@_viewSelector+"_text").html(disp)
			
		#/////////////////////////////////////////////////////////////////
		
		$(@_viewSelector+"_text").width(@_frame.size.width)
		$(@_viewSelector+"_text").height(@_frame.size.height)
		
	viewDidAppear: ->
		@setEditable(@_editable)
		super()
		$(@_viewSelector).css("vertical-align", "middle")
		$(@_viewSelector+"_text").width(@_frame.size.width)
		$(@_viewSelector+"_text").css("line-height",@_frame.size.height+"px")
		@setTextSize(@_textSize)
		@setTextColor(@_textColor)
		@setTextAlignment(@_textAlignment)


{'fraction_non_alphanumeric': 0.2627230667547918, 'fraction_numerical': 0.008261731658955718, 'mean_word_length': 3.8893376413570273, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 27, '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': '2237442', 'n_tokens_mistral': 2393, 'n_tokens_neox': 2077, 'n_words': 293}