Esempio n. 1
0
        protected override void Context()
        {
            _treeNodeFactory  = A.Fake <ITreeNodeFactory>();
            _projectRetriever = A.Fake <IProjectRetriever>();
            _observedDataTask = A.Fake <IObservedDataTask>();
            sut = new ObservedDataInExplorerPresenter(_projectRetriever, _treeNodeFactory, _observedDataTask);

            _explorerPresenter       = A.Fake <IExplorerPresenter>();
            _classificationPresenter = A.Fake <IClassificationPresenter>();
            _explorerView            = A.Fake <IExplorerView>();

            A.CallTo(() => _explorerPresenter.BaseView).Returns(_explorerView);

            _rootNodeObservedDataFolder = new RootNodeType("ObservedData", ApplicationIcons.ObservedDataFolder, ClassificationType.ObservedData);
            _rootNodeIndividualFolder   = new RootNodeType("Individual", ApplicationIcons.IndividualFolder);
            _observationRootNode        = new RootNode(_rootNodeObservedDataFolder);
            _individualRootNode         = new RootNode(_rootNodeIndividualFolder);

            sut.InitializeWith(_explorerPresenter, _classificationPresenter, _rootNodeObservedDataFolder);
            _project = A.Fake <IProject>();

            A.CallTo(() => _explorerPresenter.NodeByType(_rootNodeObservedDataFolder)).Returns(_observationRootNode);
            A.CallTo(() => _explorerView.TreeView.NodeById(_rootNodeObservedDataFolder.Id)).Returns(_observationRootNode);
            A.CallTo(() => _explorerView.AddNode(A <ITreeNode> ._)).ReturnsLazily(s => s.Arguments[0].DowncastTo <ITreeNode>());
        }
 public ContextMenuForObservedDataFolder(IMenuBarItemRepository menuBarItemRepository, ITreeNode <RootNodeType> treeNode,
                                         IExplorerPresenter presenter, IUserSettings userSettings)
 {
     _menuBarItemRepository = menuBarItemRepository;
     _treeNode     = treeNode;
     _presenter    = presenter;
     _userSettings = userSettings;
 }
        public override IContextMenu InitializeWith(RootNodeType rootNodeType, IExplorerPresenter presenter)
        {
            var sensitivityAnalysisRootNode = presenter.NodeByType(rootNodeType);

            _allMenuItems.Add(SensitivityAnalysisContextMenuItems.CreateSensitivityAnalysis());
            _allMenuItems.Add(ClassificationCommonContextMenuItems.CreateClassificationUnderMenu(sensitivityAnalysisRootNode, presenter).AsGroupStarter());
            _allMenuItems.Add(ClassificationCommonContextMenuItems.RemoveClassificationFolderMainMenu(sensitivityAnalysisRootNode, presenter));
            return(this);
        }
Esempio n. 4
0
        public override IContextMenu InitializeWith(RootNodeType rootNodeType, IExplorerPresenter presenter)
        {
            var parameterIdentificationRootNode = presenter.NodeByType(rootNodeType);

            _allMenuItems.Add(ParameterIdentificationContextMenuItems.CreateParameterIdentification());
            _allMenuItems.Add(ClassificationCommonContextMenuItems.CreateClassificationUnderMenu(parameterIdentificationRootNode, presenter).AsGroupStarter());
            _allMenuItems.Add(ClassificationCommonContextMenuItems.RemoveClassificationFolderMainMenu(parameterIdentificationRootNode, presenter));
            return(this);
        }
        public void InitializeDragAndDrop(IExplorerPresenter presenter)
        {
            _presenter = presenter;
            _treeView.CalcNodeDragImageIndex += (o, e) => onEvent(calcNodeDragImageIndex, e);

            _treeView.OptionsDragAndDrop.DragNodesMode = DragNodesMode.Multiple;
            _treeView.AllowDrop = true;

            _treeView.DragOver += (o, e) => onEvent(treeViewDragOver, e);
            _treeView.DragDrop += (o, e) => onEvent(treeViewDragDrop, e);
        }
