/// <summary>
        /// Initializes the resources for each instance of the connector.
        /// </summary>
        protected override void InitializeInstanceResources()
        {
            base.InitializeInstanceResources();

            // TODO: Need to find a better pattern for connectors, becuase this code never executes as a connector does not have a non-null MEL
            // to get to the target MEL from.

            // Set tailorable colors (based upon the target element)
            ElementLink link = this.Subject as ElementLink;

            if (link != null)
            {
                NamedElementSchema targetElement = DomainRoleInfo.GetTargetRolePlayer(link) as NamedElementSchema;
                if ((targetElement != null) && (targetElement.IsInheritedFromBase))
                {
                    // Set tailoring styles for this instance.
                    this.SetShapeBrushColor(DiagramBrushes.ConnectionLineDecorator, this.TailoringColors.TextColor);
                    this.SetShapePenColor(DiagramPens.ConnectionLine, this.TailoringColors.OutlineColor);
                    this.SetShapePenColor(DiagramPens.ConnectionLineDecorator, this.TailoringColors.OutlineColor);
                    this.SetShapeBrushColor(DiagramBrushes.ShapeText, this.TailoringColors.TextColor);
                }
                else
                {
                    // Reset to orginally configured styles for this instance.
                    this.InitializeResources(this.StyleSet);
                }
            }
            else
            {
                // Reset to orginally configured styles for this instance.
                this.InitializeResources(this.StyleSet);
            }
        }
示例#2
0
            /// <summary>
            /// Sets the value of the tracking property based on stored value of the CodeIdentifier property.
            /// </summary>
            internal void ResetValue(NamedElementSchema element)
            {
                string calculatedValue = null;

                try
                {
                    calculatedValue = element.CalculateCodeIdentifierTrackingValue();
                }
                catch (NullReferenceException)
                {
                }
                catch (System.Exception e)
                {
                    if (ErrorHandler.IsCriticalException(e))
                    {
                        throw;
                    }
                }

                if (calculatedValue != null)
                {
                    if (string.Equals(element.CodeIdentifier, calculatedValue, StringComparison.Ordinal) ||
                        string.IsNullOrEmpty(element.CodeIdentifier))
                    {
                        element.isCodeIdentifierTrackingPropertyStorage = true;
                    }
                }
            }
示例#3
0
 /// <summary>
 /// Called after the IsCodeIdentifierTracking property changes.
 /// </summary>
 protected override void OnValueChanged(NamedElementSchema element, bool oldValue, bool newValue)
 {
     base.OnValueChanged(element, oldValue, newValue);
     if (!element.Store.InUndoRedoOrRollback && newValue)
     {
         DomainPropertyInfo propInfo =
             element.Store.DomainDataDirectory.GetDomainProperty(
                 NamedElementSchema.CodeIdentifierDomainPropertyId);
         propInfo.NotifyValueChange(element);
     }
 }
示例#4
0
        /// <summary>
        /// Initializes the resources for each instance of the shape.
        /// </summary>
        protected override void InitializeInstanceResources()
        {
            base.InitializeInstanceResources();

            // Set tailorable colors
            NamedElementSchema element = this.Subject as NamedElementSchema;

            if ((element != null) && (element.IsInheritedFromBase))
            {
                // Set tailoring styles for this instance.
                this.SetShapeBrushColor(DiagramBrushes.ShapeBackground, this.TailoringColors.FillColor);
                this.SetShapeBrushColor(DiagramBrushes.ShapeText, this.TailoringColors.TextColor);
                this.SetShapePenColor(DiagramPens.ShapeOutline, this.TailoringColors.OutlineColor);
            }
            else
            {
                // Reset to orginally configured styles for this instance.
                this.InitializeResources(this.StyleSet);
            }
        }
示例#5
0
        /// <summary>
        /// Initializes the resources for each instance of the shape.
        /// </summary>
        protected override void InitializeInstanceResources()
        {
            base.InitializeInstanceResources();

            // Set tailorable colors
            NamedElementSchema element = this.Subject as NamedElementSchema;

            if ((element != null) && (element.IsInheritedFromBase))
            {
                // Set tailoring styles for this instance.
                this.SetShapeBrushColor(DiagramBrushes.ShapeBackground, this.TailoringColors.FillColor);
                this.SetShapeBrushColor(DiagramBrushes.ShapeText, this.TailoringColors.TextColor);
                this.SetShapePenColor(DiagramPens.ShapeOutline, this.TailoringColors.OutlineColor);

                // TODO: Set tailoring styles for items in all compartments
                ////var compartmentsInfo = this.GetCompartmentDescriptions();
                ////foreach (var compartmentInfo in compartmentsInfo)
                ////{
                ////    ElementListCompartment compartment = this.FindCompartment(compartmentInfo.Name) as ElementListCompartment;
                ////    if (compartment != null)
                ////    {
                ////        foreach (var item in compartment.Items)
                ////        {
                ////        NamedElementSchema listedElement = item as NamedElementSchema;
                ////        if ((listedElement != null) && (listedElement.IsInheritedFromBase))
                ////        {
                ////            compartment.
                ////        }
                ////        else
                ////        {
                ////            compartment.ItemTextColor =
                ////        }
                ////    }
                ////}
            }
            else
            {
                // Reset to orginally configured styles for this instance.
                this.InitializeResources(this.StyleSet);
            }
        }
