123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
- package com.sysmodel.xformmodel.importcontrol;
- import com.sysmodel.XFormFactory;
- import com.sysmodel.XFormModel;
- import com.sysmodel.xformmodel.able.Validate;
- public class TextControl extends AbstractControl{
- private String size = "";
- private boolean readOnly = false;
- private static XFormModel XFormModel = XFormFactory.getXFormModel();
- /**
- * css TextCss <input name="" type="text" value="" size="" maxlength=""
- * readonly="true">
- */
- public String produceHtml(String name, String value, String displayValue, Validate Validate) {
- StringBuffer sb = new StringBuffer("<input type=\"text\"");
- sb.append(" id=\"" + name + "\" name=\"" + name + "\" ");
- sb.append(" value=\"").append(value).append("\"");
- String css = XFormModel.getCSSValue("TextCss");
- if (!css.equals(""))
- sb.append(" class=\"" + css + "\"");
- if (readOnly)
- sb.append(" readonly");
- if (!size.equals(""))
- sb.append(" size=\"" + size + "\"");
- sb.append(" dojoType=\"" + Validate.getDojoShowType() + "\" ");
- if (!Validate.getRegxValue().equals(""))
- sb.append(" regExp=\"" + Validate.getRegxShowValue() + "\"");
- if (!Validate.getPromptMessage().equals(""))
- sb.append(" promptMessage=\"" + Validate.getPromptMessage() + "\" ");
- if (!Validate.getInvalidMessage().equals(""))
- sb.append(" invalidMessage=\"" + Validate.getInvalidMessage() + "\" ");
- if (Validate.isNeed())
- sb.append(" required=\"true\" ");
- if (Validate.isTrim())
- sb.append(" trim=\"true\" ");
- sb.append(">");
- return sb.toString();
- }
- public boolean isReadOnly() {
- return readOnly;
- }
- public void setReadOnly(boolean readOnly) {
- this.readOnly = readOnly;
- }
- public String getSize() {
- return size;
- }
- public void setSize(String size) {
- this.size = size;
- }
- }
|