Esempio n. 6
0
        public override IContextMenu InitializeWith(RootNodeType rootNodeType, IExplorerPresenter presenter)
        {
            var simulationFolderNode = presenter.NodeByType(rootNodeType);

            _allMenuItems.Add(createNewSimulationMenuBarItem());
            _allMenuItems.Add(createAddExistingSimulationMenuBarItem());
            _allMenuItems.Add(ClassificationCommonContextMenuItems.CreateClassificationUnderMenu(simulationFolderNode, presenter).AsGroupStarter());
            _allMenuItems.Add(SimulationClassificationCommonContextMenuItems.RemoveSimulationFolderMainMenu(simulationFolderNode, presenter).AsGroupStarter());
            _allMenuItems.Add(deleteAllSimulationResults().AsGroupStarter());
            return(this);
        }
        protected override void Context()
        {
            _rootNodeTypeMapper    = A.Fake <IClassificationTypeToRootNodeTypeMapper>();
            _projectRetriever      = A.Fake <IProjectRetriever>();
            _applicationController = A.Fake <IApplicationController>();
            _project = new PKSimProject();
            _classificationNodesCache = new Cache <IClassification, ITreeNode <IClassification> >(x => x.Tag, x => null);

            A.CallTo(() => _projectRetriever.CurrentProject).Returns(_project);
            sut = new ClassificationPresenter(_rootNodeTypeMapper, _applicationController, _projectRetriever);

            _explorerPresenter = A.Fake <IExplorerPresenter>();
            sut.InitializeWith(_explorerPresenter);

            _simulationFolderNode   = createRootNode(RootNodeTypes.SimulationFolder, ClassificationType.Simulation);
            _observedDataFolderNode = createRootNode(RootNodeTypes.ObservedDataFolder, ClassificationType.ObservedData);

            A.CallTo(() => _explorerPresenter.AddNode(A <ITreeNode> ._))
            .Invokes(x =>
            {
                var classificationNode = x.GetArgument <ITreeNode>(0) as ITreeNode <IClassification>;
                if (classificationNode != null)
                {
                    addToCache(classificationNode);
                }
            });

            A.CallTo(() => _explorerPresenter.RemoveNode(A <ITreeNode> ._))
            .Invokes(x =>
            {
                var classificationNode = x.GetArgument <ITreeNode>(0) as ITreeNode <IClassification>;
                if (classificationNode != null)
                {
                    removeFromCache(classificationNode);
                }
            });
        }
        private static IMenuBarSubMenu createGroupingSubMenu(ITreeNode <RootNodeType> treeNode, IExplorerPresenter presenter)
        {
            var groupMenu = CreateSubMenu.WithCaption(MenuNames.GroupBy);

            presenter.AvailableClassificationCategories(treeNode)
            .Each(classification => groupMenu.AddItem(
                      CreateMenuButton.WithCaption(classification.ClassificationName)
                      .WithActionCommand(() => presenter.AddToClassificationTree(treeNode, classification.ClassificationName))));

            return(groupMenu);
        }
 protected override IContextMenu CreateFor(ClassificationNode classificationNode, IExplorerPresenter presenter)
 {
     return(new ComparisonGroupingFolderContextMenu(classificationNode, presenter));
 }
Esempio n. 10
0
 protected void AttachPresenter(IExplorerPresenter presenter)
 {
     _presenter = presenter;
     _treeNodeExplorerViewDragDrogBinder.InitializeDragAndDrop(_presenter);
     treeView.ToolTipForNode = presenter.ToolTipFor;
 }
 public ParameterIdentificationFolderContextMenu(ITreeNode <RootNodeType> treeNode, IExplorerPresenter presenter)
 {
     _view.AddMenuItem(ParameterIdentificationContextMenuItems.CreateParameterIdentification());
     _view.AddMenuItem(ClassificationCommonContextMenuItems.CreateClassificationUnderMenu(treeNode, presenter).AsGroupStarter());
     _view.AddMenuItem(ClassificationCommonContextMenuItems.RemoveClassificationFolderMainMenu(treeNode, presenter));
 }
Esempio n. 12
0
 public virtual IContextMenu InitializeWith(RootNodeType rootNodeType, IExplorerPresenter presenter)
 {
     return(InitializeWith(presenter));
 }
 protected abstract IContextMenu CreateFor(ClassificationNode classificationNode, IExplorerPresenter presenter);
