658db179b8be6c96dabac1de1f36abd46b7c80f2.svn-base 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. /*
  2. * Created on 2006-6-6
  3. * Administrator
  4. */
  5. package com.sysmodel.xformmodel.importcontrol;
  6. import com.sysmodel.XFormFactory;
  7. import com.sysmodel.XFormModel;
  8. import com.sysmodel.xformmodel.able.Validate;
  9. public class TreeControl extends AbstractControl{
  10. /**
  11. * 文本框的长度
  12. */
  13. private String size = "";
  14. /**
  15. * 1 用引用表形成树 2 用引用编码表形成树 3 自定义常量树 4 自定义引用表树
  16. */
  17. private String type = "";
  18. /**
  19. * 引用表形成树:classid 引用编码表形成树:常量名
  20. */
  21. private String referenceTable = "";
  22. /**
  23. * 只引用表有用
  24. */
  25. private String storeCode = "";
  26. /**
  27. * 只引用表有用
  28. */
  29. private String displayName = "";
  30. /**
  31. * 只引用表有用
  32. */
  33. private String parentCode = "";
  34. /**
  35. * 自定义脚本 (自定义常量树 ,自定义引用表树)
  36. */
  37. private String customDefine = "";
  38. /**
  39. * 只引用表有用 条件
  40. */
  41. private String condition = "";
  42. /**
  43. * 只引用表有用 排序
  44. */
  45. private String order = "";
  46. private boolean leafonly = false;
  47. private static XFormModel XFormModel = XFormFactory.getXFormModel();
  48. /**
  49. * setConstantTree(constantName,leafonly,hiddenObject,displayObject)
  50. * setReferenceTableTree
  51. * (referenceclassid,leafonly,hiddenObject,displayObject
  52. * ,storeCode,displayName,parentCode,condition,order)
  53. */
  54. public String produceHtml(String name, String value, String displayValue, Validate Validate) {
  55. StringBuffer sb = new StringBuffer("<input type=\"hidden\" name=\"");
  56. sb.append(name).append("\" value=\"");
  57. sb.append(value).append("\">");
  58. sb.append("<input type=\"text\" name=\"");
  59. sb.append(name + "Show\" readonly value=\"");
  60. sb.append(displayValue).append("\"");
  61. String css = XFormModel.getCSSValue("TreeCss");
  62. if (!css.equals(""))
  63. sb.append(" class=\"" + css + "\"");
  64. if (!size.equals(""))
  65. sb.append(" size=\"" + size + "\"");
  66. sb.append(" onfocus=\"");
  67. if (type.equals("1")) {// table
  68. sb.append("setReferenceTableTree('" + referenceTable).append(
  69. "'," + leafonly + ",document.forms[0].elements['" + name + "'],this,'");
  70. sb.append(storeCode + "','").append(displayName + "','");
  71. sb.append(parentCode + "','").append(condition + "','").append(order + "');");
  72. } else if (type.equals("2")) {// constant
  73. sb.append("referenceTable('" + referenceTable).append(
  74. "'," + leafonly + ",document.forms[0].elements['" + name + "'],this);");
  75. } else {// other
  76. sb.append(customDefine);
  77. }
  78. sb.append("\">");
  79. return sb.toString();
  80. }
  81. public String getCondition() {
  82. return condition;
  83. }
  84. public void setCondition(String condition) {
  85. this.condition = condition;
  86. }
  87. public String getCustomDefine() {
  88. return customDefine;
  89. }
  90. public void setCustomDefine(String customDefine) {
  91. this.customDefine = customDefine;
  92. }
  93. public String getDisplayName() {
  94. return displayName;
  95. }
  96. public void setDisplayName(String displayName) {
  97. this.displayName = displayName;
  98. }
  99. public boolean isLeafonly() {
  100. return leafonly;
  101. }
  102. public void setLeafonly(boolean leafonly) {
  103. this.leafonly = leafonly;
  104. }
  105. public String getOrder() {
  106. return order;
  107. }
  108. public void setOrder(String order) {
  109. this.order = order;
  110. }
  111. public String getParentCode() {
  112. return parentCode;
  113. }
  114. public void setParentCode(String parentCode) {
  115. this.parentCode = parentCode;
  116. }
  117. public String getReferenceTable() {
  118. return referenceTable;
  119. }
  120. public void setReferenceTable(String referenceTable) {
  121. this.referenceTable = referenceTable;
  122. }
  123. public String getSize() {
  124. return size;
  125. }
  126. public void setSize(String size) {
  127. this.size = size;
  128. }
  129. public String getStoreCode() {
  130. return storeCode;
  131. }
  132. public void setStoreCode(String storeCode) {
  133. this.storeCode = storeCode;
  134. }
  135. public String getType() {
  136. return type;
  137. }
  138. public void setType(String type) {
  139. this.type = type;
  140. }
  141. }