a3c1e59e3a915a672530e36f0922f3a7684e84c0.svn-base 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. package com.sysmodel.xformmodel.importcontrol;
  2. import com.sysmodel.XFormFactory;
  3. import com.sysmodel.XFormModel;
  4. import com.sysmodel.xformmodel.able.Validate;
  5. public class TextControl extends AbstractControl{
  6. private String size = "";
  7. private boolean readOnly = false;
  8. private static XFormModel XFormModel = XFormFactory.getXFormModel();
  9. /**
  10. * css TextCss <input name="" type="text" value="" size="" maxlength=""
  11. * readonly="true">
  12. */
  13. public String produceHtml(String name, String value, String displayValue, Validate Validate) {
  14. StringBuffer sb = new StringBuffer("<input type=\"text\"");
  15. sb.append(" id=\"" + name + "\" name=\"" + name + "\" ");
  16. sb.append(" value=\"").append(value).append("\"");
  17. String css = XFormModel.getCSSValue("TextCss");
  18. if (!css.equals(""))
  19. sb.append(" class=\"" + css + "\"");
  20. if (readOnly)
  21. sb.append(" readonly");
  22. if (!size.equals(""))
  23. sb.append(" size=\"" + size + "\"");
  24. sb.append(" dojoType=\"" + Validate.getDojoShowType() + "\" ");
  25. if (!Validate.getRegxValue().equals(""))
  26. sb.append(" regExp=\"" + Validate.getRegxShowValue() + "\"");
  27. if (!Validate.getPromptMessage().equals(""))
  28. sb.append(" promptMessage=\"" + Validate.getPromptMessage() + "\" ");
  29. if (!Validate.getInvalidMessage().equals(""))
  30. sb.append(" invalidMessage=\"" + Validate.getInvalidMessage() + "\" ");
  31. if (Validate.isNeed())
  32. sb.append(" required=\"true\" ");
  33. if (Validate.isTrim())
  34. sb.append(" trim=\"true\" ");
  35. sb.append(">");
  36. return sb.toString();
  37. }
  38. public boolean isReadOnly() {
  39. return readOnly;
  40. }
  41. public void setReadOnly(boolean readOnly) {
  42. this.readOnly = readOnly;
  43. }
  44. public String getSize() {
  45. return size;
  46. }
  47. public void setSize(String size) {
  48. this.size = size;
  49. }
  50. }