protected override void SetLayoutMenuItems(IContextMenuView contextMenuView, IContainerBase containerBase)
 {
     AddTemplateLayoutMenuItems(contextMenuView, containerBase);
     AddAutoLayoutMenuItems(contextMenuView, containerBase);
     contextMenuView.AddMenuItem(SubMenuLayout);
     contextMenuView.AddMenuItem(CreateMenuButton.WithCaption("AutoLayout in layers")
                                 .WithActionCommand(() => Presenter.LayerLayout(containerBase)));
 }
        protected override void SetLayoutMenuItems(IContextMenuView contextMenuView, IContainerBase containerBase)
        {
            AddTemplateLayoutMenuItems(contextMenuView, containerBase);

            contextMenuView.AddMenuItem(CreateMenuButton.WithCaption("Apply current Layouts from Structure and Reactions")
                                        .WithActionCommand(askAndApplySpaceReactionLayout));

            AddAutoLayoutMenuItems(contextMenuView, containerBase);
            contextMenuView.AddMenuItem(SubMenuLayout);
        }
 private void createRemoveCommandFor(IContextMenuView contextMenuView, T entity)
 {
     if (entity.IsAnImplementationOf <IReactionBuilder>())
     {
         contextMenuView.AddMenuItem(CreateMenuButton.WithCaption(AppConstants.MenuNames.Delete)
                                     .WithRemoveCommand(Presenter.Subject.DowncastTo <IMoBiReactionBuildingBlock>(), entity).WithIcon(ApplicationIcons.Delete));
     }
     else
     {
         contextMenuView.AddMenuItem(CreateMenuButton.WithCaption(AppConstants.MenuNames.Delete)
                                     .WithRemoveCommand(entity.ParentContainer, entity).WithIcon(ApplicationIcons.Delete));
     }
 }
