/// <summary> /// This method is called during deserialization to convert a given value to a specific typed value (Html). /// </summary> /// <param name="serializationContext">The current serialization context instance.</param> /// <param name="modelELement">ModdelElement, to which the property belongs to.</param> /// <param name="propertyName">The Property name, which value is to be converted.</param> /// <param name="value">Value to convert.</param> /// <param name="targetType">Type, the object is to be converted to.</param> /// <param name="isRequired">True if this property is marked as required in the domain model. Can be null.</param> /// <returns>Converted value.</returns> public static Tum.PDE.ToolFramework.Modeling.Visualization.VMXExtensions.Html.Html ConvertTypedObjectHtmlFrom(DslModeling::SerializationContext serializationContext, DslModeling::ModelElement modelELement, string propertyName, object value, System.Type targetType, bool? isRequired) { if (value == null) return null; string strValue = value.ToString(); if (!String.IsNullOrEmpty(strValue) && modelELement is DslEditorModeling::IDomainModelOwnable) { DslEditorModeling::IParentModelElement parent; if (modelELement is DslEditorModeling::IParentModelElement) parent = modelELement as DslEditorModeling::IParentModelElement; else parent = (modelELement as DslEditorModeling::IDomainModelOwnable).GetDomainModelServices().ElementParentProvider.GetParentModelElement(modelELement); if (parent != null) { string filePath = parent.DomainFilePath; string directory = new System.IO.FileInfo(filePath).DirectoryName; Tum.PDE.ToolFramework.Modeling.Visualization.VMXExtensions.Html.Html html = new Tum.PDE.ToolFramework.Modeling.Visualization.VMXExtensions.Html.Html(strValue, directory); return html; } else { serializationContext.Result.AddMessage(new DslModeling::SerializationMessage(DslModeling::SerializationMessageKind.Error, "Could not resolve domain directory path.", modelELement.ToString(), 0, 0, null)); } } else return null; return null; }
/// <summary> /// Create a shape of the given link shape type. /// </summary> /// <param name="shapeTypeId">Shape type id.</param> /// <param name="modelElement">Model element.</param> /// <param name="assignments">Properties for the shape.</param> /// <returns>Shape if one could be created. Null otherwise.</returns> public override DslModeling::ModelElement CreateShapeForElementLink(System.Guid shapeTypeId, DslModeling::ModelElement modelElement, params DslModeling::PropertyAssignment[] assignments) { DslEditorDiagrams::LinkShape nodeShape = null; if( createRSShapeMap == null ) { createRSShapeMap = new global::System.Collections.Generic.Dictionary<global::System.Guid, int>(2); createRSShapeMap.Add(global::Tum.FamilyTreeDSL.ParentOfShape.DomainClassId, 0); createRSShapeMap.Add(global::Tum.FamilyTreeDSL.MarriedToShape.DomainClassId, 1); } int index; if (!createRSShapeMap.TryGetValue(shapeTypeId, out index)) throw new global::System.ArgumentException("Unrecognized shape type " + shapeTypeId.ToString()); switch (index) { case 0: nodeShape = new global::Tum.FamilyTreeDSL.ParentOfShape(modelElement.Store, assignments); break; case 1: nodeShape = new global::Tum.FamilyTreeDSL.MarriedToShape(modelElement.Store, assignments); break; } if( nodeShape == null ) throw new System.InvalidOperationException("Couldn't create shape of type " + shapeTypeId.ToString() + " for element link " + modelElement.ToString()); nodeShape.Element = modelElement; return nodeShape; }
/// <summary> /// Create a shape of the given type for the given element type. /// </summary> /// <param name="modelElement">Model element.</param> /// <param name="shapeTypeId">Shape type id.</param> /// <param name="assignments">Properties for the shape.</param> /// <returns>Shape if one could be created. Null otherwise.</returns> public override DslModeling.ModelElement CreateShapeForElement(System.Guid shapeTypeId, DslModeling::ModelElement modelElement, params DslModeling::PropertyAssignment[] assignments) { DslEditorDiagrams::NodeShape nodeShape = null; if( createShapeMap == null ) { createShapeMap = new global::System.Collections.Generic.Dictionary<global::System.Guid, int>(15); createShapeMap.Add(global::Tum.VModellXT.RolleDependencyShape.DomainClassId, 0); createShapeMap.Add(global::Tum.VModellXT.DisziplinDependencyShape.DomainClassId, 1); createShapeMap.Add(global::Tum.VModellXT.ErzAbhDependencyShape.DomainClassId, 2); createShapeMap.Add(global::Tum.VModellXT.Dynamik.AblaufbausteinShape.DomainClassId, 3); createShapeMap.Add(global::Tum.VModellXT.Dynamik.StartpunktShape.DomainClassId, 4); createShapeMap.Add(global::Tum.VModellXT.Dynamik.EndepunktShape.DomainClassId, 5); createShapeMap.Add(global::Tum.VModellXT.Dynamik.AblaufentscheidungspunktShape.DomainClassId, 6); createShapeMap.Add(global::Tum.VModellXT.Dynamik.AblaufbausteinpunktShape.DomainClassId, 7); createShapeMap.Add(global::Tum.VModellXT.Dynamik.SplitShape.DomainClassId, 8); createShapeMap.Add(global::Tum.VModellXT.Dynamik.SplitEingangShape.DomainClassId, 9); createShapeMap.Add(global::Tum.VModellXT.Dynamik.SplitAusgangShape.DomainClassId, 10); createShapeMap.Add(global::Tum.VModellXT.Dynamik.JoinShape.DomainClassId, 11); createShapeMap.Add(global::Tum.VModellXT.Dynamik.JoinEingangShape.DomainClassId, 12); createShapeMap.Add(global::Tum.VModellXT.Dynamik.JoinAusgangShape.DomainClassId, 13); createShapeMap.Add(global::Tum.VModellXT.Dynamik.AblaufbausteinspezifikationShape.DomainClassId, 14); } int index; if (!createShapeMap.TryGetValue(shapeTypeId, out index)) throw new global::System.ArgumentException("Unrecognized shape type " + shapeTypeId.ToString()); switch (index) { case 0: nodeShape = new global::Tum.VModellXT.RolleDependencyShape(modelElement.Store, assignments); break; case 1: nodeShape = new global::Tum.VModellXT.DisziplinDependencyShape(modelElement.Store, assignments); break; case 2: nodeShape = new global::Tum.VModellXT.ErzAbhDependencyShape(modelElement.Store, assignments); break; case 3: nodeShape = new global::Tum.VModellXT.Dynamik.AblaufbausteinShape(modelElement.Store, assignments); break; case 4: nodeShape = new global::Tum.VModellXT.Dynamik.StartpunktShape(modelElement.Store, assignments); break; case 5: nodeShape = new global::Tum.VModellXT.Dynamik.EndepunktShape(modelElement.Store, assignments); break; case 6: nodeShape = new global::Tum.VModellXT.Dynamik.AblaufentscheidungspunktShape(modelElement.Store, assignments); break; case 7: nodeShape = new global::Tum.VModellXT.Dynamik.AblaufbausteinpunktShape(modelElement.Store, assignments); break; case 8: nodeShape = new global::Tum.VModellXT.Dynamik.SplitShape(modelElement.Store, assignments); break; case 9: nodeShape = new global::Tum.VModellXT.Dynamik.SplitEingangShape(modelElement.Store, assignments); break; case 10: nodeShape = new global::Tum.VModellXT.Dynamik.SplitAusgangShape(modelElement.Store, assignments); break; case 11: nodeShape = new global::Tum.VModellXT.Dynamik.JoinShape(modelElement.Store, assignments); break; case 12: nodeShape = new global::Tum.VModellXT.Dynamik.JoinEingangShape(modelElement.Store, assignments); break; case 13: nodeShape = new global::Tum.VModellXT.Dynamik.JoinAusgangShape(modelElement.Store, assignments); break; case 14: nodeShape = new global::Tum.VModellXT.Dynamik.AblaufbausteinspezifikationShape(modelElement.Store, assignments); break; } if( nodeShape == null ) throw new System.InvalidOperationException("Couldn't create shape of type " + shapeTypeId.ToString() + " for model element " + modelElement.ToString()); nodeShape.Element = modelElement; return nodeShape; }