package com.anji.xwl.pojo;

/**
 * 表字段属性
 * @author Guo
 *
 */
public class TableColumn  implements Comparable {

	private  String  Field_Id;	//主键
	private  String  TableName;//表名
	private  String Renderer;//显示函数
	private  String vtype;//验证
	private  String maxLength;//最大长度
	private  String maxLengthText;//最大长度提示
	private  String minLength;//最小长度
	private  String minLengthText;//最小长度提示
	private  String maxValue;//最大长度
	private  String maxText;//最大长度提示
	private  String minValue;//最小长度
	private  String minText;//最小长度提示
	private  String allowDecimals;//允许小数
	private  String decimalPrecision;//小数位置
	private  String url;//数据源URL
    private  String params;//store参数
	//类型
	private  String type;
	//字段名
	private String field_name; 
	//标题 disp_text
	private String disp_text;
	//链接
	private String link_to;
	//列表显示
	private String listable;
	//是否可编辑
	private String editable;
	//显示宽度
	private String disp_Width;
	//显示格式
	private String disp_format; 
	//自动换行
	private String auto_wrap;
	//允许空值
	private String allow_blank;
	//只读
	private String read_only;
	//键名称
	private String key_name;
	//字段长度
	private String field_size;
	//小数位置
	private String decimal_precision;
	//验证函数
	private String validator;
	//显示函数
	private String penderer;
	//分组类别
	private String groups;
	
    public String getUrl() {
		return url;
	}
	public void setUrl(String url) {
		this.url = url;
	}
	public String getParams() {
		return params;
	}
	public void setParams(String params) {
		this.params = params;
	}
	public String getMaxLength() {
		return maxLength;
	}
	public void setMaxLength(String maxLength) {
		this.maxLength = maxLength;
	}
	public String getMaxLengthText() {
		return maxLengthText;
	}
	public void setMaxLengthText(String maxLengthText) {
		this.maxLengthText = maxLengthText;
	}
	public String getMinLength() {
		return minLength;
	}
	public void setMinLength(String minLength) {
		this.minLength = minLength;
	}
	public String getMinLengthText() {
		return minLengthText;
	}
	public void setMinLengthText(String minLengthText) {
		this.minLengthText = minLengthText;
	}
	public String getMaxValue() {
		return maxValue;
	}
	public void setMaxValue(String maxValue) {
		this.maxValue = maxValue;
	}
	public String getMaxText() {
		return maxText;
	}
	public void setMaxText(String maxText) {
		this.maxText = maxText;
	}
	public String getMinValue() {
		return minValue;
	}
	public void setMinValue(String minValue) {
		this.minValue = minValue;
	}
	public String getMinText() {
		return minText;
	}
	public void setMinText(String minText) {
		this.minText = minText;
	}
	public String getAllowDecimals() {
		if(allowDecimals==null)
			return null;
		else if(allowDecimals.equals("1"))
			return "true";
		else if (allowDecimals.equals("0"))
		    return "false";
		else
		    return allowDecimals;
	
	}
	public void setAllowDecimals(String allowDecimals) {
		this.allowDecimals = allowDecimals;
	}
	public String getDecimalPrecision() {
		return decimalPrecision;
	}
	public void setDecimalPrecision(String decimalPrecision) {
		this.decimalPrecision = decimalPrecision;
	}
	public String getVtype() {
		return vtype;
	}
	public void setVtype(String vtype) {
		this.vtype = vtype;
	}

	public String getTableName() {
		return TableName;
	}
	public void setTableName(String tableName) {
		TableName = tableName;
	}
	public String getRenderer() {
		return Renderer;
	}
	public void setRenderer(String renderer) {
		Renderer = renderer;
	}
	public String getType() {
		System.out.println("type===="+type);
		if (type==null||type.equals("null"))
			return "text";
		else
		return type;
	}
	public void setType(String type) {
		this.type = type;
	}
	

