public ChartTestPresenter(IChartTestView view, IChartEditorAndDisplayPresenter chartEditorAndDisplayPresenter, TestEnvironment testEnvironment, IDataColumnToPathElementsMapper dataColumnToPathColumnValuesMapper,
                                  IDataRepositoryCreator dataRepositoryCreator, IOSPSuiteXmlSerializerRepository ospSuiteXmlSerializerRepository, DataPersistor dataPersistor, IChartFromTemplateService chartFromTemplateService,
                                  IChartTemplatePersistor chartTemplatePersistor, IDimensionFactory dimensionFactory, IChartUpdater chartUpdater) : base(view)
        {
            _model            = testEnvironment.Model.Root;
            _dataRepositories = new Cache <string, DataRepository>(repository => repository.Name);
            _chartEditorAndDisplayPresenter  = chartEditorAndDisplayPresenter;
            _dataRepositoryCreator           = dataRepositoryCreator;
            _ospSuiteXmlSerializerRepository = ospSuiteXmlSerializerRepository;
            _dataPersistor            = dataPersistor;
            _chartFromTemplateService = chartFromTemplateService;
            _chartTemplatePersistor   = chartTemplatePersistor;
            _dimensionFactory         = dimensionFactory;
            _chartUpdater             = chartUpdater;
            _view.AddChartEditorView(chartEditorAndDisplayPresenter.EditorPresenter.View);
            _view.AddChartDisplayView(chartEditorAndDisplayPresenter.DisplayPresenter.View);
            _simulationSettings = new SimulationSettings();
            AddSubPresenters(chartEditorAndDisplayPresenter);

            configureChartEditorPresenter(dataColumnToPathColumnValuesMapper);

            bindCurveChartToEditor();

            configureChartEditorEvents();
            InitializeWith(new OSPSuiteMacroCommand <IOSPSuiteExecutionContext>());
        }
Exemple #2
0
        protected override ICommand ReplaceTemplatesCommand(IWithChartTemplates withChartTemplates, IEnumerable <CurveChartTemplate> curveChartTemplates)
        {
            withChartTemplates.RemoveAllChartTemplates();
            curveChartTemplates.Each(withChartTemplates.AddChartTemplate);

            return(new OSPSuiteEmptyCommand <IOSPSuiteExecutionContext>());
        }
Exemple #3
0
        public IMenuBarSubMenu CreateChartTemplateButton(IWithChartTemplates withChartTemplates, Func <CurveChart> retrieveActiveCurveChartFunc,
                                                         Action <CurveChartTemplate> applyTemplateAction)
        {
            _curveChart         = retrieveActiveCurveChartFunc;
            _withChartTemplates = withChartTemplates;
            _loadMenuAction     = applyTemplateAction;

            var chartTemplate = CreateSubMenu.WithCaption(MenuNames.ChartTemplate);

            chartTemplate.AddItem(createLoadButton(loadMenuFor));

            var fromChart = createFromChartMenu();

            var createNew = createCreateMenu();

            fromChart.AddItem(createNew);

            createUpdateMenu(fromChart);

            chartTemplate.AddItem(fromChart);

            var manageTemplatesMenu = createManageMenu();

            chartTemplate.AddItem(manageTemplatesMenu);

            return(chartTemplate);
        }
 private ICommand updateChartTemplates(IWithChartTemplates withChartTemplates, Action <IWithChartTemplates> action)
 {
     //no command called in PKSim for chart templates
     action(withChartTemplates);
     _executionContext.PublishEvent(new ChartTemplatesChangedEvent(withChartTemplates));
     return(new PKSimEmptyCommand());
 }
 protected override ICommand ReplaceTemplatesCommand(IWithChartTemplates withChartTemplates, IEnumerable <CurveChartTemplate> curveChartTemplates)
 {
     return(updateChartTemplates(withChartTemplates, x =>
     {
         withChartTemplates.ChartTemplates.ToList().Each(t => withChartTemplates.RemoveChartTemplate(t.Name));
         curveChartTemplates.Each(withChartTemplates.AddChartTemplate);
     }));
 }
        protected override ICommand ReplaceTemplatesCommand(IWithChartTemplates withChartTemplates, IEnumerable <CurveChartTemplate> curveChartTemplates)
        {
            if (withChartTemplates.IsAnImplementationOf <IMoBiSimulation>())
            {
                return(new ReplaceSimulationTemplatesCommand(withChartTemplates.DowncastTo <IMoBiSimulation>(), curveChartTemplates).Run(_context));
            }

            return(updateChartTemplates(withChartTemplates, x =>
            {
                withChartTemplates.RemoveAllChartTemplates();
                curveChartTemplates.Each(withChartTemplates.AddChartTemplate);
            }));
        }
        public ICommand ManageTemplates(IWithChartTemplates withChartTemplates)
        {
            using (var presenter = _applicationController.Start <IModalChartTemplateManagerPresenter>())
            {
                presenter.EditTemplates(withChartTemplates.ChartTemplates);

                presenter.Display();

                if (!presenter.HasChanged || presenter.Canceled())
                {
                    return(new OSPSuiteEmptyCommand <IOSPSuiteExecutionContext>());
                }

                var curveChartTemplates = presenter.EditedTemplates;
                return(ReplaceTemplatesCommand(withChartTemplates, curveChartTemplates));
            }
        }
 public override ICommand AddChartTemplateCommand(CurveChartTemplate template, IWithChartTemplates withChartTemplates)
 {
     return(updateChartTemplates(withChartTemplates, x => x.AddChartTemplate(template)));
 }
