package cn.com.teamcenter.rac.form;

import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Desktop;
import java.awt.Dimension;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;
import java.io.FileWriter;
import java.net.URI;
import java.text.DecimalFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Hashtable;
import java.util.LinkedHashMap;
import java.util.Vector;
import java.util.logging.Logger;

import javax.swing.BorderFactory;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JComponent;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JProgressBar;
import javax.swing.JScrollPane;
import javax.swing.JSplitPane;
import javax.swing.JTabbedPane;
import javax.swing.JTextArea;
import javax.swing.JViewport;
import javax.swing.table.JTableHeader;
import javax.swing.text.JTextComponent;

import com.teamcenter.rac.aif.kernel.AIFComponentContext;
import com.teamcenter.rac.aifrcp.AIFUtility;
//import com.teamcenter.rac.common.lov.LOVComboBox;
import com.teamcenter.rac.conditionalproperties.FormFieldManager;
import com.teamcenter.rac.conditionalproperties.WidgetTypeAdapter;
import com.teamcenter.rac.kernel.ListOfValuesInfo;
import com.teamcenter.rac.kernel.TCComponentForm;
import com.teamcenter.rac.kernel.TCComponentItem;
import com.teamcenter.rac.kernel.TCComponentItemType;
import com.teamcenter.rac.kernel.TCComponentListOfValues;
import com.teamcenter.rac.kernel.TCComponentListOfValuesType;
import com.teamcenter.rac.kernel.TCException;
import com.teamcenter.rac.kernel.TCFormProperty;
import com.teamcenter.rac.kernel.TCProperty;
import com.teamcenter.rac.kernel.TCPropertyDescriptor;
import com.teamcenter.rac.kernel.TCSession;
import com.teamcenter.rac.kernel.TCUserService;
import com.teamcenter.rac.stylesheet.AbstractPropertyComponent;
import com.teamcenter.rac.stylesheet.AbstractRendering;
import com.teamcenter.rac.stylesheet.InterfacePropertyComponent;
import com.teamcenter.rac.stylesheet.InterfaceRendererEvent;
import com.teamcenter.rac.stylesheet.PropertyArray;
import com.teamcenter.rac.stylesheet.PropertyComment;
import com.teamcenter.rac.stylesheet.PropertyLogicalPanel;
import com.teamcenter.rac.stylesheet.PropertyObjectLink;
import com.teamcenter.rac.util.DateButton;
import com.teamcenter.rac.util.MessageBox;
import com.teamcenter.rac.util.Registry;
import com.teamcenter.rac.util.iTextField;

@SuppressWarnings("deprecation")
public class YSR8_QuotationRevisionMaster extends AbstractRendering {

	private static final long serialVersionUID = 1L;

	private TCSession      session;
	private iTextField     ItemID;                    //编号
	private iTextField     ysr8_Sales;                //销售担当
	private iTextField     ysr8_OrderManufacturer;    //订货厂家
	private iTextField     ysr8_CustomerName;         //最终用户
	private iTextField     ysr8_QuotationLevel;       //报价水平
	private iTextField     ysr8_Contact;              //联系人
	private iTextField     ysr8_ContactDept;          //所属部门
	private iTextField     ysr8_ContactPosition;      //职务
	private iTextField     ysr8_ContactPhone;         //联系电话
	
	private DateButton	   ysr8_RequestedDate;        //希望答复日期
	private DateButton	   ysr8_SysPlanDate;          //报价完成时限
	
	private iTextField     ysr8_ProjectManager;       //项目经理
//	private iTextField     ysr8_ProjectLevel;         //报价等级
	private JComboBox<String>    ysr8_ProjectLevel;
	private iTextField     ysr8_Ratio;                //系数
	
	private iTextField     ysr8_SytemName;            //系统名称
//	private iTextField     ysr8_ProjectDes;           //输入状态
	private JComboBox<String> ysr8_QuotationStatus;   //报价输入状态
	private JComboBox<String> ysr8_Product;   //产品
	private JComboBox<String> ysr8_use;   //用途
	private DateButton     ysr8_EstimatedDate;        //预计启动时间
	private iTextField     ysr8_Possibility;          //可能性
	private DateButton	   ysr8_ReceiveDate;          //受理时间
	private DateButton	   ysr8_FinishedDate;         //报价完成时限
//	private DateButton	   date_released;        	  //报价完成时限
	private iTextField     ysr8_OfferAmount;          //报价金额
	private JTextArea      ysr8_RobotModelAndNum;     //机器人型号、数量
	private JTextArea      ysr8_QuotationRemarks;     		  //备注
	
//	private JComboBox<String>    ysr8_QuotationState; //报价状态//lidy20180925增加属性
//	private String[]       ysr8_Qutation_LOV;
//	private String[]       ysr8_Qutation2_LOV;
//	private String[]       ysr8_QuotationStatus_lov;
	private HashMap<String, LinkedHashMap<String, String>> lovMap = new HashMap<>();
//	private LinkedHashMap<String, String>	lovQuotation2;
	
	private JButton    jBPM = new JButton("BPM报价单");
	
	TCComponentForm componentForm = null;
	TCComponentItem componentItem = null;
	private Vector<Component>allComponents = new Vector<Component>();
	private TCFormProperty[] formProperties;
	private Hashtable<TCFormProperty, JComponent>	indices = new Hashtable<TCFormProperty, JComponent>();
	
	public YSR8_QuotationRevisionMaster(TCComponentForm componentForm) throws Exception {
		super(componentForm);
		this.componentForm = componentForm;
		this.session = componentForm.getSession();
		String formName = componentForm.getProperty("object_name");
		try {
			TCComponentItemType imancomponentitemtype = (TCComponentItemType) session.getTypeService().getTypeComponent("Item");
			componentItem = imancomponentitemtype.find(formName.substring(0, formName.length()-2));
//			System.out.println(formName.substring(0, formName.length()-2));
		} catch (TCException e) {
			e.printStackTrace();
		}
		addUIComponents();
		initUI();
		setName();
		loadRendering();
	}
	
