package _VisualDVM.TestingSystem.SAPFOR.SapforSettingsCommand.UI;
import Common.MainModule_;
import Common.Visual.Tables.StyledCellLabel;
import Common.Visual.Windows.Dialog.DialogFields;
import _VisualDVM.ComponentsServer.Component.Sapfor.Sapfor;
import _VisualDVM.Passes.PassCode;

import javax.swing.*;
import java.awt.*;
public class SapforSettingsCommandFields implements DialogFields {
    public JComboBox<PassCode> cbPassCode;
    private JPanel content;
    @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 ?
                    MainModule_.instance.getUI().getTheme().selection_background : MainModule_.instance.getUI().getTheme().background
            );
            return res;
        });
        //-
        for (PassCode code : Sapfor.getScenariosCodes())
            cbPassCode.addItem(code);
    }
}

