Beispiel #1
0
        public bool Set(Element deleted, DiagramController activeDiagramController)
        {
            List <Element> List = new List <Element>();

            List.Add(deleted);
            return(Set(List, activeDiagramController));
        }
        public TeacherEnvironmentView(Model.QuestionList list)
        {
            InitializeComponent();
            this.Size = new Size(1280, 720);
            this.Text = "Vragenlijst: " + list.Name;

            this.QuestionsListBox.DisplayMember = "Text";
            this.QuestionsListBox.ValueMember = "Id";
            this.QuestionsListBox.DataSource = this.Questions;

            DiagramView diagramView = new DiagramView();
            this.DiagramController = new DiagramController(diagramView);

            AddQuestionView addQuestionView = new AddQuestionView(null,true);
            AddQuestionController addQuestionController = new AddQuestionController();
            addQuestionController.SetView(addQuestionView);
            addQuestionController.SetQuestionList(list);

            //use the event, to close the docentform when clicked on Quit
            addQuestionController.RemoveAddQuestionPanel += CloseForm;
            addQuestionController.QuestionSavedSucces += QuestionAdded;

            this.tableLeft.Controls.Add(diagramView.getTable(), 0, 0);
            this.tableWrapper.Controls.Add(addQuestionView.getTable(), 1, 0);
        }
Beispiel #3
0
 /// <summary>
 /// Creates new instance of <see cref="DeleteFromPSMDiagramCommand" />.
 /// </summary>
 /// <param name="Controller">command controller</param>
 public DeleteFromPSMDiagramCommand(DiagramController Controller)
     : base(Controller)
 {
     DeletedElementsViewHelpers = new Dictionary <Element, ViewHelper>();
     Description   = CommandDescription.REMOVE_FROM_DIAGRAM;
     CheckOrdering = true;
 }
 /// <summary>
 /// Creates new instance of NewModelCommentToDiagramCommand
 /// <param name="diagramController">Associated diagram controller</param>
 /// </summary>
 public override IStackedCommand Create(DiagramController diagramController)
 {
     return(new NewModelCommentToDiagramCommand(diagramController)
     {
         AnnotatedElement = diagramController.ModelController.Model
     });
 }
Beispiel #5
0
        public AddPSMDiagramReferenceCommand(DiagramController controller)
            : base(controller)
        {
            Description = CommandDescription.PSM_ADD_DIAGRAM_REFERENCE;

            ViewHelper = new PSMElementViewHelper(Diagram);
        }
 public PresentationSelectionTool(DiagramController controller)
     : base(controller)
 {
     singletons.Add(controller, this);
     this.SelectMode = SelectMode.Containing;
     AllowMultiSelect = true;
 }
Beispiel #7
0
 public void Awake()
 {
     diagramController = GetComponent <DiagramController>();
     objToNode         = new Dictionary <GameObject, NodeData>();
     objToLink         = new Dictionary <GameObject, LinkData>();
     nodesToLinkObj    = new Dictionary <NodePair, GameObject>();
 }
Beispiel #8
0
        /// <summary>
        /// Creates a new instance of the command.
        /// </summary>
        /// <param name="diagramController">Reference to the associated model controller</param>
        public NewPSMAttributeContainerCommand(DiagramController diagramController)
            : base(diagramController)
        {
            Description        = CommandDescription.ADD_PSM_ATTRIBUTE_CONTAINER;
            this.psmAttributes = new List <PSMAttribute>();

            ViewHelper = new PSMElementViewHelper(diagramController.Diagram);
        }
Beispiel #9
0
        public LiftingXSLT(DiagramController C) : base(C)
        {
            RDFElement = new XElement(nsrdf + "RDF");

            Stylesheet.Add(new XElement(nsxsl + "template",
                                        new XAttribute("match", "/"),
                                        RDFElement));
        }
Beispiel #10
0
 /// <summary>
 /// Unbinds the canvas from the model events
 /// </summary>
 public void Unbind()
 {
     if (Controller != null)
     {
         Controller.Diagram.ElementRemoved -= Diagram_ElementRemoved;
         Controller.Diagram.ElementAdded   -= Diagram_ElementAdded;
     }
     controller = null;
 }
Beispiel #11
0
 public GroupByCommand(DiagramController controller)
     : base(controller)
 {
     Associations           = new List <PSMAssociation>();
     createdAssociations    = new List <NewPSMAssociationCommand>();
     deletedAssociations    = new List <DeleteFromPSMDiagramCommand>();
     visualizedAssociations = new List <ElementToDiagramCommand <PSMAssociation, PSMAssociationViewHelper> >();
     Description            = CommandDescription.GROUP_BY;
 }