Пример #4
0
        protected virtual void SetSelectionMenuItems(IContextMenuView contextMenuView, IContainerBase containerBase, IBaseNode node)
        {
            contextMenuView.AddMenuItem(SubMenuSelect);

            if (containerBase != null)
            {
                SubMenuSelect.AddItem(CreateMenuButton.WithCaption("All Children")
                                      .WithActionCommand(() => Presenter.SelectChildren(containerBase)));
            }

            if (Presenter.SelectionContains <IBaseNode>())
            {
                SubMenuSelect.AddItem(CreateMenuButton.WithCaption("Visible Linked nodes")
                                      .WithActionCommand(() => Presenter.SelectVisibleLinkedNodesForDiagramSelection()));
                if (node != null)
                {
                    SubMenuSelect.AddItem(CreateMenuButton.WithCaption("Invert Selection")
                                          .WithActionCommand(() => Presenter.InvertSelection(node.GetParent())));
                }

                IHasLayoutInfo selectedNode = Presenter.GetFirstSelected <IHasLayoutInfo>();
                if (selectedNode != null)
                {
                    SubMenuDiagram.AddItem(CreateMenuCheckButton.WithCaption("Location Fixed").AsGroupStarter()
                                           .WithChecked(selectedNode.LocationFixed)
                                           .WithCheckedAction(locationFixed => Presenter.SetLocationFixedForDiagramSelection(locationFixed)));
                }

                contextMenuView.AddMenuItem(CreateMenuButton.WithCaption("Hide Selection").WithActionCommand(() => Presenter.HideSelection()));
            }

            if (Presenter.SelectionContains <IElementBaseNode>())
            {
                var subMenuNodeSize = CreateSubMenu.WithCaption("Nodesize")
                                      .WithItem(CreateMenuButton.WithCaption("Large").WithActionCommand(() => Presenter.SetNodeSizeForDiagramSelection(NodeSize.Large)))
                                      .WithItem(CreateMenuButton.WithCaption("Middle").WithActionCommand(() => Presenter.SetNodeSizeForDiagramSelection(NodeSize.Middle)))
                                      .WithItem(CreateMenuButton.WithCaption("Small").WithActionCommand(() => Presenter.SetNodeSizeForDiagramSelection(NodeSize.Small)));
                contextMenuView.AddMenuItem(subMenuNodeSize);
            }

            // Shows all children (e.g. after hiding a selection)

            if (containerBase != null)
            {
                contextMenuView.AddMenuItem(CreateMenuButton.WithCaption("Show All Children").WithActionCommand(() => Presenter.ShowChildren(containerBase)));
            }
        }
        protected override void SetModelMenuItems(IContextMenuView contextMenuView, IContainerBase containerBase, IBaseNode node)
        {
            var parent   = Presenter.Subject as IMoBiSpatialStructure;
            var menuItem = CreateMenuButton.WithCaption(AppConstants.MenuNames.AddNew("Top Container"))
                           .WithCommandFor <AddNewTopContainerCommand, IMoBiSpatialStructure>(parent)
                           .WithIcon(ApplicationIcons.ContainerAdd);

            contextMenuView.AddMenuItem(menuItem);

            var menuItem2 = CreateMenuButton.WithCaption(AppConstants.MenuNames.AddExisting("Top Container"))
                            .WithCommand <AddExistingTopContainerCommand>()
                            .WithIcon(ApplicationIcons.ContainerLoad);

            contextMenuView.AddMenuItem(menuItem2);

            base.SetModelMenuItems(contextMenuView, containerBase, node);
        }
        protected override void SetModelMenuItems(IContextMenuView contextMenuView, IContainerBase containerBase, IBaseNode node)
        {
            var entity = Get <T>(node.Id);

            contextMenuView.AddMenuItem(CreateMenuButton.WithCaption(AppConstants.MenuNames.Rename)
                                        .WithCommandFor <RenameObjectCommand <T>, T>(entity).WithIcon(ApplicationIcons.Rename));

            contextMenuView.AddMenuItem(CreateMenuButton.WithCaption(AppConstants.MenuNames.Edit)
                                        .WithCommandFor <EditCommandFor <T>, T>(entity).WithIcon(ApplicationIcons.Edit));

            contextMenuView.AddMenuItem(CreateMenuButton.WithCaption(AppConstants.MenuNames.SaveAsPKML)
                                        .WithCommandFor <SaveUICommandFor <T>, T>(entity).WithIcon(ApplicationIcons.SaveIconFor(typeof(T).Name)));

            createRemoveCommandFor(contextMenuView, entity);

            base.SetModelMenuItems(contextMenuView, containerBase, node);
        }
        protected override void SetModelMenuItems(IContextMenuView contextMenuView, IContainerBase containerBase, IBaseNode node)
        {
            contextMenuView.AddMenuItem(CreateMenuButton.WithCaption(AppConstants.RibbonButtonNames.NewMolecule)
                                        .WithActionCommand(() => Presenter.AddMoleculeNode())
                                        .WithIcon(ApplicationIcons.MoleculeAdd));

            var parent = Presenter.Subject as IMoBiReactionBuildingBlock;

            contextMenuView.AddMenuItem(CreateMenuButton.WithCaption(AppConstants.MenuNames.AddNew(ObjectTypes.Reaction))
                                        .WithCommandFor <AddNewCommandFor <IMoBiReactionBuildingBlock, IReactionBuilder>, IMoBiReactionBuildingBlock>(parent)
                                        .WithIcon(ApplicationIcons.ReactionAdd));

            contextMenuView.AddMenuItem(CreateMenuButton.WithCaption(AppConstants.MenuNames.AddExisting(ObjectTypes.Reaction))
                                        .WithCommandFor <AddExistingCommandFor <IMoBiReactionBuildingBlock, IReactionBuilder>, IMoBiReactionBuildingBlock>(parent)
                                        .WithIcon(ApplicationIcons.ReactionLoad));

            base.SetModelMenuItems(contextMenuView, containerBase, node);
        }
