public ObservedDataFolderContextMenu(
            ITreeNode <RootNodeType> treeNode,
            IMenuBarItemRepository repository,
            IBuildingBlockRepository buildingBlockRepository,
            IBuildingBlockExplorerPresenter presenter,
            IUserSettings userSettings)
        {
            var allCompounds = buildingBlockRepository.All <Compound>().ToList();

            //create sub menu containing all compounds
            var addObservedDataFor = CreateSubMenu.WithCaption(PKSimConstants.MenuNames.AddObservedDataFor)
                                     .WithIcon(ApplicationIcons.ObservedDataForMolecule);


            foreach (var compound in allCompounds)
            {
                addObservedDataFor.AddItem(CreateMenuButton.WithCaption(compound.Name)
                                           .WithCommandFor <AddObservedDataForCompoundUICommand, Compound>(compound));
            }

            _view.AddMenuItem(repository[MenuBarItemIds.AddObservedData]);
            if (allCompounds.Any())
            {
                _view.AddMenuItem(addObservedDataFor);
            }

            if (treeNode.HasChildren)
            {
                _view.AddMenuItem(ObservedDataClassificationCommonContextMenuItems.ColorGroupObservedData(userSettings));
            }


            _view.AddMenuItem(CreateMenuButton.WithCaption(PKSimConstants.MenuNames.LoadFromTemplate)
                              .WithCommand <LoadObservedDataFromTemplateUICommand>()
                              .WithIcon(ApplicationIcons.LoadFromTemplate)
                              .AsGroupStarter());

            _view.AddMenuItem(CreateMenuButton.WithCaption(PKSimConstants.MenuNames.AsDeveloperOnly("Load from Snapshot"))
                              .WithCommand <LoadObservedDataFromSnapshotUICommand>()
                              .WithIcon(ApplicationIcons.SnapshotImport)
                              .ForDeveloper());


            if (treeNode.AllLeafNodes.OfType <ObservedDataNode>().Any())
            {
                _view.AddMenuItem(ObservedDataClassificationCommonContextMenuItems.EditMultipleMetaData(treeNode).AsGroupStarter());
            }


            _view.AddMenuItem(ClassificationCommonContextMenuItems.CreateClassificationUnderMenu(treeNode, presenter));

            var groupMenu = createGroupingSubMenu(treeNode, presenter);

            if (groupMenu.AllItems().Any())
            {
                _view.AddMenuItem(groupMenu);
            }

            _view.AddMenuItem(createDeleteSubMenu(treeNode, presenter));
        }
Example #2
0
 private static IMenuBarItem createDeleteSubMenu(ITreeNode <RootNodeType> treeNode, IBuildingBlockExplorerPresenter presenter)
 {
     return(ClassificationCommonContextMenuItems.RemoveClassificationFolderMainMenu(treeNode, presenter));
 }
Example #3
0
        private static IMenuBarSubMenu createGroupingSubMenu(ITreeNode <RootNodeType> treeNode, IBuildingBlockExplorerPresenter 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);
        }
 public ShowBuildingBlockExplorerCommand(IBuildingBlockExplorerPresenter buildingBlockExplorerPresenter)
 {
     _buildingBlockExplorerPresenter = buildingBlockExplorerPresenter;
 }
 public void AttachPresenter(IBuildingBlockExplorerPresenter presenter)
 {
     base.AttachPresenter(presenter);
 }
Example #6
0
 protected override void Context()
 {
     _presenter = A.Fake <IBuildingBlockExplorerPresenter>();
     sut        = new ContextMenuFactoryForBuildingBlock <IMoleculeBuildingBlock>();
 }