Exemple #9
0
 public ChartTemplatesChangedEvent(IWithChartTemplates withChartTemplates)
 {
     WithChartTemplates = withChartTemplates;
 }
        public override ICommand UpdateChartTemplateCommand(CurveChartTemplate curveChartTemplate, IWithChartTemplates withChartTemplates, string templateName)
        {
            if (withChartTemplates.IsAnImplementationOf <IMoBiSimulation>())
            {
                return(new UpdateChartTemplateInSimulationSettingsCommand(curveChartTemplate, withChartTemplates.DowncastTo <IMoBiSimulation>(), templateName).Run(_context));
            }

            return(updateChartTemplates(withChartTemplates, x =>
            {
                withChartTemplates.RemoveChartTemplate(templateName);
                curveChartTemplate.Name = templateName;
                withChartTemplates.AddChartTemplate(curveChartTemplate);
            }));
        }
Exemple #11
0
 public override ICommand UpdateChartTemplateCommand(CurveChartTemplate template, IWithChartTemplates withChartTemplates, string templateName)
 {
     withChartTemplates.AddChartTemplate(template);
     return(new OSPSuiteEmptyCommand <IOSPSuiteExecutionContext>());
 }
Exemple #12
0
 public virtual void UpdateTemplatesFor(IWithChartTemplates withChartTemplates)
 {
     UpdateTemplatesBasedOn(withChartTemplates);
 }
 public void AddChartTemplateMenu(IWithChartTemplates withChartTemplates, Action <CurveChartTemplate> loadMenuFor)
 {
     AddButton(_chartTemplateMenuPresenter.CreateChartTemplateButton(withChartTemplates, () => Chart, loadMenuFor));
 }
 public abstract ICommand UpdateChartTemplateCommand(CurveChartTemplate template, IWithChartTemplates withChartTemplates, string templateName);
        public override ICommand AddChartTemplateCommand(CurveChartTemplate template, IWithChartTemplates withChartTemplates)
        {
            if (withChartTemplates.IsAnImplementationOf <IMoBiSimulation>())
            {
                return(new AddChartTemplateToSimulationSettingsCommand(template, withChartTemplates.DowncastTo <IMoBiSimulation>()).Run(_context));
            }

            return(updateChartTemplates(withChartTemplates, x => x.AddChartTemplate(template)));
        }
 public override ICommand UpdateChartTemplateCommand(CurveChartTemplate template, IWithChartTemplates withChartTemplates, string templateName)
 {
     return(updateChartTemplates(withChartTemplates, x =>
     {
         withChartTemplates.RemoveChartTemplate(templateName);
         template.Name = templateName;
         withChartTemplates.AddChartTemplate(template);
     }));
 }
 protected abstract ICommand ReplaceTemplatesCommand(IWithChartTemplates withChartTemplates, IEnumerable <CurveChartTemplate> curveChartTemplates);
 public abstract ICommand AddChartTemplateCommand(CurveChartTemplate template, IWithChartTemplates withChartTemplates);
 private ICommand updateChartTemplates(IWithChartTemplates withChartTemplates, Action <IWithChartTemplates> action)
 {
     action(withChartTemplates);
     _context.PublishEvent(new ChartTemplatesChangedEvent(withChartTemplates));
     return(new MoBiEmptyCommand());
 }