package _VisualDVM.GlobalData.Module;
import _VisualDVM.Current;
import Common.Database.Tables.iDBTable;
import Common.Visual.DataSetControlForm;
import Common.Visual.Windows.Dialog.DBObjectDialog;
import Common.Visual.Windows.Dialog.DialogFields;
import _VisualDVM.GlobalData.Module.UI.ModuleAnchestorForm;
public class ModulesDBTable extends iDBTable<Module> {
    public ModulesDBTable() {
        super(Module.class);
    }
    @Override
    public String getSingleDescription() {
        return "языковой модуль";
    }
    @Override
    public String getPluralDescription() {
        return "языковые модули";
    }
    @Override
    public DBObjectDialog<Module, ? extends DialogFields> getDialog() {
        return new ModuleAnchestorForm<>();
    }
    @Override
    protected DataSetControlForm createUI() {
        return new DataSetControlForm(this) {
            @Override
            public boolean hasCheckBox() {
                return true;
            }
            @Override
            protected void AdditionalInitColumns() {
                columns.get(0).setVisible(false);
            }
        };
    }
    @Override
    public Object getFieldAt(Module object, int columnIndex) {
        switch (columnIndex) {
            case 2:
                return object.language.getDescription();
            case 3:
                return object.getCompilerDescription();
            case 4:
                return object.command;
            case 5:
                return object.flags;
            default:
                return null;
        }
    }
    @Override
    public String[] getUIColumnNames() {
        return new String[]{
                "Язык",
                "Компилятор",
                "Команда",
                "Флаги"
        };
    }
    @Override
    public Current CurrentName() {
        return Current.Module;
    }
}