Beispiel #12
0
 public ChangePSMDiagramTargetNamespaceCommand(DiagramController controller)
     : base(controller)
 {
     Description = CommandDescription.CHANGE_DIAGRAM_TARGET_NAMESPACE;
     if (!(controller.Diagram is PSMDiagram))
     {
         throw new ArgumentException(CommandError.NOT_PSM_DIAGRAM);
     }
 }
        public async Task RemoveDiagram()
        {
            itemsMocker.Setup(i => i.Remove(It.Is <DbDiagram>(item => item.DbDiagramId == SampleDiagram.DbDiagramId)));

            contextMocker.Setup(c => c.Diagrams).Returns(itemsMocker.Object);
            sut = new DiagramController(contextMocker.Object, testerMocker.Object);

            await sut.Remove(SampleDiagram.DbDiagramId);
        }
    public virtual void Initialize(NodeData node, DiagramController controller, ERDiagram currDiag)
    {
        nodeAttached      = node;
        diagramController = controller;
        textComp.text     = node.nodeName;

        diagram      = currDiag;
        beingDragged = false;

        UpdateSprite();
    }
 public override void Initialize(NodeData node, DiagramController controller, ERDiagram diagram)
 {
     base.Initialize(node, controller, diagram);
     index = states.IndexOf(nodeAttached.nodeName);
     if (index == -1)
     {
         //Not nodeName found on the list
         index = 0;
     }
     nodeAttached.Rename(states[index]);
 }
Beispiel #16
0
        public void PerformAnalysisTestRule1()
        {
            DiagramController controller = new DiagramController();
            DiagramRequest    request    = new DiagramRequest();

            request.DiagramXml = File.ReadAllText("TestItems\\SampleDiagram.txt");
            var test    = controller.PerformAnalysis(request, 1);
            var jstring = Newtonsoft.Json.JsonConvert.SerializeObject(test);

            Trace.Write(jstring);
            Assert.AreEqual(test.Count, 3);
        }
Beispiel #17
0
        /// <summary>
        /// Creates new instance of <see cref="ElementToDiagramCommand{ElementType,ViewHelperType}">ElementToDiagamCommand</see>.
        /// </summary>
        /// <param name="diagramController"></param>
        public ElementToDiagramCommand(DiagramController diagramController)
            : base(diagramController)
        {
            ConstructorInfo constructor = typeof(ViewHelperType).GetConstructor(new Type[] { typeof(Diagram) });

            Description = CommandDescription.ADD_ELEMENT_TO_DIAGRAM;
            if (constructor == null)
            {
                throw new InvalidOperationException(string.Format("ViewHelperType {0} must have a public constructor with signature 'ViewHelperType(Diagram)' when used in ElementToDiagramCommand.", typeof(ViewHelperType).Name));
            }
            ViewHelper = (ViewHelperType)constructor.Invoke(new object[] { diagramController.Diagram });
        }
Beispiel #18
0
        public ExportOWL(DiagramController C)
        {
            controller = C;
            nsproject  = controller.Project.Schema.XMLNamespaceOrDefaultNamespace;

            Namespaces.Add(nsrdf, "rdf");
            Namespaces.Add(nsrdfs, "rdfs");
            Namespaces.Add(nsowl, "owl");
            Namespaces.Add(nsxs, "xs");

            rdfElement = new XElement(nsrdf + "RDF", new XElement(nsowl + "Ontology", new XAttribute(nsrdf + "about", nsproject.NamespaceName)));
            doc.Add(rdfElement);
        }
        public async Task ReturnToUserOnInvalidQuery()
        {
            itemsMocker.Setup(i => i.Add(It.Is <DbDiagram>(item => CompareSample(item, SampleDiagram))));
            contextMocker.Setup(c => c.Diagrams).Returns(itemsMocker.Object);
            testerMocker.Setup(c => c.TestTableSetup(
                                   It.Is <string>(query => SampleQuery.Equals(query))))
            .ReturnsAsync("ERROR");
            sut = new DiagramController(contextMocker.Object, testerMocker.Object);

            await sut.Create();

            await sut.Create(SampleDiagram, null);
        }
Beispiel #20
0
        public void PerformAnalysisTestRule4()
        {
            DiagramController controller = new DiagramController();
            DiagramRequest    request    = new DiagramRequest();

            request.DiagramXml = File.ReadAllText("TestItems\\Rule4.xml");
            var test = controller.PerformAnalysis(request, 1);

            Assert.IsTrue(test.Count == 6, "Rule 4");
            var jstring = Newtonsoft.Json.JsonConvert.SerializeObject(test);

            Trace.Write(jstring);
        }