Пример #8
0
        protected virtual void SetDiagramMenuItems(IContextMenuView contextMenuView, IContainerBase containerBase)
        {
            contextMenuView.AddMenuItem(CreateMenuButton.WithCaption("Refresh").WithActionCommand(() => Presenter.Refresh()).WithIcon(ApplicationIcons.Refresh).AsGroupStarter());

            contextMenuView.AddMenuItem(CreateMenuButton.WithCaption("Undo Diagram Layout Change").WithActionCommand(() => Presenter.Undo()).WithIcon(ApplicationIcons.Undo));

            if (Presenter.SelectionContains <IBaseNode>())
            {
                SubMenuDiagram.AddItem(CreateMenuButton.WithCaption("To Front").AsGroupStarter().WithActionCommand(() => Presenter.MoveDiagramSelectionToFront()).WithIcon(ApplicationIcons.Forward));
                SubMenuDiagram.AddItem(CreateMenuButton.WithCaption("To Back").WithActionCommand(() => Presenter.MoveDiagramSelectionToBack()).WithIcon(ApplicationIcons.Back));
            }


            SubMenuDiagram.AddItem(CreateMenuButton.WithCaption("Zoom In").AsGroupStarter().WithCommand <ZoomInCommand>().WithIcon(ApplicationIcons.ZoomIn));
            SubMenuDiagram.AddItem(CreateMenuButton.WithCaption("Zoom Out").WithCommand <ZoomOutCommand>().WithIcon(ApplicationIcons.ZoomOut));
            SubMenuDiagram.AddItem(CreateMenuButton.WithCaption("Fit into Window").WithCommand <FitToPageCommand>().WithIcon(ApplicationIcons.FitToPage));
            SubMenuDiagram.AddItem(CreateMenuButton.WithCaption("Copy Image to Clipboard").AsGroupStarter().WithActionCommand(() => Presenter.CopyBitmapToClipboard(containerBase)));
            SubMenuDiagram.AddItem(CreateMenuButton.WithCaption("Save Image...").WithActionCommand(() => Presenter.SaveBitmapToFile(containerBase)));

            contextMenuView.AddMenuItem(SubMenuDiagram);
        }
Пример #9
0
        protected override void SetModelMenuItems(IContextMenuView contextMenuView, IContainerBase containerBase, IBaseNode node)
        {
            var container = Get <IContainer>(node.Id);

            contextMenuView.AddMenuItem(CreateMenuButton.WithCaption(AppConstants.MenuNames.AddNew(ObjectTypes.Container))
                                        .WithCommandFor <AddNewCommandFor <IContainer, IContainer>, IContainer>(container)
                                        .WithIcon(ApplicationIcons.ContainerAdd));

            contextMenuView.AddMenuItem(CreateMenuButton.WithCaption(AppConstants.MenuNames.AddExisting(ObjectTypes.Container))
                                        .WithCommandFor <AddExistingCommandFor <IContainer, IContainer>, IContainer>(container)
                                        .WithIcon(ApplicationIcons.ContainerLoad));

            contextMenuView.AddMenuItem(CreateMenuButton.WithCaption(AppConstants.MenuNames.AddNew(ObjectTypes.Parameter))
                                        .WithCommandFor <AddNewCommandFor <IContainer, IParameter>, IContainer>(container)
                                        .WithIcon(ApplicationIcons.Parameters));

            contextMenuView.AddMenuItem(CreateMenuButton.WithCaption(AppConstants.MenuNames.AddExisting(ObjectTypes.Parameter))
                                        .WithCommandFor <AddExistingCommandFor <IContainer, IParameter>, IContainer>(container)
                                        .WithIcon(ApplicationIcons.PKMLLoad));

            contextMenuView.AddMenuItem(CreateMenuButton.WithCaption(AppConstants.MenuNames.AddNew(ObjectTypes.DistributedParameter))
                                        .WithCommandFor <AddNewCommandFor <IContainer, IDistributedParameter>, IContainer>(container)
                                        .WithIcon(ApplicationIcons.ParameterDistribution));

            base.SetModelMenuItems(contextMenuView, containerBase, node);

            if (container.ParentContainer == null) // container is TopContainer
            {
                contextMenuView.RemoveMenuItem(AppConstants.MenuNames.Delete);
                contextMenuView.AddMenuItem(CreateMenuButton.WithCaption(AppConstants.MenuNames.Delete)
                                            .WithCommandFor <RemoveTopContainerCommand, IContainer>(Get <IContainer>(node.Id))
                                            .WithIcon(ApplicationIcons.Delete));
            }
        }
        protected override void SetSelectionMenuItems(IContextMenuView contextMenuView, IContainerBase containerBase, IBaseNode node)
        {
            if (!Presenter.IsReactionNode(node))
            {
                return;
            }

            contextMenuView.AddMenuItem(CreateMenuCheckButton.WithCaption("Connect Educts right")
                                        .WithChecked(Presenter.DisplayEductsRight(node))
                                        .WithCheckedAction(displayRight => Presenter.SetDisplayEductsRightForDiagramSelection(displayRight)));

            base.SetSelectionMenuItems(contextMenuView, containerBase, node);
        }
