public static void SetDependencyShape(GraphicalDependencyLinkShape element, GraphicalDependencyShape newGraphicalDependencyShape) { DslModeling::DomainRoleInfo.SetLinkedElement(element, GraphicalDependencyLinkShapeDomainRoleId, newGraphicalDependencyShape); }
/// <summary> /// Constuctor. /// </summary> /// <param name="viewModelStore">The store this view model belongs to.</param> /// <param name="diagram">The Diagram this item belongs to.</param> /// <param name="shapeElement">Model element, that is hosted by this view model.</param> public GraphicalDependencyLinkViewModel(ViewModelStore viewModelStore, DiagramSurfaceViewModel diagram, GraphicalDependencyLinkShape shapeElement) : base(viewModelStore, diagram, shapeElement) { }
public static GraphicalDependencyShape GetDependencyShape(GraphicalDependencyLinkShape element) { return DslModeling::DomainRoleInfo.GetLinkedElement(element, GraphicalDependencyLinkShapeDomainRoleId) as GraphicalDependencyShape; }
/// <summary> /// Constructor /// Creates a GraphicalDependencyLinkShapeReferencesDependencyShape link in the same Partition as the given GraphicalDependencyLinkShape /// </summary> /// <param name="source">GraphicalDependencyLinkShape to use as the source of the relationship.</param> /// <param name="target">GraphicalDependencyShape to use as the target of the relationship.</param> public GraphicalDependencyLinkShapeReferencesDependencyShape(GraphicalDependencyLinkShape source, GraphicalDependencyShape target) : base((source != null ? source.Partition : null), new DslModeling::RoleAssignment[]{new DslModeling::RoleAssignment(GraphicalDependencyLinkShapeReferencesDependencyShape.GraphicalDependencyLinkShapeDomainRoleId, source), new DslModeling::RoleAssignment(GraphicalDependencyLinkShapeReferencesDependencyShape.GraphicalDependencyShapeDomainRoleId, target)}, null) { }
private static void WriteChildElements(DslModeling::SerializationContext serializationContext, GraphicalDependencyLinkShape element, global::System.Xml.XmlWriter writer) { // GraphicalDependencyLinkShapeReferencesMainShape GraphicalDependencyLinkShapeReferencesMainShape theGraphicalDependencyLinkShapeReferencesMainShapeInstance = GraphicalDependencyLinkShapeReferencesMainShape.GetLinkToMainShape(element); if (!serializationContext.Result.Failed && theGraphicalDependencyLinkShapeReferencesMainShapeInstance != null) { writer.WriteStartElement("mainShape"); DslModeling::DomainClassXmlSerializer relSerializer = serializationContext.Directory.GetSerializer(theGraphicalDependencyLinkShapeReferencesMainShapeInstance.GetDomainClass().Id); global::System.Diagnostics.Debug.Assert(relSerializer != null, "Cannot find serializer for " + theGraphicalDependencyLinkShapeReferencesMainShapeInstance.GetDomainClass().Name + "!"); relSerializer.Write(serializationContext, theGraphicalDependencyLinkShapeReferencesMainShapeInstance, writer); writer.WriteEndElement(); } // GraphicalDependencyLinkShapeReferencesDependencyShape GraphicalDependencyLinkShapeReferencesDependencyShape theGraphicalDependencyLinkShapeReferencesDependencyShapeInstance = GraphicalDependencyLinkShapeReferencesDependencyShape.GetLinkToDependencyShape(element); if (!serializationContext.Result.Failed && theGraphicalDependencyLinkShapeReferencesDependencyShapeInstance != null) { writer.WriteStartElement("dependencyShape"); DslModeling::DomainClassXmlSerializer relSerializer = serializationContext.Directory.GetSerializer(theGraphicalDependencyLinkShapeReferencesDependencyShapeInstance.GetDomainClass().Id); global::System.Diagnostics.Debug.Assert(relSerializer != null, "Cannot find serializer for " + theGraphicalDependencyLinkShapeReferencesDependencyShapeInstance.GetDomainClass().Name + "!"); relSerializer.Write(serializationContext, theGraphicalDependencyLinkShapeReferencesDependencyShapeInstance, writer); writer.WriteEndElement(); } }
private static void ReadGraphicalDependencyLinkShapeReferencesDependencyShapeInstance(DslModeling::SerializationContext serializationContext, GraphicalDependencyLinkShape element, global::System.Xml.XmlReader reader) { if (DslModeling::DomainRoleInfo.GetElementLinks<GraphicalDependencyLinkShapeReferencesDependencyShape> (element, GraphicalDependencyLinkShapeReferencesDependencyShape.GraphicalDependencyLinkShapeDomainRoleId).Count > 0) { // Only allow one instance, which already exists, so skip everything DslModeling::SerializationUtilities.Skip(reader); // Moniker contains no child XML elements, so just skip. return; } while (!serializationContext.Result.Failed && !reader.EOF && reader.NodeType == global::System.Xml.XmlNodeType.Element) { DslModeling::DomainClassXmlSerializer newGraphicalDependencyLinkShapeReferencesDependencyShapeSerializer = serializationContext.Directory.GetSerializer(GraphicalDependencyLinkShapeReferencesDependencyShape.DomainClassId); global::System.Diagnostics.Debug.Assert(newGraphicalDependencyLinkShapeReferencesDependencyShapeSerializer != null, "Cannot find serializer for GraphicalDependencyLinkShapeReferencesDependencyShape!"); GraphicalDependencyLinkShapeReferencesDependencyShape newGraphicalDependencyLinkShapeReferencesDependencyShape = newGraphicalDependencyLinkShapeReferencesDependencyShapeSerializer.TryCreateInstance (serializationContext, reader, element.Partition) as GraphicalDependencyLinkShapeReferencesDependencyShape; if (newGraphicalDependencyLinkShapeReferencesDependencyShape != null) { DslModeling::DomainRoleInfo.SetRolePlayer (newGraphicalDependencyLinkShapeReferencesDependencyShape, GraphicalDependencyLinkShapeReferencesDependencyShape.GraphicalDependencyLinkShapeDomainRoleId, element); DslModeling::DomainClassXmlSerializer targetSerializer = serializationContext.Directory.GetSerializer (newGraphicalDependencyLinkShapeReferencesDependencyShape.GetDomainClass().Id); global::System.Diagnostics.Debug.Assert (targetSerializer != null, "Cannot find serializer for " + newGraphicalDependencyLinkShapeReferencesDependencyShape.GetDomainClass().Name + "!"); targetSerializer.Read(serializationContext, newGraphicalDependencyLinkShapeReferencesDependencyShape, reader); break; // Only allow one instance. } else { // Maybe the relationship is serialized in short-form by mistake. DslModeling::DomainClassXmlSerializer newGraphicalDependencyShapeMonikerOfGraphicalDependencyLinkShapeReferencesDependencyShapeSerializer = serializationContext.Directory.GetSerializer(GraphicalDependencyShape.DomainClassId); global::System.Diagnostics.Debug.Assert(newGraphicalDependencyShapeMonikerOfGraphicalDependencyLinkShapeReferencesDependencyShapeSerializer != null, "Cannot find serializer for GraphicalDependencyShape!"); DslModeling::Moniker newGraphicalDependencyShapeMonikerOfGraphicalDependencyLinkShapeReferencesDependencyShape = newGraphicalDependencyShapeMonikerOfGraphicalDependencyLinkShapeReferencesDependencyShapeSerializer.TryCreateMonikerInstance(serializationContext, reader, element, GraphicalDependencyLinkShapeReferencesDependencyShape.DomainClassId, element.Partition); if (newGraphicalDependencyShapeMonikerOfGraphicalDependencyLinkShapeReferencesDependencyShape != null) { TestDslDefinitionSerializationBehaviorSerializationMessages.ExpectingFullFormRelationship(serializationContext, reader, typeof(GraphicalDependencyLinkShapeReferencesDependencyShape)); new GraphicalDependencyLinkShapeReferencesDependencyShape(element.Partition, new DslModeling::RoleAssignment(GraphicalDependencyLinkShapeReferencesDependencyShape.GraphicalDependencyLinkShapeDomainRoleId, element), new DslModeling::RoleAssignment(GraphicalDependencyLinkShapeReferencesDependencyShape.GraphicalDependencyShapeDomainRoleId, newGraphicalDependencyShapeMonikerOfGraphicalDependencyLinkShapeReferencesDependencyShape)); DslModeling::SerializationUtilities.Skip(reader); // Moniker contains no child XML elements, so just skip. break; // Only allow one instance. } else { // Unknown element, skip. DslModeling::SerializationUtilities.Skip(reader); } } } }
/// <summary> /// This method deserializes all child model elements. /// </summary> /// <remarks> /// The caller will position the reader at the open tag of the first child XML element to deserialized. /// This method will read as many child elements as it can. It returns under three circumstances: /// 1) When an unknown child XML element is encountered. In this case, this method will position the reader at the /// open tag of the unknown element. This implies that if the first child XML element is unknown, this method /// should return immediately and do nothing. /// 2) When all child XML elemnets are read. In this case, the reader will be positioned at the end tag of the parent element. /// 3) EOF. /// </remarks> /// <param name="serializationContext">Serialization context.</param> /// <param name="reader">XmlReader to read serialized data from.</param> /// <param name="element">In-memory GraphicalDependencyLinkShape instance that will get the deserialized data.</param> private static void ReadChildElements(DslModeling::SerializationContext serializationContext, GraphicalDependencyLinkShape element, global::System.Xml.XmlReader reader) { while (!serializationContext.Result.Failed && !reader.EOF && reader.NodeType == global::System.Xml.XmlNodeType.Element) { switch (reader.LocalName) { case "mainShape": // Relationship "GraphicalDependencyLinkShapeReferencesMainShape" if (reader.IsEmptyElement) { // No instance of this relationship, just skip DslModeling::SerializationUtilities.Skip(reader); } else { DslModeling::SerializationUtilities.SkipToFirstChild(reader); // Skip the open tag of <mainShape> ReadGraphicalDependencyLinkShapeReferencesMainShapeInstance(serializationContext, element, reader); DslModeling::SerializationUtilities.Skip(reader); // Skip the close tag of </mainShape> } break; case "dependencyShape": // Relationship "GraphicalDependencyLinkShapeReferencesDependencyShape" if (reader.IsEmptyElement) { // No instance of this relationship, just skip DslModeling::SerializationUtilities.Skip(reader); } else { DslModeling::SerializationUtilities.SkipToFirstChild(reader); // Skip the open tag of <dependencyShape> ReadGraphicalDependencyLinkShapeReferencesDependencyShapeInstance(serializationContext, element, reader); DslModeling::SerializationUtilities.Skip(reader); // Skip the close tag of </dependencyShape> } break; default: return; // Don't know this element. } } }