Beispiel #21
0
        /// <summary>
        /// Updates the text formatting for selected node.
        /// </summary>
        private void UpdateUITextFormatting()
        {
            DiagramController controller = this.diagramComponent.Controller;

            if (controller == null || controller.TextEditor == null)
            {
                return;
            }

            // Update FamilyName
            this.comboBoxBarItemFontFamily.TextBoxValue = controller.TextEditor.FamilyName;

            this.barItemBoldText.Checked      = controller.TextEditor.Bold;
            this.barItemItalicText.Checked    = controller.TextEditor.Italic;
            this.barItemUnderlineText.Checked = controller.TextEditor.Underline;

            // Update point size bar item
            float ptSize = controller.TextEditor.PointSize;

            if (ptSize == 0)
            {
                this.comboBoxBarItemPointSize.TextBoxValue = string.Empty;
            }
            else
            {
                this.comboBoxBarItemPointSize.TextBoxValue = ptSize.ToString();
            }

            // Update strikeout, superscript, subscript
            this.barItemStrikeoutText.Checked = controller.TextEditor.Strikeout;
            this.barItemSubscript.Checked     = controller.TextEditor.Subscript;
            this.barItemSuperscript.Checked   = controller.TextEditor.Superscript;

            // Update text alignment bar items
            StringAlignment horzAlign = controller.TextEditor.HorizontalAlignment;

            switch (horzAlign)
            {
            case StringAlignment.Near:
                this.CurrentAlignment = this.barItemAlignTextLeft;
                break;

            case StringAlignment.Center:
                this.CurrentAlignment = this.barItemCenterText;
                break;

            case StringAlignment.Far:
                this.CurrentAlignment = this.barItemAlignTextRight;
                break;
            }
        }
        public MapControl2()
        {
            InitializeComponent();

            var panelMinimap = new System.Windows.Forms.Panel();

            panelMinimap.BackColor        = System.Drawing.Color.Aqua;
            this.miniMapWinFormHost.Child = panelMinimap;
            this.minimapView       = new View(panelMinimap);
            this.minimapController = new DiagramController();
            this.minimapController.Initialize(this.minimapView);
            this.minimapModel = new Syncfusion.Windows.Forms.Diagram.Model();
            minimapModel.BackgroundStyle.Color = System.Drawing.Color.Green;
            this.minimapView.Model             = this.minimapModel;
        }
Beispiel #23
0
        private void OnChangeDiagramTargetNamespaceClick(object sender, RoutedEventArgs e)
        {
            MenuItem m = sender as MenuItem;

            if (m.DataContext is Diagram)
            {
                Diagram           diagram    = m.DataContext as Diagram;
                DiagramController controller = new DiagramController(diagram, project.GetModelController());
                string            tn;
                string            currentTargetNamespace = (diagram as PSMDiagram).TargetNamespace;
                if (InputBox.Show("Insert diagram target namespace", currentTargetNamespace, out tn) == true &&
                    tn != currentTargetNamespace)
                {
                    controller.ChangeTargetNamespace(tn);
                }
            }
        }
        public async Task AddDiagramOnValidQuery()
        {
            itemsMocker.Setup(i => i.Add(It.Is <DbDiagram>(item => CompareSample(item, SampleDiagram))));

            contextMocker.Setup(c => c.Diagrams).Returns(itemsMocker.Object);
            testerMocker.Setup(c => c.TestTableSetup(
                                   It.Is <string>(query => SampleQuery.Equals(query))))
            .ReturnsAsync("OK");
            contextMocker.Setup(c => c.SaveAsync()).Returns(Task.Run(() => 1)).Verifiable();
            sut = new DiagramController(contextMocker.Object, testerMocker.Object);

            await sut.Create();

            await sut.Create(SampleDiagram, null);

            contextMocker.Verify(c => c.SaveAsync(), () => Times.Once());
        }
        public async Task EditDiagram()
        {
            var firstDiagram = SampleDiagram;

            itemsMocker.Setup(i => i.Find(It.Is <int>(id => id == firstDiagram.DbDiagramId))).Returns(firstDiagram);
            itemsMocker.Setup(i => i.Remove(It.Is <DbDiagram>(item => CompareSample(item, firstDiagram))));
            itemsMocker.Setup(i => i.Add(It.Is <DbDiagram>(item => CompareSample(item, OtherSampleDiagram))));
            testerMocker.Setup(c => c.TestTableSetup(It.Is <string>(q => OtherSampleDiagram.CreationQuery.Equals(q)))).ReturnsAsync("OK").Verifiable();

            contextMocker.Setup(c => c.Diagrams).Returns(itemsMocker.Object);
            sut = new DiagramController(contextMocker.Object, testerMocker.Object);

            await sut.Edit(firstDiagram.DbDiagramId);

            await sut.Edit(OtherSampleDiagram);

            testerMocker.Verify(c => c.TestTableSetup(OtherSampleDiagram.CreationQuery), Times.Once);
        }
        public void Set(Project project, PSMDiagram removedDiagram, DiagramController DiagramController)
        {
            DeleteFromPSMDiagramConsideringRepresentativesMacroCommand delete = (DeleteFromPSMDiagramConsideringRepresentativesMacroCommand)DeleteFromPSMDiagramConsideringRepresentativesMacroCommandFactory.Factory().Create(DiagramController);

            delete.ForceDelete = true;
            if (!delete.InitializeCommand(null, removedDiagram.Roots.Cast <Element>().ToArray()))
            {
                Commands.Clear();
                return;
            }

            Commands.Add(delete);

            RemoveDiagramCommand c = (RemoveDiagramCommand)RemoveDiagramCommandFactory.Factory().Create(Controller);

            c.Set(project, removedDiagram);
            Commands.Add(c);
        }