示例#6
0
        private static string ConstructHierarchyName(NamedElementSchema element)
        {
            StringBuilder nameBuilder = new StringBuilder();

            nameBuilder.Insert(0, element.Name);
            nameBuilder.Insert(0, @":");
            nameBuilder.Insert(0, element.GetType().Name);
            var parent = DomainClassInfo.FindEmbeddingElement(element);

            while (parent != null && parent is NamedElementSchema)
            {
                var namedParent = (NamedElementSchema)parent;
                nameBuilder.Insert(0, @".");
                nameBuilder.Insert(0, namedParent.Name);
                nameBuilder.Insert(0, @":");
                nameBuilder.Insert(0, namedParent.GetType().Name);

                parent = DomainClassInfo.FindEmbeddingElement(parent);
            }

            return(nameBuilder.ToString());
        }
 /// <summary>
 /// Called after the IsCodeIdentifierTracking property changes.
 /// </summary>
 protected override void OnValueChanged(NamedElementSchema element, bool oldValue, bool newValue)
 {
     base.OnValueChanged(element, oldValue, newValue);
     if (!element.Store.InUndoRedoOrRollback && newValue)
     {
         DomainPropertyInfo propInfo =
             element.Store.DomainDataDirectory.GetDomainProperty(
                 NamedElementSchema.CodeIdentifierDomainPropertyId);
         propInfo.NotifyValueChange(element);
     }
 }
 /// <summary>
 /// Preset the value of the tracking property as it is not serialized.
 /// </summary>
 internal void PreResetValue(NamedElementSchema element)
 {
     // Force the tracking property to false so that the value
     // of the CodeIdentifier property is retrieved from storage.
     element.isCodeIdentifierTrackingPropertyStorage = false;
 }
            /// <summary>
            /// Sets the value of the tracking property based on stored value of the CodeIdentifier property.
            /// </summary>
            internal void ResetValue(NamedElementSchema element)
            {
                string calculatedValue = null;

                try
                {
                    calculatedValue = element.CalculateCodeIdentifierTrackingValue();
                }
                catch (NullReferenceException)
                {
                }
                catch (System.Exception e)
                {
                    if (ErrorHandler.IsCriticalException(e))
                    {
                        throw;
                    }
                }

                if (calculatedValue != null)
                {
                    if (string.Equals(element.CodeIdentifier, calculatedValue, StringComparison.Ordinal)
                        || string.IsNullOrEmpty(element.CodeIdentifier))
                    {
                        element.isCodeIdentifierTrackingPropertyStorage = true;
                    }
                }
            }
 /// <summary>
 /// Preset the value of the tracking property as it is not serialized.
 /// </summary>
 internal void PreResetValue(NamedElementSchema element)
 {
     // Force the tracking property to false so that the value
     // of the Description property is retrieved from storage.
     element.isDescriptionTrackingPropertyStorage = false;
 }
        private static string ConstructHierarchyName(NamedElementSchema element)
        {
            StringBuilder nameBuilder = new StringBuilder();

            nameBuilder.Insert(0, element.Name);
            nameBuilder.Insert(0, @":");
            nameBuilder.Insert(0, element.GetType().Name);
            var parent = DomainClassInfo.FindEmbeddingElement(element);

            while (parent != null && parent is NamedElementSchema)
            {
                var namedParent = (NamedElementSchema)parent;
                nameBuilder.Insert(0, @".");
                nameBuilder.Insert(0, namedParent.Name);
                nameBuilder.Insert(0, @":");
                nameBuilder.Insert(0, namedParent.GetType().Name);

                parent = DomainClassInfo.FindEmbeddingElement(parent);
            }

            return nameBuilder.ToString();
        }
示例#12
0
 /// <summary>
 /// Preset the value of the tracking property as it is not serialized.
 /// </summary>
 internal void PreResetValue(NamedElementSchema element)
 {
     // Force the tracking property to false so that the value
     // of the CodeIdentifier property is retrieved from storage.
     element.isCodeIdentifierTrackingPropertyStorage = false;
 }
示例#13
0
 /// <summary>
 /// Preset the value of the tracking property as it is not serialized.
 /// </summary>
 internal void PreResetValue(NamedElementSchema element)
 {
     // Force the tracking property to false so that the value
     // of the Description property is retrieved from storage.
     element.isDescriptionTrackingPropertyStorage = false;
 }