/** * 初始化 * * @param id 标签id * @param name 标签名称 * @param clazz 标签clazz * @param type 标签类型 * @param validate 验证 * @param html 文本 */ public SimpleFormDataMeta( String id, String name, String[] clazz, Map<String, String> style, String title, String html) { super(id); if (!StringUtils.isEmpty(name)) { this.name = name; super.putProperty(ATTRITUDE_NAME, name); } if (clazz != null) { this.clazz = new ArrayList<String>(); for (String c : clazz) { this.clazz.add(c); } super.putProperty(ATTRITUDE_CLASS, getClazzStr(this.clazz)); } if (style != null && style.size() > 0) { this.style = style; super.putProperty(ATTRITUDE_STYLE, getStyleStr(this.style)); } if (!StringUtils.isEmpty(title)) { this.title = title; super.putProperty(ATTRITUDE_TITLE, title); } this.html = html; }
/** * 添加更新一个样式 * * @param key * @param value */ public void setStyle(String key, String value) { if (!StringUtils.isEmpty(key) && !StringUtils.isEmpty(value)) { if (this.style == null) { this.style = new HashMap<String, String>(); } this.style.put(key, value); } super.putProperty(ATTRITUDE_STYLE, getStyleStr(this.style)); }
/** * 移动类型 * * @param cls */ public void removeClazz(String cls) { if (this.clazz != null) { for (String c : this.clazz) { if (c != null && c.equals(cls)) { this.clazz.remove(c); } } super.putProperty(ATTRITUDE_CLASS, getClazzStr(this.clazz)); } }
/** * 添加类型 * * @param cls */ public void addClazz(String cls) { if (this.clazz == null) { this.clazz = new ArrayList<String>(); } else { for (String c : this.clazz) { if (c != null && c.equals(cls)) { this.clazz.remove(c); } } } this.clazz.add(cls); super.putProperty(ATTRITUDE_CLASS, getClazzStr(this.clazz)); }
/** * 只读 * * @param readonly */ public void setReadonly(boolean readonly) { this.readonly = readonly; if (readonly) { super.putProperty(ATTRITUDE_READONLY, readonly); super.putProperty("onfocus", "this.blur();"); super.putProperty("onchange", "return false;"); } else { super.putProperty(ATTRITUDE_READONLY, null); super.putProperty("onfocus", null); super.putProperty("onchange", null); } }
/** * 定义判断的方式 * * @param disabled */ public void setDisabled(boolean disabled) { this.disabled = disabled; super.putProperty(ATTRITUDE_DISABLED, disabled); }
/** * 定义验证值 * * @param title */ public void setTitle(String title) { this.title = title; super.putProperty(ATTRITUDE_TITLE, this.title); }
/** * 定义类型 * * @param clazz */ public void setClazz(List<String> clazz) { this.clazz = clazz; super.putProperty(ATTRITUDE_CLASS, getClazzStr(this.clazz)); }
/** * 设置名字定义 * * @param name */ public void setName(String name) { this.name = name; super.putProperty(ATTRITUDE_NAME, this.name); }