tdWidth = 70 / sizePerLine;
else
tdWidth = 90 / sizePerLine;
for (int i = start; i < size; i++) {
UserPropertyRight property = (UserPropertyRight) editProperties
.get(i);
if (j % sizePerLine == 0) {
buffer.append("<tr>\n");
}
String propertyName = property.getPropertyName();
/* 因为如果是textarea的话,就会放到下面显示,所以这些只有当不是textarea的时候才显示 */
String displayChineseName = "<td width=\"15%\" align=\"left\" style="
+ "'text-align:justify;text-justify:distribute-all-lines'>"
+ property.getPropertyChiName()
+ ": </td> <td align=\"left\" width=\"" + tdWidth + "%\">";
if ("checkboxs".equals(property.getType())) {
checkboxsProperties.add(property);
continue;
}
if ("textarea".equals(property.getType())) {
textareaProperties.add(property);
continue;
}
if (GenericValidator
.isBlankOrNull(property.getPropertyValueTable())) {
/* 如果不是从数据字典表或者其他表中选取,则显示输入框 */
// 如果是隐藏字段,则输入hidden
if (GenericValidator.isBlankOrNull(property.getHidden())) {
buffer.append(displayChineseName + "\n");
buffer.append("<input type=\"text\" name=\""
+ property.getPropertyName()
+ "\" value=\""
+ Format.format(BeanUtil.getFieldValue(object,
propertyName))
+ "\" onblur=\""
+ Format.format(Validate.getClientValidate(object
.getClass().getName()
+ propertyName))
+ "\" style=\"width:97%;\" />\n");
if (errors != null
&& errors.getErrorMsg(propertyName) != null) {
buffer.append(errors.getErrorMsg(propertyName));
}
} else {
buffer.append("<input type=\"hidden\" name=\""
+ property.getPropertyName()
+ "\" value=\""
+ Format.format(BeanUtil.getFieldValue(object,
propertyName)) + "\"/>\n");
}
} else {
buffer.append(displayChineseName + "\n");
// buffer.append(displayChineseName);
/* 如果是从数据字典表或者其他表中选取,则显示下拉列表或者弹出框 */
/**
* Bug here .
*
*/
String propertyValueTable = property.getPropertyValueTable();
if (property.getFromDictionary() != null) {
if (property.getFromDictionary().booleanValue()) {
// StringBuffer selectBuffer =
// DictionaryProxy.getHtmlSelect(propertyName,
// propertyValueTable,
// BeanUtil.getFieldValue(object,propertyName),
// BeanUtil.getFieldValue(object,propertyName));
StringBuffer selectBuffer = HtmlClientComponentService
.getSelect(propertyValueTable, BeanUtil
.getFieldValue(object, propertyName));
buffer.append(selectBuffer.toString());
} else {
StringBuffer selectBuffer = HtmlClientComponentService
.getSelect(propertyValueTable, BeanUtil
.getFieldValue(object, propertyName));
buffer.append(selectBuffer.toString());
}
}
}
buffer.append("</td>\n");
if ("Y".equals(hint)) {
if ("cursor".equals(hintType))
buffer.append("<td><img src=\"/image/ask.gif\" alt=\""
+ Format.format(property.getDescription())
+ "\"></img></td>");
else
buffer.append("<td>"
+ Format.format(property.getDescription())
+ "</td>");
}
if (!"textarea".equals(property.getType())
|| "checkboxs".equals(property.getType())) {
j++;
}
if (j % sizePerLine == 0) {
buffer.append("</tr>");
}
}
/* 如果最后一行没有够每行要求的td数,那么就需要在下面补齐 */
while ((j % sizePerLine) != 0) {
j++;
buffer.append("<td></td>");
}
buffer.append("</tr>\n");
buffer.append("</table>\n");
for (int i = 0; i < textareaProperties.size(); i++) {
UserPropertyRight property = (UserPropertyRight) textareaProperties
.get(i);
buffer.append("<table><tr ><td width=\"15%\" align=\"left\">"
+ property.getPropertyChiName()
+ "</td><td align=\"left\">\n");
/* 大小应该有屏幕大小决定的,将来需要改 */
buffer.append("<textarea style=\"width:97%\" rows=\"5\" name=\""
+ property.getPropertyName()
+ "\">"
+ Format.format(BeanUtil.getFieldValue(object, property
.getPropertyName())) + "</textarea>");
buffer.append("</td></tr></table>\n");
}
for (int i = 0; i < checkboxsProperties.size(); i++) {
UserPropertyRight property = (UserPropertyRight) checkboxsProperties
.get(i);
buffer.append("<table><tr><td width=\"15%\">"
+ property.getPropertyChiName()
+ "</td><td align=\"left\">\n");
/* 大小应该有屏幕大小决定的,将来需要改 */
StringBuffer cheboxBuffer = getCheckboxs(property
.getPropertyValueTable(), property.getPropertyName(),
BeanUtil.getFieldValue(object, property.getPropertyName()),
-1);
buffer.append(cheboxBuffer.toString() + "\n");
buffer.append("</td></tr></table>\n");
}
return buffer;