package _VisualDVM.TestingSystem.SAPFOR.SapforSettingsCommand.UI;
import Common.Database.Tables.DataSet;
import Common.Passes.PassCode_;
import Common.Visual.Menus.DataMenuBar;
import Common.Visual.Tables.ColumnInfo;
import Common.Visual.Windows.Dialog.DBObjectDialog;
import _VisualDVM.Global;
import _VisualDVM.Passes.PassCode;
import _VisualDVM.TestingSystem.SAPFOR.SapforSettings.SapforSettings;
import _VisualDVM.TestingSystem.SAPFOR.SapforSettingsCommand.SapforSettingsCommand;
import _VisualDVM.Visual.RDataSetControlForm;

import javax.swing.*;
public class SapforSettingsCommandsForm extends RDataSetControlForm<SapforSettingsCommand> {
    public SapforSettingsCommandsForm(DataSet<?, SapforSettingsCommand> dataSource_in, JPanel mountPanel_in) {
        super(dataSource_in, mountPanel_in);
    }
    @Override
    protected void createColumns() {
        AddColumns(
                new ColumnInfo<SapforSettingsCommand>("Проход") {
                    @Override
                    public Object getFieldAt(SapforSettingsCommand object) {
                        return object.passCode.getDescription();
                    }
                }
        );
    }
    @Override
    protected boolean isPKVisible() {
        return false;
    }
    @Override
    public PassCode_ getDeletePassCode() {
        return PassCode.DeleteSapforSettingsCommand;
    }
    @Override
    public DataMenuBar createMenuBar() {
        return new DataMenuBar(dataSource.getPluralDescription(),
                PassCode.PublishSapforSettingsCommand,
                PassCode.EditSapforSettingsCommand,
                PassCode.DeleteSapforSettingsCommand);
    }
    @Override
    public boolean isObjectVisible(SapforSettingsCommand object) {
        return super.isObjectVisible(object) &&
                Global.testingServer.db.getTable(SapforSettings.class).getUI().matchCurrentID(object.sapforsettings_id);
    }
    @Override
    protected DBObjectDialog getDialog() {
        return new SapforSettingsCommandDialog();
    }
}
