package _VisualDVM.TestingSystem.SAPFOR.SapforSettings.UI;
import Common.Utils.Utils_;
import Common.Visual.Windows.Dialog.DBObjectDialog;
import _VisualDVM.TestingSystem.SAPFOR.SapforSettings.SapforSettings;
public class SapforSettingsDialog extends DBObjectDialog<SapforSettings, SapforSettingsFields> {
    public SapforSettingsDialog() {
        super(SapforSettingsFields.class);
    }
    @Override
    public int getDefaultHeight() {
        return 415;
    }
    @Override
    public int getDefaultWidth() {
        return 600;
    }
    @Override
    public void validateFields() {
    }
    @Override
    public void fillFields() {
        fields.tfName.setText(Result.description);
        fields.cbFREE_FORM.setSelected(Result.FREE_FORM != 0);
        fields.cbKEEP_DVM_DIRECTIVES.setSelected(Result.KEEP_DVM_DIRECTIVES != 0);
        fields.cbKEEP_SPF_DIRECTIVES.setSelected(Result.KEEP_SPF_DIRECTIVES != 0);
        fields.cbSTATIC_SHADOW_ANALYSIS.setSelected(Result.STATIC_SHADOW_ANALYSIS != 0);
        fields.sMAX_SHADOW_WIDTH.setValue(Result.MAX_SHADOW_WIDTH);
    }
    @Override
    public void ProcessResult() {
        Result.description = fields.tfName.getText();
        Result.FREE_FORM = Utils_.fromBoolean(fields.cbFREE_FORM.isSelected());
        Result.KEEP_DVM_DIRECTIVES = Utils_.fromBoolean(fields.cbKEEP_DVM_DIRECTIVES.isSelected());
        Result.KEEP_SPF_DIRECTIVES = Utils_.fromBoolean(fields.cbKEEP_SPF_DIRECTIVES.isSelected());
        Result.STATIC_SHADOW_ANALYSIS = Utils_.fromBoolean(fields.cbSTATIC_SHADOW_ANALYSIS.isSelected());
        Result.MAX_SHADOW_WIDTH = fields.sMAX_SHADOW_WIDTH.getValue();
        Result.packFlags();
    }
    @Override
    public void SetReadonly() {
        fields.tfName.setEnabled(false);
        fields.cbFREE_FORM.setEnabled(false);
        fields.cbKEEP_SPF_DIRECTIVES.setEnabled(false);
        fields.cbSTATIC_SHADOW_ANALYSIS.setEnabled(false);
        fields.cbKEEP_DVM_DIRECTIVES.setEnabled(false);
        fields.sMAX_SHADOW_WIDTH.setEnabled(false);
    }
}
