package com.kingdee.eas.custom.projectbonus.web.vo;

import java.lang.reflect.Field;
import java.util.HashMap;
import java.util.Map;

/**
 * @Description 编辑列实体
 * @Date 2024/4/28 9:50
 * @Created by Heyuan
 */
public class EditColumnInfo {
    // 字段名
    private String name;
    // 标签
    private String label;
    // 是否冻结
    private boolean frozen = false;
    // 宽度
    private int width;
    // 表头对齐方式
    private String thalign;
    // 对齐方式
    private String align;
    // 是否隐藏
    private boolean hidden = false;
    // 是否为关键字段
    private boolean key = false;
    // 是否可编辑
    private boolean editable = true;
    // 排序类型
    private String sorttype;
    // 是否必填
    private boolean required = false;
    // 是否可排序
    private boolean sortable = true;
    // 格式化方式
    private String formatter = "promptBox";
    // 编辑类型
    private String edittype = "promptBox";
    // 编辑选项
    private EditOptions editoptions;
    // 类名
    private String classes;
    // 是否有标题
    private boolean title = false;
    // 原始宽度
    private int widthOrg;
    // 是否可调整大小
    private boolean resizable = false;

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    private String type = "promptbox";

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getLabel() {
        return label;
    }

    public void setLabel(String label) {
        this.label = label;
    }

    public boolean isFrozen() {
        return frozen;
    }

    public void setFrozen(boolean frozen) {
        this.frozen = frozen;
    }

    public int getWidth() {
        return width;
    }

    public void setWidth(int width) {
        this.width = width;
    }

    public String getThalign() {
        return thalign;
    }

    public void setThalign(String thalign) {
        this.thalign = thalign;
    }

    public String getAlign() {
        return align;
    }

    public void setAlign(String align) {
        this.align = align;
    }

    public boolean isHidden() {
        return hidden;
    }

    public void setHidden(boolean hidden) {
        this.hidden = hidden;
    }

    public boolean isKey() {
        return key;
    }

    public void setKey(boolean key) {
        this.key = key;
    }

    public boolean isEditable() {
        return editable;
    }

    public void setEditable(boolean editable) {
        this.editable = editable;
    }

    public String getSorttype() {
        return sorttype;
    }

    public void setSorttype(String sorttype) {
        this.sorttype = sorttype;
    }

    public boolean isRequired() {
        return required;
    }

    public void setRequired(boolean required) {
        this.required = required;
    }

    public boolean isSortable() {
        return sortable;
    }

    public void setSortable(boolean sortable) {
        this.sortable = sortable;
    }

    public String getFormatter() {
        return formatter;
    }

    public void setFormatter(String formatter) {
        this.formatter = formatter;
    }

    public String getEdittype() {
        return edittype;
    }

    public void setEdittype(String edittype) {
        this.edittype = edittype;
    }

    public EditOptions getEditoptions() {
        if (editoptions == null) {
            this.editoptions = new EditOptions();
        }
        return editoptions;
    }

    public void setEditoptions(EditOptions editoptions) {
        this.editoptions = editoptions;
    }

    public String getClasses() {
        return classes;
    }

    public void setClasses(String classes) {
        this.classes = classes;
    }

    public boolean isTitle() {
        return title;
    }

    public void setTitle(boolean title) {
        this.title = title;
    }

    public int getWidthOrg() {
        return widthOrg;
    }

    public void setWidthOrg(int widthOrg) {
        this.widthOrg = widthOrg;
    }

    public boolean isResizable() {
        return resizable;
    }

    public void setResizable(boolean resizable) {
        this.resizable = resizable;
    }

    public <T> Map<String, Object> convertToMap() throws IllegalAccessException {
        Map<String, Object> map = new HashMap<String, Object>();
        Class<?> clazz = this.getClass();
        Field[] fields = clazz.getDeclaredFields();
        for (Field field : fields) {
            field.setAccessible(true);
            map.put(field.getName(), field.get(this));
        }
        return map;
    }
}



