zoukankan      html  css  js  c++  java
  • TC设置LOV属性

    TCProperty property = item.getLatestItemRevision().getTCProperty("xxx_lll_xxx");
    String lovTrueValueByDisplayValue1 = LOVUtil.getInstance().getLOVValueByDisplayValue(property.getLOV(), "组内");
    LOVUtil.getInstance().setStringTCLOVProperty(property,lovTrueValueByDisplayValue1);
    
    public String getLOVValueByDisplayValue(TCComponentListOfValues lov, Object object) {
    		if (lov == null) {
    			return "";
    		}
    		try {
    			TCComponentListOfValues[] childs = lov.getListOfFilters();
    			for (int i = 0; i < childs.length; i++) {
    				try {
    					if (childs[i] == null) {
    						continue;
    					}
    					String tmp = getLOVValueByDisplayValue(childs[i], object);
    					if (StringUtils.isNotEmpty(tmp)) {
    						return tmp;
    					}
    				} catch (Exception e) {
    					e.printStackTrace();
    				}
    			}
    			// 取LOV所有值与属性
    			ListOfValuesInfo valuesInfo = lov.getListOfValues(true);
    			Object[] values = valuesInfo.getListOfValues();
    			// String[] descriptions = valuesInfo.getDescriptions();
    			// 取值对应的属性
    			for (int i = 0; i < values.length; i++) {
    				if (valuesInfo.getDisplayableValue(values[i]).equals(object)) {
    					return values[i].toString();
    				}
    			}
    		} catch (Exception tce) {
    			tce.printStackTrace();
    			return "";
    		}
    		return "";
    	}
    
    public void setStringTCLOVProperty(TCProperty property,String value) {
    		try {
    			if(property.getLOV() != null) {
    				int type = property.getPropertyType();
    				String lovTrueValueByDisplayValue = LOVUtil.getInstance().getLOVValueByDisplayValue(property.getLOV(), value); //
    				if(lovTrueValueByDisplayValue != null) {
    					if(TCProperty.PROP_int == type) {
    						if(lovTrueValueByDisplayValue.trim().length() > 0){
    							int intValue = Integer.parseInt(lovTrueValueByDisplayValue);
    							property.setIntValue(intValue);
    						}else {
    							property.setNullVerdict(true);
    						}
    					}else if(TCProperty.PROP_double == type) {
    						if(lovTrueValueByDisplayValue.trim().length() > 0){
    							double doubleValue = Double.parseDouble(lovTrueValueByDisplayValue);
    							property.setDoubleValue(doubleValue);
    						}else {
    							property.setNullVerdict(true);
    						}
    					}else if(TCProperty.PROP_string == type) {
    						property.setStringValue(value);
    					}else {
    						property.setStringValue(value);
    					}
    				}
    			}
    		}catch (TCException e) {
    			e.printStackTrace();
    		}
    	}
  • 相关阅读:
    报表容器元素的典型用途:保持位置关系+表角斜线
    如何在Wyn仪表板中实现文件下载
    报表表格中的迷你图
    怎么实现固定行数的表格类报表
    如何把自己设计好的仪表板分享给别人?
    报表中的【子弹图】实现方法
    来自不同数据集的图表如何设置联动
    仪表板图表条件格式化设置
    报表中的数据格式设置方法汇总
    仪表板数据表根据用户需求可以自由选择查看的数据列
  • 原文地址:https://www.cnblogs.com/wwssgg/p/15464370.html
Copyright © 2011-2022 走看看