Esempio n. 14
0
        public static IMenuBarItem RemoveSimulationFolderMainMenu(ITreeNode <RootNodeType> simulationFolderNode, IExplorerPresenter presenter)
        {
            var groupMenu = CreateSubMenu.WithCaption(MenuNames.DeleteSubMenu)
                            .WithIcon(ApplicationIcons.Remove)
                            .AsGroupStarter();

            groupMenu.AddItem(ClassificationCommonContextMenuItems.DeleteChildrenClassificationsAndDateMenu(simulationFolderNode, presenter));
            groupMenu.AddItem(ClassificationCommonContextMenuItems.DeleteChildrenClassificationsAndKeepDataMenu(simulationFolderNode, presenter));
            return(groupMenu);
        }
Esempio n. 15
0
 public SensitivityAnalysisFolderContextMenu(ITreeNode <RootNodeType> treeNode, IExplorerPresenter presenter)
 {
     _view.AddMenuItem(SensitivityAnalysisContextMenuItems.CreateSensitivityAnalysis());
     _view.AddMenuItem(ClassificationCommonContextMenuItems.CreateClassificationUnderMenu(treeNode, presenter).AsGroupStarter());
     _view.AddMenuItem(ClassificationCommonContextMenuItems.RemoveClassificationFolderMainMenu(treeNode, presenter));
 }
Esempio n. 16
0
 public void InitializeWith(IExplorerPresenter explorerPresenter, IClassificationPresenter classificationPresenter)
 {
     _classificationPresenter = classificationPresenter;
     _explorerPresenter       = explorerPresenter;
 }
 public void InitializeWith(IExplorerPresenter explorerPresenter, IClassificationPresenter classificationPresenter, RootNodeType observedDataFolder)
 {
     _explorerPresenter       = explorerPresenter;
     _classificationPresenter = classificationPresenter;
     _observedDataFolder      = observedDataFolder;
 }
 public static IMenuBarButton CreateClassificationUnderMenu(ITreeNode <IClassification> classificationNode, IExplorerPresenter presenter)
 {
     return(CreateMenuButton.WithCaption(MenuNames.CreateGroup)
            .WithActionCommand(() => presenter.CreateClassificationUnder(classificationNode))
            .WithIcon(ApplicationIcons.Create));
 }
 public static IMenuBarButton DeleteChildrenClassificationsAndDateMenu(ITreeNode <IClassification> classificationNode, IExplorerPresenter presenter)
 {
     return(CreateMenuButton.WithCaption(MenuNames.DeleteSubFoldersAndData)
            .WithIcon(ApplicationIcons.Delete)
            .WithActionCommand(() => presenter.RemoveChildrenClassifications(classificationNode, removeParent: false, removeData: true)));
 }
 public static IMenuBarButton RemoveEmptyClassificationsMenu(IExplorerPresenter presenter)
 {
     return(CreateMenuButton.WithCaption(MenuNames.RemoveEmptyGroups)
            .WithActionCommand(presenter.RemoveEmptyClassifications)
            .WithIcon(ApplicationIcons.Delete));
 }
        /// <summary>
        ///    Returns the main menu entry for the remove section of a classification Node
        /// </summary>
        public static IMenuBarItem RemoveClassificationMainMenu(ITreeNode <IClassification> classificationNode, IExplorerPresenter presenter)
        {
            var groupMenu = CreateSubMenu.WithCaption(MenuNames.DeleteSubMenu)
                            .WithIcon(ApplicationIcons.Delete)
                            .AsGroupStarter();

            groupMenu.AddItem(DeleteClassificationAndDataMenu(classificationNode, presenter));
            groupMenu.AddItem(DeleteClassificationAndKeepDataMenu(classificationNode, presenter));

            return(groupMenu);
        }
 protected override IContextMenu CreateFor(ClassificationNode classificationNode, IExplorerPresenter presenter)
 {
     return(new ParameterIdentificationClassificationNodeContextMenu(classificationNode, presenter));
 }
 protected override IContextMenu CreateFor(ClassificationNode classificationNode, IExplorerPresenter presenter)
 {
     return(new SensitivityAnalysisClassificationNodeContextMenu(classificationNode, presenter));
 }
 protected override IContextMenu CreateFor(ClassificationNode classificationNode, IExplorerPresenter presenter)
 {
     return(new ObservedDataClassificationNodeContextMenu(classificationNode, presenter));
 }
 public void InitializeWith(IExplorerPresenter explorerPresenter)
 {
     _explorerPresenter = explorerPresenter;
 }