Beispiel #27
0
        protected XSLTcommon(DiagramController C)
        {
            controller = C;
            nsproject  = controller.Project.Schema.XMLNamespaceOrDefaultNamespace;
            Namespaces.Add(nsrdf, "rdf");
            Namespaces.Add(nsrdfs, "rdfs");
            Namespaces.Add(nsxsl, "xsl");
            Namespaces.Add(nsxs, "xs");
            Namespaces.Add(nsproject, "d");

            Stylesheet = new XElement(nsxsl + "stylesheet",
                                      new XAttribute("version", "1.0"));
            Stylesheet_doc.Add(Stylesheet);
            Stylesheet.Add(new XElement(nsxsl + "output",
                                        new XAttribute("method", "xml"),
                                        new XAttribute("version", "1.0"),
                                        new XAttribute("encoding", "UTF-8"),
                                        new XAttribute("indent", "yes")));
        }
Beispiel #28
0
        /// <summary>
        /// Set element of which appearance properties are displayed
        /// </summary>
        /// <param name="d"></param>
        /// <param name="h"></param>
        public void SetElement(DiagramController d, PositionableElementViewHelper h)
        {
            vh = h;
            dc = d;

            IDictionaryEnumerator ie = grid.Resources.GetEnumerator();

            while (ie.MoveNext())
            {
                if (ie.Key.ToString() == "widthConverter")
                {
                    WidthConverter widthConverter = (WidthConverter)ie.Value;
                    widthConverter.diagramController = dc;
                    widthConverter.viewHelper        = vh;
                }
                else
                if (ie.Key.ToString() == "heightConverter")
                {
                    HeightConverter heightConverter = (HeightConverter)ie.Value;
                    heightConverter.diagramController = dc;
                    heightConverter.viewHelper        = vh;
                }
                else
                if (ie.Key.ToString() == "xConverter")
                {
                    XConverter xConverter = (XConverter)ie.Value;
                    xConverter.diagramController = dc;
                    xConverter.viewHelper        = vh;
                }
                else
                if (ie.Key.ToString() == "yConverter")
                {
                    YConverter yConverter = (YConverter)ie.Value;
                    yConverter.diagramController = dc;
                    yConverter.viewHelper        = vh;
                }
            }

            widthBox.DataContext  = h;
            heightBox.DataContext = h;
            xBox.DataContext      = h;
            yBox.DataContext      = h;
        }
Beispiel #29
0
        public void PerformAnalysisTestRules()
        {
            DiagramController controller = new DiagramController();
            DiagramRequest    request    = new DiagramRequest();

            string[] testDiagrams = new string[]
            {
                "TestItems\\Rule2.txt",
                "TestItems\\Rule3.txt",
                "TestItems\\Rule4.xml",
                "TestItems\\Rule5.txt",
                "TestItems\\Rule6.xml"
            };
            foreach (string path in testDiagrams)
            {
                request.DiagramXml = File.ReadAllText(path);
                var test = controller.PerformAnalysis(request, 1);
                Assert.IsTrue(test.Count > 0, path);
                var jstring = Newtonsoft.Json.JsonConvert.SerializeObject(test);
                Trace.Write(jstring);
            }
        }
