Example #1
0
        public static List <DataTemplateViewModel> GetModalDiagramTemplate(ModalDiagramViewModel vm)
        {
            List <DataTemplateViewModel> templates = new List <DataTemplateViewModel>();

            templates.AddRange(GetDiagramClassTemplate(vm));

            // bindable properties and important methods
            string str = "The ViewModel generated for the ModalDiagram contains the following properties and methods: " + "\r\n" + "\r\n";

            str += " HostedElementVM:BaseModelElementViewModel (This is the currently hosted element)." + "\r\n";
            str += "      If the hosted DomainClass has a SpecificViewModel, than instead of the general BaseModelElementViewModel," + "\r\n";
            str += "      the specific VM is chosen" + "\r\n\r\n";

            str += " HostedElement:DomainModelElement (This is the hosted element)." + "\r\n";
            str += "\r\n";

            str += " TitleExtension:string (This is the extension added to the docking window title after the title of the diagram)." + "\r\n";
            str += "\r\n";

            str += " NameExtension:string (This is the extension added to the identification name after the name of the diagram)." + "\r\n";
            str += "\r\n";

            str += " protected virtual void OnModelElementDeleted" + "\r\n";
            str += "      This method is called if the hosted element is deleted." + "\r\n\r\n";

            str += " protected virtual void DragOver" + "\r\n";
            str += "      This method is called during a drag over operation." + "\r\n\r\n";

            str += " protected virtual void Drop" + "\r\n";
            str += "      This method is called after an element was dropped on the diagram surface (see remarks below on Drag&Drop)." + "\r\n\r\n";

            str += " For Drag&Drop to work, the xaml part of the view has to implement specific attributes: " + "\r\n";
            str += "    dd:DragDrop.IsDropTarget and dd:DragDrop.DropHandler " + "\r\n\r\n";
            str += " An example is given below: " + "\r\n";
            str += "    xmlns:dd=\"clr-namespace:Tum.PDE.ToolFramework.Modeling.Visualization.Controls.Attached.DragDrop\"" + "\r\n";
            str += "    <Border Grid.Row=\"3\" HorizontalAlignment=\"Stretch\" VerticalAlignment=\"Stretch\"" + "\r\n";
            str += "        Background=\"Transparent\" dd:DragDrop.IsDropTarget=\"True\" dd:DragDrop.DropHandler=\"{Binding}\"/>" + "\r\n\r\n";

            DataTemplateViewModel template = new DataTemplateViewModel(vm.ViewModelStore,
                                                                       "Customization/Visualization", str);

            template.ImageUri    = "/Tum.PDE.LanguageDSL.Visualization;component/Resources/Images/Class_32.png";
            template.Description = "This template provides help on customizing and visualizing the view.";
            templates.Add(template);

            return(templates);
        }
        /// <summary>
        /// Adds a new diagram class view model for the given node.
        /// </summary>
        /// <param name="node">Node.</param>
        public void AddDiagramClassView(DiagramClassView node)
        {
            // verify that node hasnt been added yet
            foreach (DiagramClassViewModel viewModel in this.rootNodeVMs)
                if (viewModel.DiagramClassView.Id == node.Id)
                    return;

            if (node.DiagramClass is SpecificDependencyDiagram)
            {
                SpecificDependencyDiagramViewModel vm = new SpecificDependencyDiagramViewModel(this.ViewModelStore, node, this);
                this.rootNodeVMs.Add(vm);
            }
            else if (node.DiagramClass is DependencyDiagram)
            {
                DependencyDiagramViewModel vm = new DependencyDiagramViewModel(this.ViewModelStore, node, this);
                this.rootNodeVMs.Add(vm);
            }
            else if (node.DiagramClass is ModalDiagram)
            {
                ModalDiagramViewModel vm = new ModalDiagramViewModel(this.ViewModelStore, node, this);
                this.rootNodeVMs.Add(vm);
            }
            else if (node.DiagramClass is SpecificElementsDiagram)
            {
                SpecificElementsDiagramViewModel vm = new SpecificElementsDiagramViewModel(this.ViewModelStore, node, this);
                this.rootNodeVMs.Add(vm);
            }
            else
            {
                DiagramClassViewModel vm = new DiagramClassViewModel(this.ViewModelStore, node, this);
                this.rootNodeVMs.Add(vm);
            }
        }
        public static List<DataTemplateViewModel> GetModalDiagramTemplate(ModalDiagramViewModel vm)
        {
            List<DataTemplateViewModel> templates = new List<DataTemplateViewModel>();
            templates.AddRange(GetDiagramClassTemplate(vm));

            // bindable properties and important methods
            string str = "The ViewModel generated for the ModalDiagram contains the following properties and methods: " + "\r\n" + "\r\n";

            str += " HostedElementVM:BaseModelElementViewModel (This is the currently hosted element)." + "\r\n";
            str += "      If the hosted DomainClass has a SpecificViewModel, than instead of the general BaseModelElementViewModel," + "\r\n";
            str += "      the specific VM is chosen" + "\r\n\r\n";

            str += " HostedElement:DomainModelElement (This is the hosted element)." + "\r\n";
            str += "\r\n";

            str += " TitleExtension:string (This is the extension added to the docking window title after the title of the diagram)." + "\r\n";
            str += "\r\n";

            str += " NameExtension:string (This is the extension added to the identification name after the name of the diagram)." + "\r\n";
            str += "\r\n";

            str += " protected virtual void OnModelElementDeleted" + "\r\n";
            str += "      This method is called if the hosted element is deleted." + "\r\n\r\n";

            str += " protected virtual void DragOver" + "\r\n";
            str += "      This method is called during a drag over operation." + "\r\n\r\n";

            str += " protected virtual void Drop" + "\r\n";
            str += "      This method is called after an element was dropped on the diagram surface (see remarks below on Drag&Drop)." + "\r\n\r\n";

            str += " For Drag&Drop to work, the xaml part of the view has to implement specific attributes: " + "\r\n";
            str += "    dd:DragDrop.IsDropTarget and dd:DragDrop.DropHandler " + "\r\n\r\n";
            str += " An example is given below: " + "\r\n";
            str += "    xmlns:dd=\"clr-namespace:Tum.PDE.ToolFramework.Modeling.Visualization.Controls.Attached.DragDrop\"" + "\r\n";
            str += "    <Border Grid.Row=\"3\" HorizontalAlignment=\"Stretch\" VerticalAlignment=\"Stretch\"" + "\r\n";
            str += "        Background=\"Transparent\" dd:DragDrop.IsDropTarget=\"True\" dd:DragDrop.DropHandler=\"{Binding}\"/>" + "\r\n\r\n";

            DataTemplateViewModel template = new DataTemplateViewModel(vm.ViewModelStore,
                   "Customization/Visualization", str);
            template.ImageUri = "/Tum.PDE.LanguageDSL.Visualization;component/Resources/Images/Class_32.png";
            template.Description = "This template provides help on customizing and visualizing the view.";
            templates.Add(template);

            return templates;
        }