zoukankan      html  css  js  c++  java
  • BOS中控件非空 非0校验

     protected void verifyInput(ActionEvent arg0) throws Exception {
    		    	super.verifyInput(arg0);
    		    	//非空校验
    		    	HashMap<String, Object> verifyNullMap=new HashMap();
    		    	verifyNullMap.put("库存组织", prmtStorageOrgUnit);
    		    	verifyNullMap.put("工程类别", prmtProjectType);
    		    	verifyNullMap.put("设计量", txtDesignQty);
    		    	verifyNullMap.put("计量类型", comboMeasureType);	
    		    	String [] strTmp=verifyNullMap.keySet().toArray(new String[verifyNullMap.size()]);
    		    	for(int i=verifyNullMap.size()-1;i>=0;i--)
    		    		CanNotNull(verifyNullMap.get(strTmp[i]),strTmp[i]);
    		    	//非0校验 可为空
    		    	HashMap<String, Object> verifyZeroMap=new HashMap();
    		    	verifyZeroMap.put("设计量", txtDesignQty);
    		    	String [] strZeroTmp=verifyZeroMap.keySet().toArray(new String[verifyZeroMap.size()]);
    		    	for(int i=verifyZeroMap.size()-1;i>=0;i--)
    		    		CanNotZero(verifyZeroMap.get(strZeroTmp[i]),strZeroTmp[i]);
    		    	
    		    }
    		    //非空校验函数
    		    protected void CanNotNull(Object obj,String message)
    		    {	
    		    	if((obj instanceof KDBizPromptBox && ((KDBizPromptBox)obj).getValue()==null)||
    		    	   (obj instanceof KDComboBox && ((KDComboBox)obj).getSelectedItem()==null )||
    		    	   (obj instanceof KDFormattedTextField &&((KDFormattedTextField)obj).getValue()==null))
    		    	{
    		    		MsgBox.showInfo(message+"不能为空!");
    		    		((JComponent)obj).requestFocus();
    		    		abort();
    		    	}
    		    }
    		    //非0校验函数 可为空
    		    protected void CanNotZero(Object obj,String message)
    		    {
    		    	if(obj instanceof KDFormattedTextField && ((KDFormattedTextField)obj).getValue()!=null &&
    		    		(((KDFormattedTextField)obj).getBigDecimalValue().compareTo(BigDecimal.ZERO)==0))
    		    	{
    		    		MsgBox.showInfo(message+"值不能为  '0' !");
    		    		((JComponent)obj).requestFocus();
    		    		abort();
    		    	}
    		    }


  • 相关阅读:
    如何更改Linux yum源?
    Vsftp设置为PASV mode(被动模式传送)
    CentOS 6.5 yum安装配置lnmp服务器(Nginx+PHP+MySQL)
    centos6.3搭建FTP服务器图文教程
    Linux关闭/开启防火墙命令
    linux下火狐浏览器安装flash player插件
    判断网站织梦DedeCms版本的方法
    PHP获取当前url路径的函数及服务器变量
    leetcode 205 Isomorphic Strings
    leetcode 70 Climbing Stairs
  • 原文地址:https://www.cnblogs.com/fyq891014/p/3294821.html
Copyright © 2011-2022 走看看