#!/usr/bin/python
# _*_ coding: UTF-8 _*_

__author__ = 'Junhg'

# create: 2016/10/25
# version: 0.0.1
# author: Junhg
# contribute:
# 

from ViewObject import JHViewObject

class JHTextFieldObject(JHViewObject):
	def __init__(self):
		pass

	def __del__(self):
		pass

	def addSubview(self, attribView, isLoadView):
		print 'attribView=', attribView
		classViewName = self.attribViewTag(attribView)
		classViewAttrib = self.attribViewTagProperty(attribView)
		describle = JHViewObject.addSubview(self,attribView,False)
		connections = attribView.get('connections', {})

		if classViewAttrib.has_key('background'):
			describle +="	"+classViewName+".background = [UIImage imageNamed:@"+"\""+classViewAttrib.get('background','')+"\""+"];\n"
			pass

		if classViewAttrib.has_key('disabledBackground'):
			describle +="	"+classViewName+".disabledBackground = [UIImage imageNamed:@"+"\""+classViewAttrib.get('disabledBackground','')+"\""+"];\n"
			pass

		if classViewAttrib.has_key('placeholder'):
			describle +="	"+classViewName+".placeholder = @"+"\""+classViewAttrib.get('placeholder','')+"\""+";\n"
			pass

		if classViewAttrib.has_key('text'):
			describle +="	"+classViewName+".text = @"+"\""+classViewAttrib.get('text','')+"\""+";\n"
			pass

		if attribView.has_key('fontDescription'):
			describle +="	"+classViewName+".font = "+self.getTextFont(attribView.get('fontDescription'))+'\n'
			pass

		if attribView.has_key('clipsSubviews'):
			if attribView.get('clipsSubviews') == 'YES':
				describle +="	"+classViewName+".clipsSubviews = "+attribView.get('clipsSubviews')+'\n'
				pass
			pass

		if attribView.has_key('borderStyle'):
			describle +="	"+classViewName+".borderStyle = "+self.getTextBorderStyle(attribView.get('borderStyle'))+'\n'
			pass

		if attribView.has_key('clearButtonMode'):
			describle +="	"+classViewName+".clearButtonMode = "+self.getTextBorderStyle(attribView.get('clearButtonMode'))+'\n'
			pass
		
		if attribView.has_key('leftViewMode'):
			describle +="	"+classViewName+".leftViewMode = "+self.getTextBorderStyle(attribView.get('leftViewMode'))+'\n'
			pass
			
		if attribView.has_key('rightViewMode'):
			describle +="	"+classViewName+".rightViewMode = "+self.getTextBorderStyle(attribView.get('rightViewMode'))+'\n'
			pass
		
		for connection in connections:
			if connection.has_key('action'):
				action = connection.get('action', {})
				if action.has_key('selector') and action.has_key('eventType'):
					describle +="	["+classViewName+" addTarget:self action:@selector("+action.get('selector','')+") forControlEvents:+"+self.getControlEvent(action.get('eventType', 'touchUpInside'))+"];\n"
					pass
				pass
			pass
		return describle
		
@@ -1597,34 +1597,39 @@
 %09pass%0A%0A%09%09if 
-a
+classViewA
 ttrib
-View
 .has_key('bo
@@ -1712,34 +1712,39 @@
 BorderStyle(
-a
+classViewA
 ttrib
-View
 .get('border
@@ -1767,34 +1767,39 @@
 %09pass%0A%0A%09%09if 
-a
+classViewA
 ttrib
-View
 .has_key('cl
@@ -1882,38 +1882,45 @@
 .getText
-BorderStyle(a
+FieldViewMode(classViewA
 ttrib
-View
 .get('cl
@@ -1953,34 +1953,39 @@
 ass%0A%09%09%0A%09%09if 
-a
+classViewA
 ttrib
-View
 .has_key('le
@@ -2062,38 +2062,45 @@
 .getText
-BorderStyle(a
+FieldViewMode(classViewA
 ttrib
-View
 .get('le
@@ -2131,34 +2131,39 @@
 ss%0A%09%09%09%0A%09%09if 
-a
+classViewA
 ttrib
-View
 .has_key('ri
@@ -2246,30 +2246,37 @@
 Text
-BorderStyle(a
+FieldViewMode(classViewA
 ttrib
-View
 .get

modify TestField