package _VisualDVM.TestingSystem.SAPFOR.SapforSettings.UI;
import Common.Visual.UI_;
import Common.Visual.Tables.StyledCellLabel;
import Common.Visual.Windows.Dialog.DialogFields;
import _VisualDVM.Repository.Component.Sapfor.Sapfor;
import Visual_DVM_2021.Passes.PassCode;

import javax.swing.*;
import java.awt.*;
public class SapforSettingsCommandFields implements DialogFields {
    private JPanel content;
    public JComboBox<PassCode> cbPassCode;
    @Override
    public Component getContent() {
        return content;
    }
    private void createUIComponents() {
        // TODO: place custom component creation code here
        cbPassCode = new JComboBox<>();
        cbPassCode.setRenderer((list, value, index, isSelected, cellHasFocus) -> {
            JLabel res = new StyledCellLabel();
            res.setText(value.getDescription());
            res.setBackground(isSelected ?
                    UI_.getTheme().selection_background : UI_.getTheme().background
            );
            return res;
        });
        //-
        for (PassCode code : Sapfor.getScenariosCodes())
            cbPassCode.addItem(code);
    }
}