	private void initUI() {
		
		JPanel paneMain = new JPanel(new GridBagLayout());
		
		JPanel paneTop = new JPanel(new GridBagLayout());
		paneTop.setBorder(BorderFactory.createTitledBorder("基础信息"));
		GridBagConstraints g4 = new GridBagConstraints();
		g4.insets = new Insets(5, 5, 5, 5);
		g4.anchor = GridBagConstraints.WEST;
		g4.fill = GridBagConstraints.HORIZONTAL;
		
		g4.gridx = 0;
		g4.gridy = 0;
		g4.gridwidth=1;
		paneTop.add(new JLabel("编号:　　"), g4);
		
		g4.gridx = 1;
		g4.gridy = 0;
		g4.gridwidth=3;
		paneTop.add(ItemID, g4);
		
		g4.gridx = 4;
		g4.gridy = 0;
		g4.gridwidth=1;
		paneTop.add(new JLabel("销售担当:"), g4);

		g4.gridx = 5;
		g4.gridy = 0;
		g4.gridwidth=3;
		paneTop.add(ysr8_Sales, g4);
		
		g4.gridx=6;
		g4.weightx=1;
		paneTop.add(new JLabel(""),g4);
		g4.weightx=0;
		
		g4.gridx = 0;
		g4.gridy = 1;
		g4.gridwidth=1;
		paneTop.add(new JLabel("订货厂家:　　"), g4);
		
		g4.gridx = 1;
		g4.gridy = 1;
		g4.gridwidth=3;
		paneTop.add(ysr8_OrderManufacturer, g4);
		
		g4.gridx = 4;
		g4.gridy = 1;
		g4.gridwidth=1;
		paneTop.add(new JLabel("最终用户:"), g4);
		
		g4.gridx = 5;
		g4.gridy = 1;
		g4.gridwidth=3;
		paneTop.add(ysr8_CustomerName, g4);
		
		g4.gridx = 0;
		g4.gridy = 2;
		g4.gridwidth=1;
		paneTop.add(new JLabel("报价水平:　　"), g4);
		
		g4.gridx = 1;
		g4.gridy = 2;
		g4.gridwidth=1;
		paneTop.add(ysr8_QuotationLevel, g4);
		
		g4.gridx = 2;
		g4.gridy = 2;
		g4.gridwidth=2;
		paneTop.add(new JLabel("(详细，概略，参考，其他)"), g4);
		
		g4.gridx = 4;
		g4.gridy = 2;
		g4.gridwidth=1;
		paneTop.add(new JLabel("受理时间:"), g4);//
		
		g4.gridx = 5;
		g4.gridwidth=1;
		paneTop.add(ysr8_ReceiveDate, g4);
		
		g4.gridx = 6;
		g4.gridy = 2;
		g4.gridwidth=1;
		paneTop.add(new JLabel("　希望答复日期:　"), g4);
		
		g4.gridx = 7;
		g4.gridy = 2;
		g4.gridwidth=1;
		paneTop.add(ysr8_RequestedDate, g4);
		
		g4.gridx = 0;
		g4.gridy = 3;
		g4.gridwidth=1;
		paneTop.add(new JLabel("联系人:　　"), g4);
		
		g4.gridx = 1;
		g4.gridy = 3;
		g4.gridwidth=1;
		paneTop.add(ysr8_Contact, g4);
		
		g4.gridx = 2;
		g4.gridy = 3;
		g4.gridwidth=1;
		paneTop.add(new JLabel("所属部门:"), g4);
		
		g4.gridx = 3;
		g4.gridy = 3;
		paneTop.add(ysr8_ContactDept, g4);
		
		g4.gridx = 4;
		g4.gridy = 3;
		g4.gridwidth=1;
		paneTop.add(new JLabel("职务:"), g4);
		
		g4.gridx = 5;
		g4.gridy = 3;
		g4.gridwidth=1;
		paneTop.add(ysr8_ContactPosition, g4);
		
		g4.gridx = 6;
		g4.gridy = 3;
		paneTop.add(new JLabel("　联系电话:"), g4);
		
		g4.gridx = 7;
		g4.gridy = 3;
		g4.gridwidth=1;
		paneTop.add(ysr8_ContactPhone, g4);
		
		JPanel paneCenter = new JPanel(new GridBagLayout());
		paneCenter.setBorder(BorderFactory.createTitledBorder("系统科科长填写"));
		g4.gridx=0;
		g4.gridy=0;
		g4.gridwidth=1;
		paneCenter.add(new JLabel("项目经理:　　"),g4);
		g4.gridx=1;
		g4.gridwidth=2;
		paneCenter.add(ysr8_ProjectManager,g4);
		g4.gridwidth=1;
		g4.gridx=3;
		JButton pmButton =  new JButton("...");
		pmButton.setPreferredSize(new Dimension(30, 20));
		paneCenter.add(pmButton,g4);
		g4.gridwidth=1;
		g4.gridx=4;
		paneCenter.add(new JLabel("报价完成时限(系统科):"),g4);
		g4.gridwidth=1;
		g4.gridx=5;
		paneCenter.add( ysr8_SysPlanDate,g4);
		g4.gridx=6;
		g4.gridwidth=2;
		paneCenter.add(new JLabel("　　　　　　"),g4);
//		g4.gridx=6;
//		paneCenter.add(new JLabel("　　　"),g4);
		
		g4.gridx=7;
		g4.weightx=1;
		g4.gridwidth=1;
		paneCenter.add(new JLabel(""),g4);
		
		g4.gridy=1;
		g4.gridx=0;
		paneCenter.add(new JLabel("报价等级:　　"),g4);
		g4.gridx=1;
		g4.gridwidth=3;
		paneCenter.add(ysr8_ProjectLevel,g4);
		g4.gridwidth=1;
		g4.gridx=4;
		paneCenter.add(new JLabel("系数:"),g4);
		g4.gridx=5;
		paneCenter.add(ysr8_Ratio,g4);
		g4.gridx=6;//
		paneCenter.add(new JLabel("　　　　　　　　　　"),g4);
//		g4.gridx=6;
//		paneCenter.add( ysr8_QuotationState,g4);
		
		final GCSelectionUserCommand selectionUserCmd = new GCSelectionUserCommand(AIFUtility.getCurrentApplication().getDesktop(), session);
		pmButton.addActionListener(new ActionListener() {
			
			@Override
			public void actionPerformed(ActionEvent actionevent) {
				selectionUserCmd.setContextBean(ysr8_ProjectManager);
				try {
//					dialog.setVisible(false);
					selectionUserCmd.executeModal();
//					dialog.setVisible(true);
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});
//		JPanel paneCenter = new JPanel(new GridBagLayout());
//		paneCenter.setBorder(BorderFactory.createTitledBorder("技术部 ")); 
//		GridBagConstraints g3 = new GridBagConstraints();
//		g3.insets = new Insets(5, 5, 5, 5);
//		g3.anchor = GridBagConstraints.WEST;
//		g3.fill = GridBagConstraints.HORIZONTAL;
//		
//		g3.gridx = 0;
//		g3.gridy = 0;
//		g4.gridwidth=1;
//		paneCenter.add(new JLabel("项目经理:"), g3);
//		
//		g3.gridx = 1;
//		g3.gridy = 0;
//		g3.gridwidth=3;
////		paneCenter.add(ysr8_ProjectManager, g3);
//		
//		JPanel panelPM = new JPanel(new GridBagLayout());			
//		GridBagConstraints g16 = new GridBagConstraints();
//		g16.insets = new Insets(0, 5, 0, 5);
//		g16.anchor = GridBagConstraints.WEST;
//		g16.fill = GridBagConstraints.HORIZONTAL;
//		g16.gridx = 0;
//		g16.gridy = 0;
//		g16.gridwidth=2;
//		panelPM.add(ysr8_ProjectManager, g16);
//		g16.gridx = 1;
//		g16.gridy = 0;
//		g16.gridwidth=1;
//		JButton iconLabel6 = new JButton("...");
//		panelPM.add(iconLabel6, g16);
//		paneCenter.add(panelPM, g3);		
//		
//		g3.gridx = 0;
//		g3.gridy = 1;
//		g4.gridwidth=1;
//		paneCenter.add(new JLabel("报价等级:"), g3);
//		
//		g3.gridx = 1;
//		g3.gridy = 1;
//		g3.gridwidth=2;
//		paneCenter.add(ysr8_ProjectLevel, g3);
//		
//		g3.gridx = 3;
//		g3.gridy = 1;
//		g4.gridwidth=1;
//		paneCenter.add(new JLabel("报价完成时限(系统科):"), g3);
//		
//		g3.gridx = 4;
//		g3.gridy = 1;
//		g4.gridwidth=1;
//		paneCenter.add(ysr8_SysPlanDate, g3);
		
		JPanel panelBotton = new JPanel(new GridBagLayout());
		panelBotton.setBorder(BorderFactory.createTitledBorder("项目经理填写"));
		GridBagConstraints g2 = new GridBagConstraints();
		g2.insets = new Insets(5, 5, 5, 5);
		g2.anchor = GridBagConstraints.WEST;
		g2.fill = GridBagConstraints.HORIZONTAL;
		
		g2.gridy = 0;
		g2.gridx = 0;
		g2.gridwidth=1;
		panelBotton.add(new JLabel("系统名称:"), g2);
		
		g2.gridx = 1;
		g2.gridwidth=3;
		panelBotton.add(ysr8_SytemName, g2);
		
		g2.gridx = 4;
		g2.gridwidth=1;
//		panelBotton.add(new JLabel("　　输入状态:"), g2);//ysr8_EstimatedDate
		panelBotton.add(new JLabel("机器人型号、数量:"), g2);

		
		g2.gridx = 5;
		g2.gridwidth=6;
		g2.gridheight=3;
		panelBotton.add(ysr8_RobotModelAndNum, g2);
//		panelBotton.add(ysr8_QuotationStatus, g2);
		
		g2.gridx=6;
		g2.weightx=1;
		panelBotton.add(new JLabel(""),g2);
		g2.weightx=0;
		
//		g2.gridy = 1;
//		g2.gridx = 0;
//		g2.gridwidth=1;
//		panelBotton.add(new JLabel("受理时间:"), g2);//
//		
//		g2.gridx = 1;
//		g2.gridwidth=1;
//		panelBotton.add(ysr8_ReceiveDate, g2);
		
		g2.gridy = 1;
		g2.gridx = 0;
		g2.gridwidth=1;
		g2.gridheight=1;
//		panelBotton.add(new JLabel("完成时间:"), g2);
		panelBotton.add(new JLabel("方案报价状态:"), g2);
		
		g2.gridx = 1;
		g2.gridwidth=3;
//		panelBotton.add(ysr8_FinishedDate, g2);
		panelBotton.add(ysr8_QuotationStatus, g2);
//		g2.gridx = 4;
//		g2.gridwidth=1;
//		panelBotton.add(new JLabel("      "), g2);
//		g2.gridx = 5;
//		g2.gridwidth=1;
//		panelBotton.add(new JLabel("  "), g2);
		
		g2.gridy = 5;
		g2.gridx = 0;
		g2.gridwidth=1;
		g2.gridheight=1;
		panelBotton.add(new JLabel("产品:"), g2);
		
		g2.gridx = 1;
		g2.gridwidth=3;
		panelBotton.add(ysr8_Product, g2);
		
		g2.gridx = 4;
		g2.gridwidth=1;
//		g2.gridheight=1;
		panelBotton.add(new JLabel("用途:"), g2);
		
		g2.gridx = 5;
		g2.gridwidth=6;
		panelBotton.add(ysr8_use, g2);
		
		g2.gridy = 6;
		g2.gridx = 0;
		g2.gridwidth=1;
		panelBotton.add(new JLabel("可能性:"), g2);
		
		g2.gridx = 1;
		g2.gridwidth=2;
		panelBotton.add(ysr8_Possibility, g2);

		g2.gridx = 3;
		g2.gridwidth=1;
		panelBotton.add(new JLabel("%      "), g2);
		g2.gridx = 4;
		g2.gridwidth=1;
		panelBotton.add(new JLabel("预计启动时间:"), g2);

		g2.gridx = 5;
		g2.gridwidth=6;
		panelBotton.add(ysr8_EstimatedDate, g2);
		
		g2.gridy = 7;
		g2.gridx = 0;
		g2.gridwidth=1;
		panelBotton.add(new JLabel("报价金额(RMB/元):"), g2);
		
		g2.gridx = 1;
		g2.gridwidth=3;
		panelBotton.add(ysr8_OfferAmount, g2);
		
		g2.gridx = 4;
		g2.gridwidth=1;
		panelBotton.add(new JLabel("完成时间:"), g2);

		g2.gridx = 5;
		g2.gridwidth=6;
		panelBotton.add(ysr8_FinishedDate, g2);
//		panelBotton.setBackground(Color.WHITE);
		
		g2.gridy = 8;
		g2.gridx = 0;
		g2.gridwidth=1;
		panelBotton.add(new JLabel("备注:"), g2);//TODO 备注
		
		g2.gridx = 1;
		g2.gridwidth=5;
		g2.gridheight=2;
		panelBotton.add(ysr8_QuotationRemarks, g2);
		
		
		GridBagConstraints g = new GridBagConstraints();
		g.insets = new Insets(5, 5, 5, 5);
		g.anchor = GridBagConstraints.WEST;
		g.fill = GridBagConstraints.BOTH;
		g.gridx=0;
		g.gridy=0;
		g.weightx=0;
		g.weighty=0;
		g.gridwidth=2;
		paneMain.add( paneTop,g);
		g.gridx=1;
		g.weightx=1;
		paneMain.add(new JLabel(""),g);
		g.weightx=0;
		
		
		g.gridx=0;
		g.gridy++;
		paneMain.add( paneCenter,g);
		g.gridy++;
		/*JSeparator jSep = new JSeparator();
		jSep.setOrientation(JSeparator.HORIZONTAL);
		paneMain.add("3.1.left.center", jSep );*/
		paneMain.add( panelBotton,g);
		g.gridy++;
		g.gridwidth=1;
		paneMain.add(jBPM,g);
		g.gridy++;
		g.weighty=1;
		paneMain.add(new JLabel(""),g);
		
		jBPM.addActionListener(new ActionListener(){

			@Override
			public void actionPerformed(ActionEvent arg0) {
				try {
					final String urlStr = componentForm.getProperty("ysr8_BPMURL_BJWT");
					if(urlStr != null && !urlStr.equals("")){
//						String str = "cmd /c start iexplore "+urlStr;
					    try {
				            URI uri = new URI(urlStr);  
				            Desktop.getDesktop().browse(uri);  
					    } catch (Exception e) {
					        e.printStackTrace();
					    }
//						IWorkbenchWindow localIWorkbenchWindow = AIFUtility.getActiveDesktop().getDesktopWindow();
//						final IWorkbenchPage workbenchpage = localIWorkbenchWindow.getActivePage();
//						final BrowserView viewDK = (BrowserView)workbenchpage.findView("com.teamcenter.rac.aifrcp.BrowserView");
//						if(viewDK == null){
//							Display.getDefault().syncExec(new Runnable() {   
//								public void run() {   
//									try {
//										((BrowserView) workbenchpage.showView("com.teamcenter.rac.aifrcp.BrowserView")).setUrl(urlStr);
////											viewDK.setUrl(urlStr);
//										} catch (PartInitException e) {
//											e.printStackTrace();
//										}
//									}   
//								}); 
//						}else{
//							Display.getDefault().syncExec(new Runnable() {
//
//								@Override
//								public void run() {
//									viewDK.setUrl(urlStr);
//								} 
//								
//							});
//						}
					}
				} catch (TCException e1) {
					e1.printStackTrace();
				}
			}
		});
		
		try {
			AIFComponentContext[] YSR8_QuotationRevisions = componentForm.whereReferencedByTypeRelation(new String[] {"YSR8_QuotationRevision"}, new String[] {"IMAN_master_form"});
			if(YSR8_QuotationRevisions != null){
				ItemID.setText(YSR8_QuotationRevisions[0].getComponent().getProperty("item_id"));
			}
		} catch (TCException e) {
			e.printStackTrace();
		} catch (Exception e) {
			e.printStackTrace();
		}
		
		JScrollPane scPanel = new JScrollPane();
		scPanel.setViewportView(paneMain);
		setLayout(new BorderLayout());
		add(BorderLayout.CENTER, scPanel);
		
	}
	private void addUIComponents() {
		
		ItemID = new iTextField();
		ItemID.setEditable(false);
		ItemID.setEnabled(false);
		ysr8_Sales = new iTextField();
		ysr8_Sales.setEditable(false);
		ysr8_Sales.setEnabled(false);
		ysr8_OrderManufacturer = new iTextField();
		ysr8_OrderManufacturer.setEditable(false);
		ysr8_OrderManufacturer.setEnabled(false);
		ysr8_CustomerName = new iTextField();
		ysr8_CustomerName.setEditable(false);
		ysr8_CustomerName.setEnabled(false);
		ysr8_QuotationLevel = new iTextField(9);
		ysr8_QuotationLevel.setEditable(false);
		ysr8_QuotationLevel.setEnabled(false);
		ysr8_Contact = new iTextField();
		ysr8_Contact.setEditable(false);
		ysr8_Contact.setEnabled(false);
		ysr8_ContactDept = new iTextField(9);
		ysr8_ContactDept.setEditable(false);
		ysr8_ContactDept.setEnabled(false);
		ysr8_ContactPosition = new iTextField();
		ysr8_ContactPosition.setEditable(false);
		ysr8_ContactPosition.setEnabled(false);
		ysr8_ContactPhone = new iTextField();
		ysr8_ContactPhone.setEditable(false);
		ysr8_ContactPhone.setEnabled(false);
		
		ysr8_ProjectManager = new iTextField(20);
		ysr8_ProjectManager.setEditable(false);
		ysr8_ProjectManager.setEnabled(false);
		ysr8_Ratio = new iTextField();
		ysr8_Ratio.setEditable(true);
		ysr8_Ratio.setEnabled(true);
//		ysr8_ProjectLevel = new iTextField(40);
		lovMap.put("ysr8_ProjectLevel", getLOV("ysr8_Qutation_LOV"));
		String[] ysr8_Qutation_LOV = new String[lovMap.get("ysr8_ProjectLevel").size()];
		int i = 0;
		for(String v :  lovMap.get("ysr8_ProjectLevel").keySet()) {
			ysr8_Qutation_LOV[i] = v;
			i++;
		}
		ysr8_ProjectLevel = new JComboBox<String>(ysr8_Qutation_LOV);
		ysr8_ProjectLevel.setPreferredSize(new Dimension(233, 23));
//		lovMap.put("ysr8_ProjectLevel", getLOV("ysr8_Qutation_LOV"));
		
//		lovMap.put("ysr8_QuotationState", getLOV("ysr8_Qutation2_LOV"));
//		ysr8_Qutation2_LOV = new String[lovMap.get("ysr8_QuotationState").size()];
//		i = 0;
//		for(String v :  lovMap.get("ysr8_QuotationState").values()) {
//			ysr8_Qutation2_LOV[i] = v;
//			i++;
//		}
//		ysr8_QuotationState = new JComboBox<String>(ysr8_Qutation2_LOV);
//		ysr8_QuotationState.setPreferredSize(new Dimension(100, 23));
		int g1 = 22;
		ysr8_SytemName = new iTextField(g1);
//		ysr8_SytemName.setBackground(Color.WHITE);
		ysr8_EstimatedDate = new DateButton(null, "yyyy-MM-dd", false, false, false);
		ysr8_Possibility = new iTextField(12);
//		ysr8_Possibility.setBackground(Color.WHITE);
//		ysr8_ProjectDes = new iTextField(31);
		String[] ysr8_QuotationStatus_lov = session.getPreferenceService().getStringValues("ysr8_QuotationStatus_lov");
		String[] ysr8_QuotationStatus_lov1 = new String[ysr8_QuotationStatus_lov.length+1];
		ysr8_QuotationStatus_lov1[0] = "";
		for(int i1=1; i1<ysr8_QuotationStatus_lov1.length; i1++) {
			ysr8_QuotationStatus_lov1[i1] = ysr8_QuotationStatus_lov[i1-1];
		}
		ysr8_QuotationStatus = new JComboBox<String>(ysr8_QuotationStatus_lov1);
		try {
			String ysr8_QuotationStatusVal = componentForm.getProperty("ysr8_QuotationStatus");
			System.out.println("ysr8_QuotationStatusVal:"+ysr8_QuotationStatusVal);
			ysr8_QuotationStatus.setSelectedItem(ysr8_QuotationStatusVal);
		} catch (TCException e) {
			e.printStackTrace();
		}
		ysr8_QuotationStatus.setPreferredSize(new Dimension(208, 23));
		ysr8_QuotationStatus.setEditable(true);
		ysr8_QuotationStatus.setEnabled(true);

		lovMap.put("ysr8_Product", getLOV("ysr8_Product_LOV"));
		String[] ysr8_Product_LOV = new String[lovMap.get("ysr8_Product").size()];
		i = 0;
		for(String v :  lovMap.get("ysr8_Product").keySet()) {
			ysr8_Product_LOV[i] = v;
			i++;
		}
		ysr8_Product = new JComboBox<String>(ysr8_Product_LOV);
		ysr8_Product.setPreferredSize(new Dimension(208, 23));

		lovMap.put("ysr8_use", getLOV("ysr8_Use_LOV"));
		String[] ysr8_Use_LOV = new String[lovMap.get("ysr8_use").size()];
		i = 0;
		for(String v :  lovMap.get("ysr8_use").keySet()) {
			ysr8_Use_LOV[i] = v;
			i++;
		}
		ysr8_use = new JComboBox<String>(ysr8_Use_LOV);
		ysr8_use.setPreferredSize(new Dimension(208, 23));
		
		ysr8_RequestedDate = newDateButton();
		ysr8_SysPlanDate = new DateButton(null, "yyyy-MM-dd", false, false, false);
		ysr8_ReceiveDate = newDateButton();
//		ysr8_FinishedDate = new DateButton(null, "yyyy-MM-dd", false, false, false);
		ysr8_FinishedDate = newDateButton();
		
		ysr8_OfferAmount = new iTextField(g1);
		ysr8_OfferAmount.setEditable(false);
		ysr8_OfferAmount.setEnabled(false);
//		ysr8_OfferAmount.setBackground(Color.WHITE);
		ysr8_RobotModelAndNum = new JTextArea(5, 26);
//		ysr8_RobotModelAndNum = new iTextArea();
		ysr8_RobotModelAndNum.setRows(3);
		ysr8_RobotModelAndNum.setBorder(BorderFactory.createLoweredBevelBorder());
		ysr8_RobotModelAndNum.setLineWrap(true);
		ysr8_RobotModelAndNum.setWrapStyleWord(true);
		ysr8_RobotModelAndNum.setOpaque(true);
//		ysr8_RobotModelAndNum.setBackground(ysr8_Ratio.getBackground());
//		System.out.println("Color:"+ysr8_Ratio.getBackground());
		ysr8_QuotationRemarks = new JTextArea(5, 60);//TODO
		ysr8_QuotationRemarks.setRows(3);
		ysr8_QuotationRemarks.setBorder(BorderFactory.createLoweredBevelBorder());
		ysr8_QuotationRemarks.setLineWrap(true);
		ysr8_QuotationRemarks.setWrapStyleWord(true);
		ysr8_QuotationRemarks.setOpaque(true);
		
		allComponents.add( ysr8_Sales );
		allComponents.add( ysr8_OrderManufacturer );
		allComponents.add( ysr8_CustomerName );
		allComponents.add( ysr8_QuotationLevel );
		allComponents.add( ysr8_Contact );
		allComponents.add( ysr8_ContactDept );
		allComponents.add( ysr8_ContactPosition );
		allComponents.add( ysr8_ContactPhone );
		allComponents.add( ysr8_ProjectManager );
		allComponents.add( ysr8_Ratio );
		allComponents.add( ysr8_ProjectLevel );
//		allComponents.add( ysr8_QuotationState );
		allComponents.add( ysr8_SytemName );
		allComponents.add( ysr8_RequestedDate );
		allComponents.add( ysr8_SysPlanDate );
		allComponents.add( ysr8_ReceiveDate );
		allComponents.add( ysr8_FinishedDate );
		allComponents.add( ysr8_OfferAmount );
		allComponents.add( ysr8_RobotModelAndNum );
//		allComponents.add( ysr8_QuotationRemarks );
//		allComponents.add( ysr8_QuotationStatus );
//		allComponents.add( ysr8_EstimatedDate );
//		allComponents.add( ysr8_Possibility );
		allComponents.add( ysr8_Product );
		allComponents.add( ysr8_use );
	}
	
	private void setName() {
		ysr8_Sales.setName("ysr8_Sales");
		ysr8_OrderManufacturer.setName("ysr8_OrderManufacturer");
		ysr8_CustomerName.setName("ysr8_CustomerName");
		ysr8_QuotationLevel.setName("ysr8_QuotationLevel");
		ysr8_Contact.setName("ysr8_Contact");
		ysr8_ContactDept.setName("ysr8_ContactDept");
		ysr8_ContactPosition.setName("ysr8_ContactPosition");
		ysr8_ContactPhone.setName("ysr8_ContactPhone");
		ysr8_ProjectManager.setName("ysr8_ProjectManager");
		ysr8_Ratio.setName("ysr8_Ratio");
		ysr8_ProjectLevel.setName("ysr8_ProjectLevel");
//		ysr8_QuotationState.setName("ysr8_QuotationState");
		ysr8_SytemName.setName("ysr8_SytemName");
		ysr8_RequestedDate.setName("ysr8_RequestedDate");
		ysr8_SysPlanDate.setName("ysr8_SysPlanDate");
		ysr8_ReceiveDate.setName("ysr8_ReceiveDate");
		ysr8_FinishedDate.setName("ysr8_FinishedDate");
		ysr8_OfferAmount.setName("ysr8_OfferAmount");
		ysr8_RobotModelAndNum.setName("ysr8_RobotModelAndNum");
		

		ysr8_QuotationStatus.setName("ysr8_QuotationStatus");
		ysr8_EstimatedDate.setName("ysr8_EstimatedDate");
		ysr8_Possibility.setName("ysr8_Possibility");
		ysr8_QuotationRemarks.setName("ysr8_QuotationRemarks");
		ysr8_Product.setName("ysr8_Product");
		ysr8_use.setName("ysr8_use");
	}
	
	@Override
	public void loadRendering() throws TCException {
		System.out.println("loadForm------------------------start");
		try {
			this.formProperties = componentForm.getAllFormProperties();
			int length = this.formProperties.length;
			int pSize = allComponents.size();
			for (int k = 0; k < length; ++k) {
				String propName = this.formProperties[k].getPropertyName().trim();
				for (int i = 0; i < pSize; i++) {
					Component component = allComponents.get(i);
					String name = component.getName();
					if (name.equals("ysr8_OfferAmount")) {//lidy20181108报价金额增加千位分隔符 
						iTextField textField = (iTextField) component;
						if (propName.equalsIgnoreCase(name)) {
							DecimalFormat df = new DecimalFormat(",###,###");
							try {
								Double OfferAmount = new Double(this.formProperties[k].getStringValue());
								textField.setText(df.format(OfferAmount));
							} catch(NumberFormatException e) {
								textField.setText(this.formProperties[k].getStringValue());
							}
							indices.put(formProperties[k], textField);
							break;
						}
					} else 
					if (component instanceof iTextField) {
						iTextField textField = (iTextField) component;
						if (propName.equalsIgnoreCase(name)) {
							textField.setText(this.formProperties[k].getStringValue());
							indices.put(formProperties[k], textField);
							break;
						}
					} else if (component instanceof JComboBox) {
						@SuppressWarnings("rawtypes")
						JComboBox combox = (JComboBox) component;
						if (propName.equalsIgnoreCase(name)) {
//							combox.setSelectedItem(this.formProperties[k].getStringValue());
							System.out.println(component.getName());
							combox.setSelectedItem(componentForm.getProperty(component.getName()));
							indices.put(formProperties[k], combox);
							break;
						}
//					} else if (component instanceof LOVComboBox) {
//						LOVComboBox combox = (LOVComboBox) component;
//						if (propName.equalsIgnoreCase(name)) {
//							combox.setSelectedItem(this.formProperties[k].getStringValue());
////							combox.setSelectedItem(lovMap.get(component.getName()).get(this.formProperties[k].getStringValue()));
//							indices.put(formProperties[k], combox);
//							break;
//						}
					} else if(component instanceof DateButton){
						DateButton btn = (DateButton) component;
						if(propName.equalsIgnoreCase(name)){
							btn.setDate(formProperties[k].getDateValue());
							indices.put(formProperties[k], btn);
							break;
						}
					}else if (component instanceof JTextArea) {
						JTextArea textArea = (JTextArea) component;
						if (propName.equalsIgnoreCase(name)) {
							textArea.setText(formProperties[k].getStringValue());
							indices.put(formProperties[k], textArea);
							break;
						}
					} 
				}
			}
			ysr8_FinishedDate.setDate(componentForm.getDateProperty("ysr8_FinishedDate"));
			
			ysr8_QuotationStatus.setSelectedItem(componentItem.getProperty("ysr8_QuotationStatus"));
			ysr8_EstimatedDate.setDate(componentItem.getDateProperty("ysr8_EstimatedDate"));
			ysr8_Possibility.setText(componentItem.getProperty("ysr8_Possibility"));
			ysr8_QuotationRemarks.setText(componentItem.getProperty("ysr8_QuotationRemarks"));
		} catch (Exception imanexception) {
			throw imanexception;
		}
		if (this.formProperties == null) {
			Registry registry = Registry.getRegistry(this);
			throw new TCException(registry.getString("failedLoadingFormProperties"));
		}
	}

	@Override
	public void saveRendering() {
		FileWriter fos = null;
		try {
			SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
			String out = System.getProperty("java.io.tmpdir")+"\\报价日志.txt";//"+sdf.format(new Date())+"
			File htmlfile = new File(out);
			if(htmlfile.exists())
				htmlfile.delete();
			htmlfile.createNewFile();
			fos = new FileWriter(htmlfile);
			fos.write(sdf.format(new Date()) +" saveRendering start\r\n\r\n");
			
			Enumeration<TCFormProperty> enumeration = this.indices.keys();
			Enumeration<JComponent> enumeration1 = this.indices.elements();
			TCFormProperty[] aimanformproperty = new TCFormProperty[this.indices.size()];
			
			for (int i = 0; enumeration.hasMoreElements(); i++) {
				TCFormProperty imanformproperty = (TCFormProperty) enumeration.nextElement();
				Object component = enumeration1.nextElement();
				String propName = imanformproperty.getPropertyName();
				fos.write(sdf.format(new Date()) +" propName:"+propName+"\r\n\r\n");
				if (propName.equals("ysr8_OfferAmount")) {//lidy20181108报价金额增加千位分隔符 
					String strTempValue = ((iTextField) component).getText().toString();
					setStringToPropertyValue(imanformproperty, strTempValue.replace(",", ""));
				} else if (component instanceof iTextField) {
					String strTempValue = ((iTextField) component).getText().toString();
					setStringToPropertyValue(imanformproperty, strTempValue);
				} else if (component instanceof JComboBox) {
					//kk 0813  不选时的空引用异常
					@SuppressWarnings("rawtypes")
					Object sItem = ((JComboBox) component).getSelectedItem();
//					String strTempValue = "";
					String strTempValue = sItem==null?"":sItem.toString();
//					componentForm.setProperty(propName, strTempValue);
//					for(Map.Entry<Object, String> lovEntry : lovMap.get(((Component) component).getName()).entrySet()) {
//						if(lovEntry.getValue().equals(sItem.toString())) {
//							strTempValue = lovEntry.getKey().toString();
//							break;
//						}
//					}
//					String strTempValue = sItem==null?"":sItem.toString();propName
					if(lovMap.containsKey(propName)) {
						System.out.println("lovMap:"+strTempValue+"~~"+lovMap.get(propName));
						fos.write(sdf.format(new Date()) +" "+propName+"=="+strTempValue+"~~"+lovMap.get(propName)+"\r\n\r\n");
						setStringToPropertyValue(imanformproperty, lovMap.get(propName).get(strTempValue));
					}else
						setStringToPropertyValue(imanformproperty, strTempValue);
//				} else if (component instanceof LOVComboBox) {
//					//kk 0813  不选时的空引用异常
//					Object sItem = ((LOVComboBox) component).getSelectedItem();
//					String strTempValue = sItem==null?"":sItem.toString();
//					setStringToPropertyValue(imanformproperty,strTempValue);
				} else if (component instanceof DateButton) {
					DateButton btn = (DateButton) component;
					if (btn.getDate() != null) {
						imanformproperty.setDateValue(btn.getDate());
					} else {
						imanformproperty.setDateValue(null);
					}
				} else if (component instanceof JTextArea) {
					setStringToPropertyValue(imanformproperty,((JTextArea) component).getText().toString());
				} 
				aimanformproperty[i] = imanformproperty;
			}
			System.out.println("设置Item属性:"+componentItem);
			//  lidy20181030设置Item属性
//			TCUserService userservice = session.getUserService();
//			Object[] obj = new Object[2];
//			obj[0] = "Set_ByPass";
//			obj[1] = "true";
//			userservice.call("YSR8UserService", obj);
////			System.out.println("result:"+result);
//			componentItem.lock();
//			componentItem.setStringProperty("ysr8_QuotationStatus", ysr8_QuotationStatus.getSelectedItem().toString());
//			componentItem.setDateProperty("ysr8_EstimatedDate", ysr8_EstimatedDate.getDate());
//			componentItem.setStringProperty("ysr8_Possibility", ysr8_Possibility.getText());
			String params = "", proName = "", ysr8_EstimatedDateVal = "";
			StringBuilder proVal = new StringBuilder("");//TODO
    		proName = "ysr8_EstimatedDate@@@@ysr8_Possibility@@@@ysr8_QuotationStatus@@@@ysr8_QuotationRemarks";
    		ysr8_EstimatedDateVal = ysr8_EstimatedDate.getDate()==null?"":String.format("%tF", ysr8_EstimatedDate.getDate());
    		proVal.append(ysr8_EstimatedDateVal).append("@@@@").append(ysr8_Possibility.getText()).append("@@@@");
    		proVal.append(ysr8_QuotationStatus.getSelectedItem().toString()).append("@@@@").append(ysr8_QuotationRemarks.getText());
		    params = componentItem.getUid() + "^^^^" + proName + "^^^^" + proVal.toString();
			String cmd = "Update_Item_TCProperty";
			Object[] objParams = new Object[2];
			objParams[0] = cmd;
			objParams[1] = params;
			TCUserService userService = session.getUserService();
			String result = (String) userService.call("YSR8UserService", objParams);
			System.out.println("更新Item属性："+result);
//			componentItem.save();
//			componentItem.unlock();
//			obj[1] = "false";
//			userservice.call("YSR8UserService", obj);

			try {
				componentForm.setTCProperties(aimanformproperty);
			}
			catch (Exception exception) {
				exception.printStackTrace();
				MessageBox.post(exception);
			}
		} catch (Exception imane) {
			imane.printStackTrace();
		}finally {
			if(fos!=null)
				try {
					fos.close();
				} catch (Exception e) {
					e.printStackTrace();
				}
		}
	}

	@SuppressWarnings("rawtypes")
	public boolean isRenderingModified() {
		Enumeration<TCFormProperty> enumeration = this.indices.keys();
		Enumeration<JComponent> enumeration1 = this.indices.elements();
		for (; enumeration.hasMoreElements(); ) {
			TCFormProperty imanformproperty = (TCFormProperty) enumeration.nextElement();
			Object component = enumeration1.nextElement();
//			String propName = imanformproperty.getPropertyName();
			if (imanformproperty.getName().equals("ysr8_OfferAmount")) {//lidy20181108报价金额增加千位分隔符 
				String strTempValue = ((iTextField) component).getText().toString();
				if(!imanformproperty.getStringValue().equals(strTempValue.replace(",", ""))){
					return true;
				}
			} else 
			if (component instanceof iTextField) {
				String strTempValue = ((iTextField) component).getText().toString();
				if(!imanformproperty.getStringValue().equals(strTempValue)){
					return true;
				}
			} else if (component instanceof JComboBox) {
				Object sItem = ((JComboBox) component).getSelectedItem();
				String strTempValue = sItem==null?"":sItem.toString();
//				System.out.println(strTempValue+"::"+imanformproperty.getStringValue()+"::"+map.get(imanformproperty.getStringValue()));
				try{
					if(!strTempValue.equals(componentForm.getProperty(((JComboBox)component).getName()))){
						return true;
					}
				} catch(TCException e) {
					e.printStackTrace();
				}
//			} else if (component instanceof LOVComboBox) {
//				//kk 0809  不选时的空引用异常
//				Object sItem = ((LOVComboBox) component).getSelectedItem();
//				String strTempValue = sItem==null?"":sItem.toString();
//				if(!imanformproperty.getStringValue().equals(strTempValue)){
//					return true;
//				}
			} else if (component instanceof DateButton) {
				DateButton btn = (DateButton) component;
				if(imanformproperty.getDateValue() != null && btn.getDate() != null){
					if(imanformproperty.getDateValue().getTime() != btn.getDate().getTime()){
						return true;
					}
				}else if(imanformproperty.getDateValue() != null && btn.getDate() == null){
					return true;
				}else if(imanformproperty.getDateValue() == null && btn.getDate() != null){
					return true;
				}
			} else if (component instanceof JTextArea) {
				String strTempValue = ((JTextArea) component).getText().toString();
				if (!imanformproperty.getStringValue().equals(strTempValue)) {
					return true;
				}
			}

			try {
				String sItem = ysr8_QuotationStatus.getSelectedItem().toString();
				if(!componentItem.getProperty("ysr8_QuotationStatus").equals(sItem)) {
//					System.out.println("ysr8_QuotationStatus");
					return true;
				}
				if(ysr8_EstimatedDate.getDate() != null && componentItem.getDateProperty("ysr8_EstimatedDate") != null){
					if(ysr8_EstimatedDate.getDate().getTime()!=(componentItem.getDateProperty("ysr8_EstimatedDate")).getTime()) {
						return true;
					}
				}else if(ysr8_EstimatedDate.getDate() == null && componentItem.getDateProperty("ysr8_EstimatedDate") != null){
					return true;
				}else if(ysr8_EstimatedDate.getDate() != null && componentItem.getDateProperty("ysr8_EstimatedDate") == null){
					return true;
				}
				if(!ysr8_Possibility.getText().equals(componentItem.getProperty("ysr8_Possibility"))) {
					return true;
				}
				if(!ysr8_QuotationRemarks.getText().equals(componentItem.getProperty("ysr8_QuotationRemarks"))) {
					return true;
				}
			} catch (TCException e) {
				e.printStackTrace();
			}
		}
		return false;
	}
	
	public void setRenderingReadOnly()
    {
		setModifiableComponents(this, false);
        if(getController() != null)
            getController().setFormReadOnly();
        jBPM.setEnabled(true);
        if(jBPM.getParent() != null)
        	jBPM.getParent().setEnabled(true);
        if(jBPM.getParent().getParent() != null)
        	jBPM.getParent().getParent().setEnabled(true);
    }

    public void setRenderingReadWrite()
    {
    	setModifiableComponents(this, true);
    	jBPM.setEnabled(true);
    }
    
    private void setModifiableComponents(java.awt.Component component1, boolean flag)
    {
        if(component1 == null)
            return;
        boolean flag1 = flag;
        if(flag && (component1 instanceof PropertyComment))
            flag1 = ((PropertyComment)component1).isLabelEditable();
        else
        if(flag && (component1 instanceof InterfacePropertyComponent))
        {
            String s = ((InterfacePropertyComponent)component1).getProperty();
            try
            {
                TCPropertyDescriptor tcpropertydescriptor = typeComponent.getPropertyDescriptor(s);
                if(tcpropertydescriptor != null)
                {
                    flag1 = tcpropertydescriptor.isEnabled();
                    if(component != null)
                    {
                        TCProperty tcproperty = component.getTCProperty(s);
                        boolean flag3 = tcproperty.isEnabled();
                        flag1 = flag3;
                    }
                    if(isConditionalFieldBehaviorEnabled() && FormFieldManager.isCustomizationEnabled())
                    {
                        boolean flag2 = WidgetTypeAdapter.isInterfacePropertyComponentEnabled((InterfacePropertyComponent)component1);
                        flag1 = flag1 && flag2;
                    }
                }
            }
            catch(TCException tcexception)
            {
                Logger.getLogger("com.teamcenter.rac.stylesheet.AbstractRendering").info(tcexception.getLocalizedMessage());
            }
        }
        if(!(component1 instanceof JTabbedPane) && !(component1 instanceof JSplitPane) && !(component1 instanceof JPanel) && !(component1 instanceof JLabel) && !(component1 instanceof JScrollPane) && !(component1 instanceof JViewport) && !(component1 instanceof JProgressBar) && !(component1 instanceof JTableHeader))
            if(component1 instanceof JTextComponent)
                ((JTextComponent)component1).setEditable(flag1);
            else
                component1.setEnabled(flag1);
        if(component1 instanceof InterfaceRendererEvent)
            if(flag1)
                ((InterfaceRendererEvent)component1).setReadWrite();
            else
                ((InterfaceRendererEvent)component1).setReadOnly();
        if(component1 instanceof PropertyArray)
            ((PropertyArray)component1).setModifiable(flag1);
        else
        if(component1 instanceof PropertyObjectLink)
            ((PropertyObjectLink)component1).setModifiable(flag1);
        else
        if(component1 instanceof PropertyLogicalPanel)
            ((PropertyLogicalPanel)component1).setModifiable(flag1);
        else
        if(component1 instanceof AbstractPropertyComponent)
            ((AbstractPropertyComponent)component1).setModifiable(flag1);
        else
        if(component1 instanceof JScrollPane)
        {
            JScrollPane jscrollpane = (JScrollPane)component1;
            java.awt.Component component2 = jscrollpane.getCorner("LOWER_LEFT_CORNER");
            if(component2 != null)
                setModifiableComponents(component2, flag1);
            component2 = jscrollpane.getCorner("LOWER_RIGHT_CORNER");
            if(component2 != null)
                setModifiableComponents(component2, flag1);
            component2 = jscrollpane.getCorner("UPPER_LEFT_CORNER");
            if(component2 != null)
                setModifiableComponents(component2, flag1);
            component2 = jscrollpane.getCorner("UPPER_RIGHT_CORNER");
            if(component2 != null)
                setModifiableComponents(component2, flag1);
            setModifiableComponents(((java.awt.Component) (jscrollpane.getViewport())), flag1);
        } else
        if(component1 instanceof java.awt.Container)
        {
            java.awt.Component acomponent[] = ((java.awt.Container)component1).getComponents();
            if(acomponent != null)
            {
                for(int i = 0; i < acomponent.length; i++)
                    setModifiableComponents(acomponent[i], flag1);

            }
        }
    }
    @SuppressWarnings( "serial" )
	private DateButton newDateButton() {
//		DateButton db = new PropertyDateButton() {
		DateButton db = new DateButton(null, "yyyy-MM-dd", false, false, false) {
			@Override
			public void setEnabled(boolean f) {
				super.setEnabled(false);
			}
		};
		return db;
	}
    private LinkedHashMap<String, String> getLOV(String lovName){
    	LinkedHashMap<String, String> lovValue = new LinkedHashMap<>();
    	lovValue.put("", "");
    	TCComponentListOfValuesType lovType;
    	try {
			lovType = (TCComponentListOfValuesType)session.getTypeComponent("ListOfValues");
			TCComponentListOfValues[] lov = lovType.find(lovName);
			if(lov.length==0) {
		    	return lovValue;
			}
			ListOfValuesInfo lovInfo = lov[0].getListOfValues();
			Object[] v1 = lovInfo.getListOfValues();
			String[] v2 = lovInfo.getLOVDisplayValues();
			for(int i=0; i<v1.length; i++) {
				lovValue.put(v2[i], v1[i].toString());
			}
//			Map<Object, String> map = lovInfo.getValueTable();
//			for(Object k : map.keySet()) {
//				lovValue.put(k.toString(), map.get(k));
//			}
		} catch (Exception e) {
			e.printStackTrace();
		}
    	return lovValue;
    }
	
}