Beispiel #30
0
        public PSMClassDialog(PSM_ClassController classController, DiagramController controller)
            : this()
        {
            this.diagramController  = controller;
            this.psmClassController = classController;

            this.Title = string.Format(this.Title, psmClass);

            tbName.Text              = psmClass.Name;
            tbElementLabel.Text      = psmClass.ElementName;
            cbAbstract.IsChecked     = psmClass.IsAbstract;
            cbAnyAttribute.IsChecked = psmClass.AllowAnyAttribute;

            typeColumn.ItemsSource = classController.Class.Package.AllTypes;

            ObservableCollection <FakePSMAttribute> fakeAttributesList = new ObservableCollection <FakePSMAttribute>();

            fakeAttributes = new FakeAttributeCollection(fakeAttributesList, psmClass);
            fakeAttributesList.CollectionChanged += delegate { UpdateApplyEnabled(); };
            gridAttributes.ItemsSource            = fakeAttributesList;

            dialogReady = true;
        }
Beispiel #31
0
        public void BindToDiagram(Diagram diagram, ModelController modelController)
        {
            PropertyPath propertyPath = new PropertyPath("Caption");
            Binding      titleBinding = new Binding {
                Source = diagram, Path = propertyPath
            };

            SetBinding(TitleProperty, titleBinding);

            // bound view to controller and controller to model
            DiagramController = new DiagramController(diagram, modelController);
            ModelController   = modelController;

            xCaseDrawComponent.Canvas.Controller = DiagramController;
            try
            {
                Mouse.SetCursor(Cursors.Wait);

                #region load items on the diagram

                List <Element>  alreadyProcessed = new List <Element>();
                RegistrationSet registrationSet;
                if (diagram is PIMDiagram)
                {
                    registrationSet = MainWindow.PIMRepresentantsSet;
                    /* Elements in PIM diagram are loaded in the order of their LoadPriority in registration set */
                    foreach (RepresentantRegistration registration in registrationSet.OrderBy(reg => reg.LoadPriority))
                    {
                        foreach (KeyValuePair <Element, ViewHelper> pair in diagram.DiagramElements)
                        {
                            if (!alreadyProcessed.Contains(pair.Key) &&
                                registration.ModelElementType.IsInstanceOfType(pair.Key))
                            {
                                diagram.NotifyElementAdded(this, pair.Key, pair.Value);
                                alreadyProcessed.Add(pair.Key);
                            }
                        }
                    }
                }
                else
                {
                    /* order of the elements in PSM diagram is more complex, an ordering function
                     * is called to order the elements (basically BFS)
                     */
                    TreeLayout.SwitchOff();
                    IList <Element> ordered;
                    if (PSMTree.ReturnElementsInPSMOrder(((PSMDiagram)diagram).Roots, out ordered, true))
                    {
                        foreach (Element element in ordered)
                        {
                            diagram.NotifyElementAdded(this, element, diagram.DiagramElements[element]);
                        }
                        foreach (Comment comment in diagram.DiagramElements.Keys.OfType <Comment>())
                        {
                            diagram.NotifyElementAdded(this, comment, diagram.DiagramElements[comment]);
                        }
                        foreach (PSMDiagramReference psmDiagramReference in diagram.DiagramElements.Keys.OfType <PSMDiagramReference>())
                        {
                            diagram.NotifyElementAdded(this, psmDiagramReference, diagram.DiagramElements[psmDiagramReference]);
                        }
                    }
                    xCaseDrawComponent.Canvas.Loaded += Canvas_Loaded;
                }

                #endregion
            }
            finally
            {
                Mouse.SetCursor(Cursors.Arrow);
            }
        }
