package _VisualDVM.Visual.Tables;
import Common.Passes.Pass;
import Common.Visual.Tables.EditorDBObject;
import _VisualDVM.Global;
import _VisualDVM.Passes.Server.EditServerObject;
import _VisualDVM.ServerObjectsCache.VisualCaches;
import _VisualDVM.TestingSystem.Common.Configuration.Configuration;
import _VisualDVM.TestingSystem.Common.TestingServer;
import _VisualDVM.TestingSystem.SAPFOR.SapforConfiguration.SapforConfiguration;
public class SwitcherConfigurationAuto extends EditorDBObject<Configuration> {
    @Override
    public void Action() {
        value.SwitchAuto();
        setIcon(value.GetAutoIcon());
        ///-
        Pass pass = new EditServerObject<TestingServer, Configuration>(Global.testingServer, Configuration.class) {
            @Override
            protected boolean canStart(Object... args) throws Exception {
                target = (Configuration) args[0];
                return true;
            }
            @Override
            public String getDescription() {
                return "Обновить флаг автоматического тестирования";
            }
            @Override
            protected void showDone() throws Exception {
                VisualCaches.RefreshCache(target);
                if (target instanceof SapforConfiguration)
                    Global.testingServer.db.sapforConfigurations.ShowUI(target.id);
            }
        };
        pass.Do(value);
    }
    @Override
    public Object getCellEditorValue() {
        return value;
    }
}