	public String getLink_to() {
		return link_to;
	}
	public void setLink_to(String link_to) {
		this.link_to = link_to;
	}
	public String getListable() {
		return listable;
	}
	public void setListable(String listable) {
		this.listable = listable;
	}
	public String getEditable() {
		return editable;
	}
	public void setEditable(String editable) {
		this.editable = editable;
	}
	public String getDisp_Width() {
		return disp_Width;
	}
	public void setDisp_Width(String disp_Width) {
		this.disp_Width = disp_Width;
	}
	public String getDisp_format() {
		return disp_format;
	}
	public void setDisp_format(String disp_format) {
		this.disp_format = disp_format;
	}
	public String getAuto_wrap() {
		return auto_wrap;
	}
	public void setAuto_wrap(String auto_wrap) {
		this.auto_wrap = auto_wrap;
	}
	public String getAllow_blank() {
		if(allow_blank==null)
     	   return allow_blank;
		else if(allow_blank.equals("1"))
			return "true";
		else if (allow_blank.equals("0"))
		    return "false";
		else
			return null;

		
	}
	public void setAllow_blank(String allow_blank) {
		this.allow_blank = allow_blank;
	}
	public String getRead_only() {
		if(read_only==null)
			return read_only;
		else if(read_only.equals("1"))
			return "true";
		else if (read_only.equals("0"))
			return "false";
		else
			return null;

	}
	public void setRead_only(String read_only) {
		this.read_only = read_only;
	}
	public String getKey_name() {
		return key_name;
	}
	public void setKey_name(String key_name) {
		this.key_name = key_name;
	}
	public String getField_size() {
		return field_size;
	}
	public void setField_size(String field_size) {
		this.field_size = field_size;
	}
	public String getDecimal_precision() {
		return decimal_precision;
	}
	public void setDecimal_precision(String decimal_precision) {
		this.decimal_precision = decimal_precision;
	}
	public String getValidator() {
		if(validator==null)
			return validator;
		else if(validator.equals("1"))
			return "true";
		else if (validator.equals("0"))
		    return "false";
		else
			return null;

	}
	public void setValidator(String validator) {
		this.validator = validator;
	}
	public String getPenderer() {
		return penderer;
	}
	public void setPenderer(String penderer) {
		this.penderer = penderer;
	}


	public  TableColumn()
	{}
	public TableColumn(String fieldId, String tableName, String renderer,
			String vtype, String maxLength, String maxLengthText,
			String minLength, String minLengthText, String maxValue,
			String maxText, String minValue, String minText,
			String allowDecimals, String decimalPrecision, String type,
			String filld_name, String dist_text, String link_to,
			String listable, String editable, String disp_Width,
			String disp_format, String auto_wrap, String allow_blank,
			String read_only, String key_name, String field_size,
			String decimal_precision, String validator, String penderer,
			String group) {
		super();
		Field_Id = fieldId;
		TableName = tableName;
		Renderer = renderer;
		this.vtype = vtype;
		this.maxLength = maxLength;
		this.maxLengthText = maxLengthText;
		this.minLength = minLength;
		this.minLengthText = minLengthText;
		this.maxValue = maxValue;
		this.maxText = maxText;
		this.minValue = minValue;
		this.minText = minText;
		this.allowDecimals = allowDecimals;
		this.decimalPrecision = decimalPrecision;
		this.type = type;
		this.field_name = filld_name;
		this.disp_text = dist_text;
		this.link_to = link_to;
		this.listable = listable;
		this.editable = editable;
		this.disp_Width = disp_Width;
		this.disp_format = disp_format;
		this.auto_wrap = auto_wrap;
		this.allow_blank = allow_blank;
		this.read_only = read_only;
		this.key_name = key_name;
		this.field_size = field_size;
		this.decimal_precision = decimal_precision;
		this.validator = validator;
		this.penderer = penderer;
		this.groups = group;
	}
	public String getField_Id() {
		return Field_Id;
	}
	public void setField_Id(String field_Id) {
		Field_Id = field_Id;
	}
	public String getField_name() {
		return field_name;
	}
	public void setField_name(String field_name) {
		this.field_name = field_name;
	}
	public String getDisp_text() {
		return disp_text;
	}
	public void setDisp_text(String disp_text) {
		this.disp_text = disp_text;
	}
	public String getGroups() {
		return groups;
	}
	public void setGroups(String groups) {
		this.groups = groups;
	}
	@Override
	public int compareTo(Object o) {
		
		TableColumn sdto = (TableColumn)o;

	       String otherAge = sdto.getGroups();
	      // note: enum-type's comparation depend on types' list order of enum method
	      // so, if compared property is enum-type ,then its comparationfollow ObjEnum.objType order
	       	if(this.groups==null)
	        return "".compareTo(otherAge==null?"":otherAge);
	       	else
	       	return this.groups.compareTo(otherAge);
	}
}
