/// <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); } }
/// <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> /// 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> /// 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); } }
/// <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); } }
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> /// 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> /// 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(); }