package _VisualDVM.ProjectData.SapforData.Regions.UI;
import Common.Database.Tables.DataSet;
import Common.Visual.DataSetControlForm;
import Common.Visual.Tables.ColumnInfo;
import Common.Visual.Tables.RendererMultiline;
import Common.Visual.Tables.RendererTopLeft;
import _VisualDVM.ProjectData.SapforData.Regions.ParallelRegion;

import javax.swing.*;
public class ParallelRegionsForm extends DataSetControlForm<ParallelRegion> {
    public ParallelRegionsForm(DataSet<?, ParallelRegion> dataSource_in, JPanel mountPanel_in) {
        super(dataSource_in, mountPanel_in);
    }
    @Override
    protected boolean hasCheckBox() {
        return false;
    }
    @Override
    protected void createColumns() {
        AddColumns(
                new ColumnInfo<ParallelRegion>("Имя") {
                    @Override
                    public Object getFieldAt(ParallelRegion object) {
                        return object.originalName;
                    }
                },
                new ColumnInfo<ParallelRegion>("Строк кода") {
                    @Override
                    public Object getFieldAt(ParallelRegion object) {
                        return object.lines_count;
                    }
                    @Override
                    public Class getRendererClass() {
                        return RendererTopLeft.class;
                    }
                },
                new ColumnInfo<ParallelRegion>("Массивов") {
                    @Override
                    public Object getFieldAt(ParallelRegion object) {
                        return object.arrays_count;
                    }
                    @Override
                    public Class getRendererClass() {
                        return RendererTopLeft.class;
                    }
                },
                new ColumnInfo<ParallelRegion>("Циклов") {
                    @Override
                    public Object getFieldAt(ParallelRegion object) {
                        return object.loops_count;
                    }
                    @Override
                    public Class getRendererClass() {
                        return RendererTopLeft.class;
                    }
                },
                new ColumnInfo<ParallelRegion>("Объявлений процедур") {
                    @Override
                    public Object getFieldAt(ParallelRegion object) {
                        return object.fd_count;
                    }
                    @Override
                    public Class getRendererClass() {
                        return RendererTopLeft.class;
                    }
                },
                new ColumnInfo<ParallelRegion>("Вызовов процедур") {
                    @Override
                    public Object getFieldAt(ParallelRegion object) {
                        return object.fc_count;
                    }
                    @Override
                    public Class getRendererClass() {
                        return RendererTopLeft.class;
                    }
                },
                new ColumnInfo<ParallelRegion>("Фрагменты") {
                    @Override
                    public Object getFieldAt(ParallelRegion object) {
                        return object.fragments;
                    }
                    @Override
                    public Class getRendererClass() {
                        return RendererMultiline.class;
                    }
                }
        );
    }
}
