Exemple #1
0
            /// <summary>
            /// Code that handles retrieval of the text to display in ValueConstraintShape.
            /// </summary>
            public sealed override string GetDisplayText(ShapeElement parentShape)
            {
                string retval = null;
                ValueConstraintShape parentValueConstraintShape = parentShape as ValueConstraintShape;

                if (parentShape is ObjectTypeShape)
                {
                    LinkedElementCollection <PresentationElement> pelList = PresentationViewsSubject.GetPresentation(parentShape);
                    foreach (ShapeElement pel in pelList)
                    {
                        ValueConstraintShape valueConstraintShape = pel as ValueConstraintShape;
                        if (valueConstraintShape != null)
                        {
                            parentValueConstraintShape = valueConstraintShape;
                            break;
                        }
                    }
                }
                if (parentValueConstraintShape == null)
                {
                    retval = base.GetDisplayText(parentShape);
                }
                else
                {
                    retval = parentValueConstraintShape.DisplayText;
                }
                return(retval);
            }
Exemple #2
0
        /// <summary>
        /// ChangeRule: typeof(ValueConstraintShape), FireTime=TopLevelCommit, Priority=DiagramFixupConstants.ResizeParentRulePriority;
        /// </summary>
        private static void ValueConstraintShapeDisplayChangedRule(ElementPropertyChangedEventArgs e)
        {
            Guid propertyId = e.DomainProperty.Id;

            if (propertyId == ValueConstraintShape.MaximumDisplayedValuesDomainPropertyId || propertyId == ValueConstraintShape.MaximumDisplayedColumnsDomainPropertyId)
            {
                ValueConstraintShape valueConstraintShape = (ValueConstraintShape)e.ModelElement;
                if (!valueConstraintShape.IsDeleted)
                {
                    valueConstraintShape.InvalidateDisplayText();
                }
            }
        }
Exemple #3
0
 /// <summary>
 /// ChangeRule: typeof(ValueConstraint), FireTime=TopLevelCommit, Priority=DiagramFixupConstants.ResizeParentRulePriority;
 /// Rule to watch the ValueConstraint.TextChanged property so that we can
 /// update text as needed. TextChanged is triggered when the ValueConstraint is
 /// first added, so this is sufficient for updating.
 /// </summary>
 private static void ValueConstraintTextChangedRule(ElementPropertyChangedEventArgs e)
 {
     if (e.DomainProperty.Id == ValueConstraint.TextChangedDomainPropertyId)
     {
         ValueConstraint constraint = (ValueConstraint)e.ModelElement;
         if (!constraint.IsDeleted)
         {
             foreach (ShapeElement pel in PresentationViewsSubject.GetPresentation(constraint))
             {
                 ValueConstraintShape valueConstraintShape = pel as ValueConstraintShape;
                 if (valueConstraintShape != null)
                 {
                     valueConstraintShape.InvalidateDisplayText();
                 }
             }
         }
     }
 }