Exemplo n.º 1
0
        public override void UpdateView(string propertyName = null)
        {
            base.UpdateView(propertyName);
            if (DiagramView != null)
            {
                Node parentNode = ((INodeComponentViewBase)DiagramView.RepresentantsCollection[Parent]).MainNode;
                Node childNode  = ((INodeComponentViewBase)DiagramView.RepresentantsCollection[Child]).MainNode;
                if (parentNode != Connector.StartNode || childNode != Connector.EndNode)
                {
                    Connector.Connect(parentNode, childNode);
                }
                // labels, multiplicities
                NameLabel.Text = PSMAssociation.Name;
                Cardinality    = PSMAssociation.GetCardinalityString();

                NameLabel.X = ViewHelper.MainLabelViewHelper.X;
                NameLabel.Y = ViewHelper.MainLabelViewHelper.Y;
                NameLabel.UpdateCanvasPosition(true);

                CardinalityLabel.X = ViewHelper.CardinalityLabelViewHelper.X;
                CardinalityLabel.Y = ViewHelper.CardinalityLabelViewHelper.Y;
                CardinalityLabel.UpdateCanvasPosition(true);

#if SILVERLIGHT
#else
                if (PSMAssociation.Interpretation == null)
                {
                    Connector.Pen = ViewToolkitResources.InterpretedAssociationPen;
                }
                else
                {
                    Connector.Pen = ViewToolkitResources.SolidBlackPen;
                }
#endif

                DiagramView.ExolutioCanvas.InvokeContentChanged();
            }
        }
Exemplo n.º 2
0
        public override void UpdateView(string propertyName = null)
        {
            base.UpdateView(propertyName);
            Node sourceNode = ((INodeComponentViewBase)DiagramView.RepresentantsCollection[SourceClass]).MainNode;
            Node targetNode = ((INodeComponentViewBase)DiagramView.RepresentantsCollection[TargetClass]).MainNode;

            if (sourceNode != Connector.StartNode || targetNode != Connector.EndNode)
            {
                UnBindMenus();
                Connector.Connect(sourceNode, targetNode);
                CreateMenus();
                BindMenus();
            }

            // labels, multiplicities
            AssociationName = PIMAssociation.Name;
            PIMAssociationEnd sourceEnd = PIMAssociation.PIMAssociationEnds[0];
            PIMAssociationEnd targetEnd = PIMAssociation.PIMAssociationEnds[1];

            SourceCardinality = sourceEnd.GetCardinalityString();
            TargetCardinality = targetEnd.GetCardinalityString();
            SourceRole        = sourceEnd.Name;
            TargetRole        = targetEnd.Name;

            if (sourceEnd.IsComposite == true)
            {
                Connector.StartCapStyle = EConnectorCapStyle.FullDiamond;
            }
            if (sourceEnd.IsShared == true)
            {
                Connector.StartCapStyle = EConnectorCapStyle.Diamond;
            }
            if (sourceEnd.IsNavigable == true)
            {
                Connector.StartCapStyle = EConnectorCapStyle.Arrow;
            }

            if (targetEnd.IsComposite == true)
            {
                Connector.EndCapStyle = EConnectorCapStyle.FullDiamond;
            }
            if (targetEnd.IsShared == true)
            {
                Connector.EndCapStyle = EConnectorCapStyle.Diamond;
            }
            if (targetEnd.IsNavigable == true)
            {
                Connector.EndCapStyle = EConnectorCapStyle.Arrow;
            }

            if (NameLabel != null)
            {
                NameLabel.X = ViewHelper.MainLabelViewHelper.X;
                NameLabel.Y = ViewHelper.MainLabelViewHelper.Y;
                NameLabel.UpdateCanvasPosition(true);
            }

            if (SourceCardinalityLabel != null)
            {
                SourceCardinalityLabel.X = ViewHelper.AssociationEndsViewHelpers[0].CardinalityLabelViewHelper.X;
                SourceCardinalityLabel.Y = ViewHelper.AssociationEndsViewHelpers[0].CardinalityLabelViewHelper.Y;
                SourceCardinalityLabel.UpdateCanvasPosition(true);
            }

            if (TargetCardinalityLabel != null)
            {
                TargetCardinalityLabel.X = ViewHelper.AssociationEndsViewHelpers[1].CardinalityLabelViewHelper.X;
                TargetCardinalityLabel.Y = ViewHelper.AssociationEndsViewHelpers[1].CardinalityLabelViewHelper.Y;
                TargetCardinalityLabel.UpdateCanvasPosition(true);
            }

            if (SourceRoleLabel != null)
            {
                SourceRoleLabel.X = ViewHelper.AssociationEndsViewHelpers[0].RoleLabelViewHelper.X;
                SourceRoleLabel.Y = ViewHelper.AssociationEndsViewHelpers[0].RoleLabelViewHelper.Y;
                SourceRoleLabel.UpdateCanvasPosition(true);
            }

            if (TargetRoleLabel != null)
            {
                TargetRoleLabel.X = ViewHelper.AssociationEndsViewHelpers[1].RoleLabelViewHelper.X;
                TargetRoleLabel.Y = ViewHelper.AssociationEndsViewHelpers[1].RoleLabelViewHelper.Y;
                TargetRoleLabel.UpdateCanvasPosition(true);
            }
        }