public static StringBuffer makeConditionCtrl(SysQueryFieldBO bo, Object def_V) { StringBuffer sb = new StringBuffer(); if (def_V == null) { def_V = ""; } String ctrlType = bo.getCtrltype(); if (ctrlType == null) { sb.append(bo.getId().getColalias()).append("没有配置控件类型!"); return sb; } if ("none".equals(ctrlType)) { } else if ("text".equals(ctrlType)) { sb.append("<input type='text' name='").append(bo.getId().getColalias()).append("'"); sb.append(" value='").append(def_V).append("'"); sb.append(" value='").append(def_V).append("'"); int maxlength = bo.getCtrllen() == null ? DEFAULT_MAXLEN : bo.getCtrllen().intValue(); int width = 0; width = bo.getDisplen() == null ? DEFAULT_DISPLEN : bo.getDisplen().intValue(); width = width * FONTSIZE; width = width > MAX_DISPLEN ? MAX_DISPLEN : width; width = width < MIN_DISPLEN ? MIN_DISPLEN : width; sb.append(" maxlength='").append(maxlength).append("'"); sb.append(" style='width:").append(width).append("px;'"); sb.append("></input>"); } else if ("select".equals(ctrlType)) { sb.append("<select ").append("name='").append(bo.getId().getColalias()).append("'>"); sb.append(ControlUtil.makeOptionsByDict(bo.getCtrltype(), def_V.toString(), true)); sb.append("</select>"); } else { // TODO 其他控件,例如calender } return sb; }
private static Object makeTdWrapedSelect( String value, String ctrlname, String dictType, boolean nullable) { value = StringUtil.trim(value); StringBuffer ret = new StringBuffer(); ret.append("<td class='output'>"); ret.append("<select ").append("name='").append(ctrlname).append("'>"); ret.append(ControlUtil.makeOptionsByDict(dictType, value, nullable)); ret.append("</select>"); ret.append("</td>"); return ret; }