package _VisualDVM.Visual.Windows;
import Common.Visual.FormWithSplitters;
import _VisualDVM.Global;
import _VisualDVM.Visual.Interface.DebugWindow;

import javax.swing.*;
public class DebugForm implements DebugWindow, FormWithSplitters {
    public JSplitPane SC51;
    public JSplitPane SC40;
    public JTabbedPane debugTabs;
    public JSplitPane SC41;
    public JSplitPane SC20;
    public JSplitPane SC52;
    public JSplitPane SC42;
    public JSplitPane SC43;
    public JSplitPane SC21;
    public JSplitPane SC35;
    //--
    //-
    public RunTasksComparisonForm singleRunTaskMaster; // одиночные запуски
    public RunTasksComparisonForm singleRunTaskSlave;
    //
    public CompilationTasksComparisonForm singleCompilationTaskMaster; // одиночная компиляция
    public CompilationTasksComparisonForm singleCompilationTaskSlave;
    private JPanel content;
    private JPanel compilationTasksPanel;
    private JPanel makefilesPanel;
    private JPanel modulesPanel;
    private JPanel runTasksPanel;
    private JPanel runConfigurationsPanel;
    private JPanel environmentsPanel;
    private JPanel dvmParametersPanel;
    public DebugForm() {
        LoadSplitters();
        //--
        Global.mainModule.getDb().makefiles.mountUI(makefilesPanel);
        Global.mainModule.getDb().modules.mountUI(modulesPanel);
        Global.mainModule.getDb().runConfigurations.mountUI(runConfigurationsPanel);
        Global.mainModule.getDb().environmentValues.mountUI(environmentsPanel);
        Global.mainModule.getDb().dvmParameters.mountUI(dvmParametersPanel);
        //-
        Global.mainModule.getDb().compilationTasks.mountUI(compilationTasksPanel);
        Global.mainModule.getDb().runTasks.mountUI(runTasksPanel);
        //--
        singleCompilationTaskMaster = new CompilationTasksComparisonForm(singleCompilationTaskSlave = new CompilationTasksComparisonForm(null));
        singleRunTaskMaster = new RunTasksComparisonForm(singleRunTaskSlave = new RunTasksComparisonForm(null));
        //--
        //-
        SC41.setLeftComponent(singleCompilationTaskMaster.getContent());
        SC41.setRightComponent(singleCompilationTaskSlave.getContent());
        SC43.setLeftComponent(singleRunTaskMaster.getContent());
        SC43.setRightComponent(singleRunTaskSlave.getContent());
    }
    //--
    //--
    @Override
    public JPanel getContent() {
        return content;
    }
    @Override
    public void DropRunTasksComparison() {
        singleRunTaskMaster.RemoveObject();
        singleRunTaskSlave.RemoveObject();
    }
    @Override
    public void DropCompilationTasksComparison() {
        singleCompilationTaskMaster.RemoveObject();
        singleCompilationTaskSlave.RemoveObject();
    }
    @Override
    public void ShowLastCompilationTask() {
        singleCompilationTaskMaster.ApplyObject();
    }
    @Override
    public void ShowLastRunTask() {
        singleRunTaskMaster.ApplyObject();
    }
    @Override
    public void ShowCurrentRunTask() {
        //  if (singleRunTaskMaster.isActive()) singleRunTaskMaster.ShowTask();
        //  else singleRunTaskSlave.ShowTask();
    }
    @Override
    public void ShowNoCurrentRunTask() {
        // if (singleRunTaskMaster.isActive()) singleRunTaskMaster.Clear();
        // else singleRunTaskSlave.Clear();
    }
    //-
    @Override
    public void ShowAll() {
        Global.mainModule.getDb().makefiles.ShowUI();
        Global.mainModule.getDb().runConfigurations.ShowUI();
        Global.mainModule.getDb().compilationTasks.ShowUI(); //их видимость зависит от текущего проекта.
        Global.mainModule.getDb().runTasks.ShowUI();
    }
}
