package _VisualDVM.GlobalData.DVMParameter.UI;
import Common.Database.Tables.DataSet;
import Common.Passes.PassCode_;
import Common.Visual.DataSetControlForm;
import Common.Visual.Menus.DataMenuBar;
import Common.Visual.Tables.ColumnInfo;
import Common.Visual.Windows.Dialog.DBObjectDialog;
import Common.Visual.Windows.Dialog.DialogFields;
import _VisualDVM.GlobalData.DVMParameter.DVMParameter;
import _VisualDVM.Passes.PassCode;

import javax.swing.*;
public class DVMParametersForm extends DataSetControlForm<DVMParameter> {
    public DVMParametersForm(DataSet<?, DVMParameter> dataSource_in, JPanel mountPanel_in) {
        super(dataSource_in, mountPanel_in);
    }
    @Override
    protected void createColumns() {
        AddColumns(
                new ColumnInfo<DVMParameter>("имя") {
                    @Override
                    public Object getFieldAt(DVMParameter object) {
                        return object.name;
                    }
                },
                new ColumnInfo<DVMParameter>("значение") {
                    @Override
                    public Object getFieldAt(DVMParameter object) {
                        return object.value;
                    }
                }
        );
    }
    @Override
    protected boolean hasCheckBox() {
        return false;
    }
    @Override
    public PassCode_ getDeletePassCode() {
        return PassCode.DeleteDVMParameter;
    }
    @Override
    public DataMenuBar createMenuBar() {
        return new DataMenuBar(dataSource.getPluralDescription(),
                PassCode.AddDVMParameter,
                PassCode.EditDVMParameter,
                PassCode.DeleteDVMParameter);
    }
    @Override
    protected DBObjectDialog<DVMParameter, ? extends DialogFields> getDialog() {
        return new DVMParameterDialog();
    }
}
