StringBuffer properties = new StringBuffer();
StringBuffer classes = new StringBuffer();
StringBuffer propertyTypes = new StringBuffer();
/* 下面输入用来浏览的数据字段 */
for (int i = 0; i < propertySize; i++) {
UserPropertyRight property = (UserPropertyRight) displayProperties
.get(i);
Integer width = property.getShowWidth();
if (width != null)
buffer.append("<td nowrap class=\"trTitle\" width='"
+ width +"%'align=\"center\">\n");
else
buffer.append("<td nowrap class=\"trTitle\" align=\"center\">\n");
buffer.append(property.getPropertyChiName() + "\n");
buffer.append("</td>\n");
properties.append(property.getPropertyName()).append(",");
propertyTypes.append(property.getType()).append(",");
if (GenericValidator.isBlankOrNull(property
.getPropertyValueTable()))
classes.append(",");
else {
classes.append(property.getPropertyValueTable())
.append(",");
/* 将需要显示的字段放到id字段的后面 */
properties.append(property.getShowProperty()).append(
",");
propertyTypes.append(property.getType()).append(",");
}
}
buffer.append("</tr>\n");
ArrayList dataList = (ArrayList) BeanUtil.getFieldValue(obj,
subClassProperty);
int dataSize = 0;
String subPrimaryKeyName = "";
if (dataList != null)
dataSize = dataList.size();
subPrimaryKeyName = (String) BeanUtil
.getPrimaryKeyName(BeanUtil.getClass(subClassName));
// buffer
// .append("<tr><td class=\"trContent\" colspan=\""
// + propertySize
// + "\" ><image src=\"image\\delete.gif\" id=\"check"
// + "\" onclick=\"UseCase.hiddenDetail(this)\" /><image src=\"image\\up.gif\" id=\"insertBefore"
// + "\" onclick=\"UseCase.insert('up','user')\" /><image src=\"image\\up.gif\" id=\"insertBeforeSys"
// + "\" onclick=\"UseCase.insert('up','sys')\" /><image src=\"image\\down.gif\" id=\"insertAfter"
// + "\" onclick=\"UseCase.insert('down','user')\" /><image src=\"image\\down.gif\" id=\"insertAfterSys"
// + "\" onclick=\"UseCase.insert('down','sys')\" /></td></tr>\n");
buffer
.append("<tr><td class=\"trContent\" colspan=\""
+ propertySize
+ "\" ><image src=\"image/delete.gif\" id=\"check"
+ "\" onclick=\"UseCase.hiddenDetail(this)\" /><image src=\"image/up.gif\" id=\"insertBefore"
+ "\" onclick=\"UseCase.insert('up','user')\" /><image src=\"image/up.gif\" id=\"insertBeforeSys"
+ "\" onclick=\"UseCase.insert('up','sys')\" /><image src=\"image/down.gif\" id=\"insertAfter"
+ "\" onclick=\"UseCase.insert('down','user')\" /><image src=\"image/down.gif\" id=\"insertAfterSys"
+ "\" onclick=\"UseCase.insert('down','sys')\" /></td></tr>\n");
String propertyValueTable = "";
for (int i = 0; i < dataSize; i++) {
buffer.append("<div><tr id=\"tr" + i
+ "\" class=\"trContent\">\n");
Object object = dataList.get(i);
UseCaseInteraction interaction = (UseCaseInteraction)object;
// buffer.append( "<td class=\"trContent\" onMouseOver=\"showImg(this)\" onMouseLeave=\"hideImg(this)\"><image"+
// "style=\"display:none\" src=\"image\\delete.gif\""+
// "id=\"check" + i + "\" onclick=\"Data.hiddenDetail(this)\" /><image"+
// "style=\"display:none\" src=\"image\\up.gif\""+
// "id=\"insertBefore" + i + "\""+
// "onclick=\"UseCase.insert(this,'up','user')\" /><image"+
// "style=\"display:none\" src=\"image\\up.gif\""+
// "id=\"insertBeforeSys" + i + "\""+
// "onclick=\"UseCase.insert(this,'up','sys')\" /><br>"+
// "<image style=\"display:none\" src=\"image\\down.gif\""+
// "id=\"insertAfter" + i + "\""+
// "onclick=\"UseCase.insert(this,'down','user')\" /><image"+
// "style=\"display:none\" src=\"image\\down.gif\""+
// "id=\"insertAfterSys" + i + "\""+
// "onclick=\"UseCase.insert(this,'down','sys')\" /><input"+
// "type=\"hidden\" name=\""+subPrimaryKeyName+ "\""+
// "value=\""+BeanUtil.getFieldValue(object,subPrimaryKeyName)+"\"/></td>\n");
buffer.append("<input type=\"hidden\" name=\""
+ subPrimaryKeyName + "\" value=\""
+ BeanUtil.getFieldValue(object, subPrimaryKeyName)
+ "\"/>");
for (int k = 0; k < propertySize; k++) {
UserPropertyRight property = (UserPropertyRight) displayProperties
.get(k);
//特殊处理columns字段
if ("columns".equals(property.getPropertyName())) {
Long classId = interaction.getClassId();
if (classId != null) {
String columnsValue = interaction.getColumns();
StringBuffer columnBuffer =
getProperty(classId.toString(), new Integer(i).toString(), columnsValue);
buffer.append("<td>");
buffer.append(columnBuffer);
buffer.append("</td>");
}
continue;
}
String propertyName = property.getPropertyName();
/* 如果不是从数据字典表或者其他表中选取,则显示输入框 */
if (GenericValidator.isBlankOrNull(property
.getPropertyValueTable())) {
if ("textarea".equals(property.getType())) {
Object value = Format.format(BeanUtil
.getFieldValue(object, propertyName));
if (k == 0 && "^^sys$$".equals(value)) {
Integer width = property.getShowWidth();
if (width != null)
buffer.append("<td nowrap width='"
+ width +"%'\n");
else
buffer.append("<td nowrap>\n");
buffer
.append("<textarea style=\"display:none\" name=\""
+ property
.getPropertyName()
+ "\" id=\""
+ property
.getPropertyName()
+ i
+ "\" onblur=\""
+ Format
.format(Validate
.getClientValidate(object
.getClass()
.getName()
+ propertyName))
+ "\" onpropertychange=\"setHeight()\" onpaste=\"setHeight()\">"
+ value + "</textarea>\n");
} else {
Integer width = property.getShowWidth();
if (width != null)
buffer.append("<td nowrap class=\"trContent\" width='"
+ width +"%'>\n");
else
buffer
.append("<td class=\"trContent\" nowrap>\n");
buffer
.append("<textarea style=\"overflow:auto;width:100%;height:100%\" name=\""
+ property
.getPropertyName()
+ "\" id=\""
+ property
.getPropertyName()
+ i
+ "\" onblur=\""
+ Format
.format(Validate
.getClientValidate(object
.getClass()
.getName()
+ propertyName))
+ "\" onpropertychange=\"setHeight()\" onpaste=\"setHeight()\" onfocus=\"UseCase.rememberFocus(this)\">"
+ value + "</textarea>\n");
}
} else {
Integer width = property.getShowWidth();
if (width != null)
buffer.append("<td width='"
+ width +"%'>\n");
else
buffer.append("<td>");
buffer
.append("<input type=\"text\" name=\""
+ property.getPropertyName()
+ "\" id=\""
+ property.getPropertyName()
+ i
+ "\" onfocus=\"rememberFocus(this)\" value=\""
+ Format.format(BeanUtil
.getFieldValue(object,
propertyName))
+ "\" onblur=\""
+ Format
.format(Validate
.getClientValidate(object
.getClass()
.getName()
+ propertyName))
+ "\"/>\n");
}
if (errors != null
&& errors.getErrorMsg(propertyName) != null) {
buffer.append(errors.getErrorMsg(propertyName));
}
} else {
buffer.append("<td>");
/* 如果是从数据字典表或者其他表中选取,则显示下拉列表或者弹出框 */
propertyValueTable = property
.getPropertyValueTable();
if (property.getFromDictionary() != null) {
if (property.getFromDictionary().booleanValue()) {
StringBuffer selectBuffer = DictionaryProxy
.getHtmlSelect(
propertyName,
propertyValueTable,
BeanUtil.getFieldValue(
object,
propertyName),
BeanUtil
.getFieldValue(
object,
property
.getShowProperty()));
buffer.append(selectBuffer.toString());
} else {
Object propertyValue = BeanUtil
.getFieldValue(object, propertyName);
String diplayName = property
.getShowProperty();
// Object displayValue = BeanUtil
// .getFieldValue(object, diplayName);
StringBuffer selectBuffer = HtmlClientComponentService
.getSelect(propertyValueTable, propertyValue);