Beispiel #32
0
        public void DrawPIMExample(int x, int y)
        {
            RepresentationCollection ModelViewMap = xCaseDrawComponent.Canvas.ElementRepresentations;
            //clRegion = AddClass("Region", null, null, prRegion, null, 39 + x, 81 + y);
            CreationResult <Class, ClassViewHelper> classCreationResult = DiagramController.NewClass("Region", 39 + x, 81 + y);
            PIM_Class clRegion = (PIM_Class)ModelViewMap[classCreationResult.ModelElement];

            //clSupplier = AddClass("Supplier", null, null, prSupplier, null, 192 + x, 78 + y);
            classCreationResult = DiagramController.NewClass("Supplier", 192 + x, 78 + y);
            PIM_Class clSupplier = (PIM_Class)ModelViewMap[classCreationResult.ModelElement];

            //clPart = AddClass("Part", null, null, prPart, null, 489 + x, 88 + y);
            classCreationResult = DiagramController.NewClass("Part", 489 + x, 88 + y);
            PIM_Class clPart = (PIM_Class)ModelViewMap[classCreationResult.ModelElement];

            //clAddress = AddClass("Address", null, null, prAddress, null, 35 + x, 189 + y);
            classCreationResult = DiagramController.NewClass("Address", 35 + x, 189 + y);
            PIM_Class clAddress = (PIM_Class)ModelViewMap[classCreationResult.ModelElement];

            //clShop = AddClass("Shop", null, null, prShop, null, 127 + x, 224 + y);
            classCreationResult = DiagramController.NewClass("Shop", 127 + x, 189 + y);
            PIM_Class clShop = (PIM_Class)ModelViewMap[classCreationResult.ModelElement];

            //clDealer = AddClass("Dealer", null, null, prDealer, null, 244 + x, 224 + y);
            classCreationResult = DiagramController.NewClass("Dealer", 244 + x, 224 + y);
            PIM_Class clDealer = (PIM_Class)ModelViewMap[classCreationResult.ModelElement];

            //clSupply = AddClass("Supply", null, null, prSupply, null, 387 + x, 207 + y);
            classCreationResult = DiagramController.NewClass("Supply", 387 + x, 207 + y);
            PIM_Class clSupply = (PIM_Class)ModelViewMap[classCreationResult.ModelElement];

            //clProductSet = AddClass("ProductSet", null, null, prProductSet, null, 537 + x, 215 + y);
            classCreationResult = DiagramController.NewClass("ProductSet", 537 + x, 215 + y);
            PIM_Class clProductSet = (PIM_Class)ModelViewMap[classCreationResult.ModelElement];

            //clCustomer = AddClass("Customer", null, null, prCustomer, null, 14 + x, 335 + y);
            classCreationResult = DiagramController.NewClass("Customer", 14 + x, 335 + y);
            PIM_Class clCustomer = (PIM_Class)ModelViewMap[classCreationResult.ModelElement];

            //clPurchase = AddClass("Purchase", null, null, prPurchase, null, 182 + x, 341 + y);
            classCreationResult = DiagramController.NewClass("Purchase", 182 + x, 341 + y);
            PIM_Class clPurchase = (PIM_Class)ModelViewMap[classCreationResult.ModelElement];

            //clItem = AddClass("Item", null, null, prItem, null, 385 + x, 342 + y);
            classCreationResult = DiagramController.NewClass("Item", 385 + x, 342 + y);
            PIM_Class clItem = (PIM_Class)ModelViewMap[classCreationResult.ModelElement];

            //clProduct = AddClass("Product", null, null, prProduct, null, 539 + x, 324 + y);
            classCreationResult = DiagramController.NewClass("Product", 529 + x, 324 + y);
            PIM_Class clProduct = (PIM_Class)ModelViewMap[classCreationResult.ModelElement];

            Dictionary <PIM_Class, List <string> > properties = new Dictionary <PIM_Class, List <string> >();

            properties[clRegion] = new List <string> {
                "name"
            };
            properties[clSupplier] = new List <string> {
                "supplier-number", "email", "phone"
            };
            properties[clPart] = new List <string> {
                "part-name", "number"
            };
            properties[clAddress] = new List <string> {
                "street", "postcode", "city"
            };
            properties[clShop] = new List <string> {
                "shop-number"
            };
            properties[clDealer] = new List <string> {
                "dealer-number"
            };
            properties[clSupply] = new List <string> {
                "amount", "supply-date", "unit-price"
            };
            properties[clProductSet] = new List <string> {
                "amount", "completion-date"
            };
            properties[clCustomer] = new List <string> {
                "customer-number", "name", "email"
            };
            properties[clPurchase] = new List <string> {
                "purchase-number", "date"
            };
            properties[clItem] = new List <string> {
                "amount", "position"
            };
            properties[clProduct] = new List <string> {
                "product-number", "title", "unit-price", "description"
            };

            foreach (KeyValuePair <PIM_Class, List <string> > keyValuePair in properties)
            {
                foreach (string attribute in keyValuePair.Value)
                {
                    keyValuePair.Key.ClassController.AddNewAttribute(attribute);
                }
            }

            //AddAssociation(clRegion, clAddress, EJunctionCapStyle.Straight, EJunctionCapStyle.Straight, "in", "1", "0..*");
            CreationResult <Association, AssociationViewHelper> associationCreationResult = DiagramController.NewAssociation("in", (Class)clRegion.ModelElement, (Class)clAddress.ModelElement);
            PIM_Association aRegionAdress = (PIM_Association)ModelViewMap[associationCreationResult.ModelElement];

            aRegionAdress.Controller.ChangeMultiplicity(aRegionAdress.Ends[0], "1");
            aRegionAdress.Controller.ChangeMultiplicity(aRegionAdress.Ends[1], "0..*");
            //AddAssociation(clAddress, clCustomer, EJunctionCapStyle.Straight, EJunctionCapStyle.Straight, "deliver to", "0..1", "0..1");
            associationCreationResult = DiagramController.NewAssociation("deliver to", (Class)clAddress.ModelElement, (Class)clCustomer.ModelElement);
            PIM_Association aAddressCustomer = (PIM_Association)ModelViewMap[associationCreationResult.ModelElement];

            aAddressCustomer.Controller.ChangeMultiplicity(aAddressCustomer.Ends[0], "0..1");
            aAddressCustomer.Controller.ChangeMultiplicity(aAddressCustomer.Ends[1], "0..1");
            //AddAssociation(clCustomer, clPurchase, EJunctionCapStyle.Straight, EJunctionCapStyle.Straight, "buyer", "1", "0..*");
            associationCreationResult = DiagramController.NewAssociation("buyer", (Class)clCustomer.ModelElement, (Class)clPurchase.ModelElement);
            PIM_Association aCustomerPurchase = (PIM_Association)ModelViewMap[associationCreationResult.ModelElement];

            aCustomerPurchase.Controller.ChangeMultiplicity(aCustomerPurchase.Ends[0], "1");
            aCustomerPurchase.Controller.ChangeMultiplicity(aCustomerPurchase.Ends[1], "0..*");
            //AddAssociation(clPurchase, clShop, EJunctionCapStyle.Straight, EJunctionCapStyle.Straight, "made in", "0..*", "0..1");
            associationCreationResult = DiagramController.NewAssociation("made in", (Class)clPurchase.ModelElement, (Class)clShop.ModelElement);
            PIM_Association aPurchaseShop = (PIM_Association)ModelViewMap[associationCreationResult.ModelElement];

            aPurchaseShop.Controller.ChangeMultiplicity(aPurchaseShop.Ends[0], "0..*");
            aPurchaseShop.Controller.ChangeMultiplicity(aPurchaseShop.Ends[1], "0..1");
            //AddAssociation(clPurchase, clDealer, EJunctionCapStyle.Straight, EJunctionCapStyle.Straight, "made by", "0..*", "0..1");
            associationCreationResult = DiagramController.NewAssociation("made by", (Class)clPurchase.ModelElement, (Class)clDealer.ModelElement);
            PIM_Association aPurchaseDealer = (PIM_Association)ModelViewMap[associationCreationResult.ModelElement];

            aPurchaseDealer.Controller.ChangeMultiplicity(aPurchaseDealer.Ends[0], "0..*");
            aPurchaseDealer.Controller.ChangeMultiplicity(aPurchaseDealer.Ends[1], "0..1");
            //AddAssociation(clPurchase, clItem, EJunctionCapStyle.Straight, EJunctionCapStyle.Straight, "contained in", "1", "1..*");
            associationCreationResult = DiagramController.NewAssociation("contained in", (Class)clPurchase.ModelElement, (Class)clItem.ModelElement);
            PIM_Association aPurchaseItem = (PIM_Association)ModelViewMap[associationCreationResult.ModelElement];

            aPurchaseItem.Controller.ChangeMultiplicity(aPurchaseItem.Ends[0], "1");
            aPurchaseItem.Controller.ChangeMultiplicity(aPurchaseItem.Ends[1], "1..*");
            //AddAssociation(clItem, clProduct, EJunctionCapStyle.Straight, EJunctionCapStyle.Straight, "purchases", "0..*", "1");
            associationCreationResult = DiagramController.NewAssociation("purchases", (Class)clItem.ModelElement, (Class)clProduct.ModelElement);
            PIM_Association aItemProduct = (PIM_Association)ModelViewMap[associationCreationResult.ModelElement];

            aItemProduct.Controller.ChangeMultiplicity(aItemProduct.Ends[0], "0..*");
            aItemProduct.Controller.ChangeMultiplicity(aItemProduct.Ends[1], "1");
            //AddAssociation(clProduct, clProduct, EJunctionCapStyle.Straight, EJunctionCapStyle.Straight, "reffered", "0..*", "0..*");
            associationCreationResult = DiagramController.NewAssociation("reffered", (Class)clProduct.ModelElement);
            PIM_Association aProductProduct = (PIM_Association)ModelViewMap[associationCreationResult.ModelElement];

            aProductProduct.Controller.ChangeMultiplicity(aProductProduct.Ends[0], "1");
            //aProductProduct.Controller.ChangeMultiplicity(aProductProduct.Ends[1], "0..*");
            //AddAssociation(clProduct, clProductSet, EJunctionCapStyle.Straight, EJunctionCapStyle.Straight, "produces", "1", "0..*");
            associationCreationResult = DiagramController.NewAssociation("produces", (Class)clProduct.ModelElement, (Class)clProductSet.ModelElement);
            PIM_Association aProductProductSet = (PIM_Association)ModelViewMap[associationCreationResult.ModelElement];

            aProductProductSet.Controller.ChangeMultiplicity(aProductProductSet.Ends[0], "1");
            aProductProductSet.Controller.ChangeMultiplicity(aProductProductSet.Ends[1], "0..*");
            //AddAssociation(clProductSet, clSupply, EJunctionCapStyle.Straight, EJunctionCapStyle.Straight, "for", "1", "1..*");
            associationCreationResult = DiagramController.NewAssociation("for", (Class)clProductSet.ModelElement, (Class)clSupply.ModelElement);
            PIM_Association aProductSetSupply = (PIM_Association)ModelViewMap[associationCreationResult.ModelElement];

            aProductSetSupply.Controller.ChangeMultiplicity(aProductSetSupply.Ends[0], "1");
            aProductSetSupply.Controller.ChangeMultiplicity(aProductSetSupply.Ends[1], "1..*");
            //AddAssociation(clSupply, clPart, EJunctionCapStyle.Straight, EJunctionCapStyle.Straight, "supplies", "0..*", "1");
            associationCreationResult = DiagramController.NewAssociation("supplies", (Class)clSupply.ModelElement, (Class)clPart.ModelElement);
            PIM_Association aSupplyPart = (PIM_Association)ModelViewMap[associationCreationResult.ModelElement];

            aSupplyPart.Controller.ChangeMultiplicity(aSupplyPart.Ends[0], "0..*");
            aSupplyPart.Controller.ChangeMultiplicity(aSupplyPart.Ends[1], "1");
            //AddAssociation(clSupply, clSupplier, EJunctionCapStyle.Straight, EJunctionCapStyle.Straight, "supplied by", "0..*", "1");
            associationCreationResult = DiagramController.NewAssociation("supplied by", (Class)clSupply.ModelElement, (Class)clSupplier.ModelElement);
            PIM_Association aSupplySupplier = (PIM_Association)ModelViewMap[associationCreationResult.ModelElement];

            aSupplySupplier.Controller.ChangeMultiplicity(aSupplySupplier.Ends[0], "0..*");
            aSupplySupplier.Controller.ChangeMultiplicity(aSupplySupplier.Ends[1], "1");
            //AddAssociation(clSupplier, clPart, EJunctionCapStyle.Straight, EJunctionCapStyle.Straight, "offers", "0..*", "1..*");
            associationCreationResult = DiagramController.NewAssociation("offers", (Class)clSupplier.ModelElement, (Class)clPart.ModelElement);
            PIM_Association aSupplierPart = (PIM_Association)ModelViewMap[associationCreationResult.ModelElement];

            aSupplierPart.Controller.ChangeMultiplicity(aSupplierPart.Ends[0], "0..*");
            aSupplierPart.Controller.ChangeMultiplicity(aSupplierPart.Ends[1], "1");
        }
Beispiel #33
0
 public void SetController(IController controller)
 {
     this.controller = (DiagramController)controller;
 }
Beispiel #34
0
 // Methods
 public SlideLinkerToolBase(DiagramController controller, string name)
     : base(controller, name)
 {
 }
Beispiel #35
0
 public SlideLinkTool(DiagramController controller)
     : base(controller, ToolDescriptor.SlideLinkTool)
 {
     base.ToolCursor = base.ActionCursor = Cursors.Cross;
     this.SingleActionTool = false;
 }
 public DeactivateEventTool(DiagramController controller, String name)
     : base(controller, name)
 {
 }
 internal static Tool GetInstance(DiagramController controller)
 {
     if (singletons.ContainsKey(controller))
         return singletons[controller];
     else
         return null;
 }
 public PresentationPanTool(DiagramController controller)
     : base(controller)
 {
 }