Exemple #1
0
        /// <summary>
        /// This method is safe to be called repeatedly.
        /// </summary>
        /// <param name="propertyName"></param>
        public override void UpdateView(string propertyName = null)
        {
            base.UpdateView(propertyName);
            if (PSMContentModel != null)
            {
                switch (PSMContentModel.Type)
                {
                case PSMContentModelType.Sequence:
                    tbContentModelHeader.Text = " , ";
                    break;

                case PSMContentModelType.Choice:
                    tbContentModelHeader.Text = " | ";
                    break;

                case PSMContentModelType.Set:
                    tbContentModelHeader.Text = " { } ";
                    break;

                default:
                    throw new ArgumentOutOfRangeException();
                }

                if (foldingButton.Folded != ViewHelper.IsFolded)
                {
                    foldingButton.Folded = ViewHelper.IsFolded;
                    FoldingHelper.FoldChildrenRecursive(PSMContentModel, DiagramView, ViewHelper.IsFolded ? EFoldingAction.Fold : EFoldingAction.Unfold);
                }
            }

            MainNode.UpdateCanvasPosition(true);
        }
Exemple #2
0
        /// <summary>
        /// This method is safe to be called repeatedly.
        /// </summary>
        /// <param name="propertyName"></param>
        public override void UpdateView(string propertyName = null)
        {
            base.UpdateView(propertyName);
            if (PSMSchemaClass != null)
            {
                tbClassHeader.Text = PSMSchemaClass.Name;
                if (foldingButton.Folded != ViewHelper.IsFolded)
                {
                    foldingButton.Folded = ViewHelper.IsFolded;
                    FoldingHelper.FoldChildrenRecursive(PSMSchemaClass, DiagramView, ViewHelper.IsFolded ? EFoldingAction.Fold : EFoldingAction.Unfold);
                }
            }

            MainNode.UpdateCanvasPosition(true);
        }
Exemple #3
0
        /// <summary>
        /// This method is safe to be called repeatedly.
        /// </summary>
        /// <param name="propertyName"></param>
        public override void UpdateView(string propertyName = null)
        {
            base.UpdateView(propertyName);
            if (PSMClass != null)
            {
                if (!PSMClass.AppliedStereotypes.IsEmpty())
                {
                    tbStereotypes.Text       = PSMClass.AppliedStereotypes.GetStereotypesString(Environment.NewLine);
                    tbStereotypes.Visibility = Visibility.Visible;
                }

                this.Name = PSMClass.Name;

                Brush header;
                Brush body;

                if (!PSMClass.IsStructuralRepresentative && PSMClass.Interpretation != null)
                {
                    header = ViewToolkitResources.ClassHeader;
                    body   = ViewToolkitResources.TransparentBrush;
                }
                else if (PSMClass.IsStructuralRepresentative && PSMClass.Interpretation != null)
                {
                    header = ViewToolkitResources.StructuralRepresentativeHeader;
                    body   = ViewToolkitResources.StructuralRepresentativeBody;
                }
                else if (PSMClass.IsStructuralRepresentative && PSMClass.Interpretation == null)
                {
                    header = ViewToolkitResources.StructuralRepresentativeHeaderNoInterpretation;
                    body   = ViewToolkitResources.StructuralRepresentativeBody;
                }
                else                 //if (!PSMClass.IsStructuralRepresentative && PSMClass.Interpretation == null)
                {
                    header = ViewToolkitResources.NoInterpretationBrush;
                    body   = ViewToolkitResources.TransparentBrush;
                }


                #region represented class binding
                if (PSMClass.RepresentedClass != representedClass)
                {
                    if (representedClass != null)
                    {
                        UnBindFromRepresentedClass();
                    }
                    if (PSMClass.RepresentedClass != null)
                    {
                        BindToRepresentedClass(PSMClass.RepresentedClass);
                    }
                }
                #endregion

                if (headerBorder.Background != header)
                {
                    headerBorder.Background = header;
                }
                if (attributesBorder.Background != body)
                {
                    attributesBorder.Background = body;
                    foreach (PSMAttributeTextBox psmAttributeTextBox in attributesContainer)
                    {
                        psmAttributeTextBox.RefreshTextContent();
                    }
                }

                #region represented class text
                if (PSMClass.IsStructuralRepresentative)
                {
                    tbSRHeader.Visibility = Visibility.Visible;
                    tbSRHeader.Text       = PSMClass.RepresentedClass.Name;
                }
                else
                {
                    tbSRHeader.Text       = String.Empty;
                    tbSRHeader.Visibility = Visibility.Collapsed;
                }
                #endregion

                if (foldingButton.Folded != ViewHelper.IsFolded)
                {
                    foldingButton.Folded = ViewHelper.IsFolded;
                    FoldingHelper.FoldChildrenRecursive(PSMClass, DiagramView, ViewHelper.IsFolded ? EFoldingAction.Fold : EFoldingAction.Unfold);
                }

                tbClassHeader.FontStyle  = PSMClass.Abstract ? FontStyles.Italic : FontStyles.Normal;
                tbClassHeader.FontWeight = PSMClass.Final ? FontWeights.Normal : FontWeights.Bold;
            }

            tbClassHeader.Text = Name;
            MainNode.UpdateCanvasPosition(true);
        }