public static List<DataTemplateViewModel> GetSpecificElementsDiagramTemplate(SpecificElementsDiagramViewModel vm)
        {
            List<DataTemplateViewModel> templates = new List<DataTemplateViewModel>();
            templates.AddRange(GetDiagramClassTemplate(vm));

            // bindable properties and important methods
            string str = "The ViewModel generated for the SpecificElementsDiagram contains the following properties and methods: " + "\r\n" + "\r\n";
            
            str += " HostedElement:BaseModelElementViewModel (This is the currently hosted element)." + "\r\n";
            str += "      If the DomainClass currently hosted has a SpecificViewModel, than instead of the general BaseModelElementViewModel," + "\r\n";
            str += "      the specific VM is chosen" + "\r\n";

            str += " SelectedElementType:SelectedElementEnum (This is the type of the selected model)." + "\r\n";
            str += "      The SelectedElementEnum is automatically generated and contains the following values: " + "\r\n";
            str += "      - ___None___" + "\r\n";
            foreach(DomainClass d in (vm.DiagramClassView.DiagramClass as SpecificElementsDiagram).DomainClasses)
                str += "      - " + d.Name + "\r\n";
            str += "\r\n";

            str += " protected virtual void UpdateView()" + "\r\n";
            str += "      This method is called on every selection change." + "\r\n";
            str += "      The selection is saved in the 'SelectedItemsCollection' property" + "\r\n\r\n";

            str += " protected virtual void OnHostedElementDeleted" + "\r\n";
            str += "      This method is called if the hosted element is deleted." + "\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;
        }
Esempio n. 2
0
        public static List <DataTemplateViewModel> GetSpecificElementsDiagramTemplate(SpecificElementsDiagramViewModel vm)
        {
            List <DataTemplateViewModel> templates = new List <DataTemplateViewModel>();

            templates.AddRange(GetDiagramClassTemplate(vm));

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

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

            str += " SelectedElementType:SelectedElementEnum (This is the type of the selected model)." + "\r\n";
            str += "      The SelectedElementEnum is automatically generated and contains the following values: " + "\r\n";
            str += "      - ___None___" + "\r\n";
            foreach (DomainClass d in (vm.DiagramClassView.DiagramClass as SpecificElementsDiagram).DomainClasses)
            {
                str += "      - " + d.Name + "\r\n";
            }
            str += "\r\n";

            str += " protected virtual void UpdateView()" + "\r\n";
            str += "      This method is called on every selection change." + "\r\n";
            str += "      The selection is saved in the 'SelectedItemsCollection' property" + "\r\n\r\n";

            str += " protected virtual void OnHostedElementDeleted" + "\r\n";
            str += "      This method is called if the hosted element is deleted." + "\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);
            }
        }