/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package br.com.ctecinf.table;

/**
 *
 * @author Cássio Conceição
 * @since 24/09/2019
 * @version 1909
 * @see http://ctecinf.com.br/
 */
public class TableColumn {

    private int index;
    private String name;
    private String label;
    private Class<?> type;
    private int width;

    public TableColumn(int index, String name) {
        this.index = index;
        this.name = name;
        this.label = name;
        this.type = Object.class;
        this.width = 0;
    }

    public TableColumn(int index, String name, String label) {
        this.index = index;
        this.name = name;
        this.label = label;
        this.type = Object.class;
        this.width = 0;
    }

    public TableColumn(int index, String name, int width) {
        this.index = index;
        this.name = name;
        this.label = name;
        this.type = Object.class;
        this.width = width;
    }

    public TableColumn(int index, String name, String label, Class<?> type) {
        this.index = index;
        this.name = name;
        this.label = label;
        this.type = type;
        this.width = 0;
    }

    public TableColumn(int index, String name, String label, Class<?> type, int width) {
        this.index = index;
        this.name = name;
        this.label = label;
        this.type = type;
        this.width = width;
    }

    public int getIndex() {
        return index;
    }

    public void setIndex(int index) {
        this.index = index;
    }

    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 Class<?> getType() {
        return type;
    }

    public void setType(Class<?> type) {
        this.type = type;
    }

    public int getWidth() {
        return width;
    }

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

    @Override
    public String toString() {

        String str = name;

        for (int i = 0; i < width; i++) {
            str += "X";
        }

        return str;
    }
}
