Exemple #1
0
        /// <summary>
        /// Displayes PIM class selected on the canvas
        /// </summary>
        /// <param name="c"></param>
        /// <param name="classtype"></param>
        /// <param name="mainwin"></param>
        public void Display(XCaseViewBase c, string classtype, MainWindow mainwin)
        {
            mv = mainwin;
            SelectedClassController = c.Controller;

            IDictionaryEnumerator ie = grid.Resources.GetEnumerator();

            while (ie.MoveNext())
            {
                if (ie.Key.ToString() == "renamePIMClass")
                {
                    renamePIMClass               = (RenamePIMClassConverter)ie.Value;
                    renamePIMClass.Controller    = mv.CurrentProject.GetModelController();
                    renamePIMClass.selectedClass = (Class)c.Controller.Element;
                }
                else
                if (ie.Key.ToString() == "renameAttribute")
                {
                    renameAttribute               = (RenameAttributeConverter)ie.Value;
                    renameAttribute.Controller    = mv.CurrentProject.GetModelController();
                    renameAttribute.selectedClass = (Class)c.Controller.Element;
                }
                else
                if (ie.Key.ToString() == "renameOperation")
                {
                    renameOperation            = (RenameOperationConverter)ie.Value;
                    renameOperation.Controller = mv.CurrentProject.GetModelController();
                }
            }

            mainLabel.Content = classtype + " Class";

            classNameBox.DataContext = ((ClassController)SelectedClassController).Class;
            attBox.DataContext       = ((ClassController)SelectedClassController).Class.Attributes;
            opBox.DataContext        = ((ClassController)SelectedClassController).Class.Operations;
            dcBox.DataContext        = ((ClassController)SelectedClassController).Class.DerivedPSMClasses;

            appearance.Visibility = Visibility.Visible;
            appearance.SetElement(c.Controller.DiagramController, c.ViewHelper);
        }
Exemple #2
0
        /// <summary>
        /// Displayes PIM class selected in the Navigator window
        /// </summary>
        /// <param name="p"></param>
        /// <param name="classtype"></param>
        /// <param name="mainwin"></param>
        public void Display(PIMClass p, string classtype, MainWindow mainwin)
        {
            mv = mainwin;

            IDictionaryEnumerator ie = grid.Resources.GetEnumerator();

            while (ie.MoveNext())
            {
                if (ie.Key.ToString() == "renamePIMClass")
                {
                    renamePIMClass               = (RenamePIMClassConverter)ie.Value;
                    renamePIMClass.Controller    = mv.CurrentProject.GetModelController();
                    renamePIMClass.selectedClass = p;
                }
                else
                if (ie.Key.ToString() == "renameAttribute")
                {
                    renameAttribute               = (RenameAttributeConverter)ie.Value;
                    renameAttribute.Controller    = mv.CurrentProject.GetModelController();
                    renameAttribute.selectedClass = p;
                }
                else
                if (ie.Key.ToString() == "renameOperation")
                {
                    renameOperation            = (RenameOperationConverter)ie.Value;
                    renameOperation.Controller = mv.CurrentProject.GetModelController();
                }

                mainLabel.Content = classtype + " Class";

                classNameBox.DataContext = p;
                attBox.DataContext       = p.Attributes;
                opBox.DataContext        = p.Operations;
                dcBox.DataContext        = p.DerivedPSMClasses;

                appLabel.Visibility   = Visibility.Hidden;
                appearance.Visibility = Visibility.Hidden;
            }
        }
Exemple #3
0
        /// <summary>
        /// Saves all unsaved values in the grid
        /// </summary>
        public override void UpdateContent()
        {
            if (classNameBox.IsFocused)
            {
                CheckUniqueClassName(classNameBox, null);
                BindingExpression be = classNameBox.GetBindingExpression(TextBox.TextProperty);
                be.UpdateSource();
                renamePIMClass = null;
            }

            foreach (TextBox t in attBoxes)
            {
                if (renameAttribute != null && t.IsFocused)
                {
                    CheckUniqueAttributeName(t, null);
                    renameAttribute.selectedAttribute = (Property)(t.DataContext);
                    BindingExpression be = t.GetBindingExpression(TextBox.TextProperty);
                    be.UpdateSource();
                }
            }
            attBoxes.Clear();
            renameAttribute = null;

            foreach (TextBox t in opBoxes)
            {
                if (renameOperation != null && t.IsFocused)
                {
                    CheckUniqueOperationName(t, null);
                    renameOperation.selectedOperation = (Operation)(t.DataContext);
                    BindingExpression be = t.GetBindingExpression(TextBox.TextProperty);
                    be.UpdateSource();
                }
            }
            opBoxes.Clear();
            renameOperation = null;

            appearance.UpdateContent();
        }