package _VisualDVM.GlobalData.SapforProfileSetting.UI;
import Common.Database.Tables.DataSet;
import Common.MainModule_;
import Common.Visual.DataSetControlForm;
import Common.Visual.Tables.ColumnInfo;
import _VisualDVM.Global;
import _VisualDVM.GlobalData.SapforProfile.SapforProfile;
import _VisualDVM.GlobalData.SapforProfileSetting.SapforProfileSetting;

import javax.swing.*;
public class SapforProfileSettingsForm extends DataSetControlForm<SapforProfileSetting> {
    public SapforProfileSettingsForm(DataSet<?, SapforProfileSetting> dataSource_in, JPanel mountPanel_in) {
        super(dataSource_in, mountPanel_in);
    }
    @Override
    protected void createColumns() {
        AddColumns(
                new ColumnInfo<SapforProfileSetting>("имя") {
                    @Override
                    public Object getFieldAt(SapforProfileSetting object) {
                        return Global.mainModule.getProject().sapforProperties.getFieldDescription(object.name);
                    }
                },
                new ColumnInfo<SapforProfileSetting>("значение") {
                    @Override
                    public Object getFieldAt(SapforProfileSetting object) {
                        return object.value;
                    }
                }
        );
    }
    @Override
    protected boolean hasCheckBox() {
        return false;
    }
    @Override
    protected boolean isPKVisible() {
        return false;
    }
    @Override
    protected boolean hasMenuBar() {
        return false;
    }
    @Override
    public boolean isObjectVisible(SapforProfileSetting object) {
        return super.isObjectVisible(object) &&
                MainModule_.instance.getDb().getTable(SapforProfile.class).getUI().matchCurrentID(object.sapforprofile_id);
    }
}