Пример #11
0
        protected void SetDetailedMenuItems(IContextMenuView contextMenuView, IContainerBase containerBase)
        {
            var subMenuDetailed = CreateSubMenu.WithCaption("Expert Functions").AsGroupStarter();

            contextMenuView.AddMenuItem(subMenuDetailed);


            var subMenuShow = CreateSubMenu.WithCaption("Show / Hide");

            if (Presenter.SelectionContains <IBaseNode>())
            {
                subMenuDetailed.AddItem(subMenuShow);
            }

            subMenuShow.AddItem(
                CreateMenuButton.WithCaption("Hide not Linked Nodes").WithActionCommand(() => Presenter.HideNotLinkedNodes()));
            subMenuShow.AddItem(
                CreateMenuButton.WithCaption("Show Linked Nodes").WithActionCommand(() => Presenter.ShowLinkedNodes()));

            var subMenuExpand = CreateSubMenu.WithCaption("Expand / Collapse");

            subMenuDetailed.AddItem(subMenuExpand);

            subMenuExpand.AddItem(
                CreateMenuButton.WithCaption("Set Default Expansion").WithActionCommand(() => Presenter.SetDefaultExpansion()));
            subMenuExpand.AddItem(
                CreateMenuButton.WithCaption("Show Default Expansion")
                .WithActionCommand(() => Presenter.ShowDefaultExpansion()));

            if (Presenter.SelectionContains <IContainerNode>())
            {
                AddExpandMenuItems(subMenuExpand);
            }


            var subMenuDiagram = CreateSubMenu.WithCaption("Diagram");

            subMenuDetailed.AddItem(subMenuDiagram);

            subMenuDiagram.AddItem(
                CreateMenuButton.WithCaption("Copy clipping as Bitmap")
                .WithActionCommand(() => Presenter.CopyBitmapToClipboard(null)));
            subMenuDiagram.AddItem(
                CreateMenuButton.WithCaption("Print Preview...").WithActionCommand(() => Presenter.PrintDiagram()));

            var subMenuLayout = CreateSubMenu.WithCaption("Layout");

            if (containerBase != null)
            {
                subMenuDetailed.AddItem(subMenuLayout);
            }
            subMenuLayout.AddItem(
                CreateMenuButton.WithCaption("AutoLayout Grandchildren")
                .WithActionCommand(
                    () =>
                    Presenter.Layout(containerBase, AppConstants.Diagram.Base.LayoutDepthGrandChildren,
                                     null)));
            subMenuLayout.AddItem(
                CreateMenuButton.WithCaption("AutoLayout all Descendants")
                .WithActionCommand(
                    () => Presenter.Layout(containerBase, AppConstants.Diagram.Base.LayoutDepthAll, null)));
            if (_runOptions.IsDeveloperMode)
            {
                var subMenuDeveloper = CreateSubMenu.WithCaption("Developer Functions").AsGroupStarter()
                                       .WithItem(
                    CreateMenuButton.WithCaption("Position at 0")
                    .WithActionCommand(() => Presenter.Position0Selection()));
                subMenuDetailed.AddItem(subMenuDeveloper);
            }
        }
Пример #12
0
 protected virtual void SetLayoutMenuItems(IContextMenuView contextMenuView, IContainerBase containerBase)
 {
     AddAutoLayoutMenuItems(contextMenuView, containerBase);
     contextMenuView.AddMenuItem(SubMenuLayout);
 }
Пример #13
0
 public void Show(IView parentView, Point popupLocation)
 {
     AllMenuItems().Each(item => _view.AddMenuItem(item));
     _view.Display(parentView, popupLocation);
 }
Пример #14
0
 protected override void SetLayoutMenuItems(IContextMenuView contextMenuView, IContainerBase containerBase)
 {
     AddTemplateLayoutMenuItems(contextMenuView, containerBase);
     AddAutoLayoutMenuItems(contextMenuView, containerBase);
     contextMenuView.AddMenuItem(SubMenuLayout);
 }