PageRenderTime 207ms CodeModel.GetById 13ms RepoModel.GetById 0ms app.codeStats 0ms

/Dsl/GeneratedCode/Shapes.cs

#
C# | 288 lines | 183 code | 33 blank | 72 comment | 15 complexity | e20bc4b1c4fccf7f26a4d8bc0fdc32ad MD5 | raw file
  1. //------------------------------------------------------------------------------
  2. // <auto-generated>
  3. // This code was generated by a tool.
  4. //
  5. // Changes to this file may cause incorrect behavior and will be lost if
  6. // the code is regenerated.
  7. // </auto-generated>
  8. //------------------------------------------------------------------------------
  9. using DslModeling = global::Microsoft.VisualStudio.Modeling;
  10. using DslDesign = global::Microsoft.VisualStudio.Modeling.Design;
  11. using DslDiagrams = global::Microsoft.VisualStudio.Modeling.Diagrams;
  12. namespace Navigation.Designer
  13. {
  14. /// <summary>
  15. /// DomainClass StateShape
  16. /// Shape used to represent ExampleElements on a Diagram.
  17. /// </summary>
  18. [DslDesign::DisplayNameResource("Navigation.Designer.StateShape.DisplayName", typeof(global::Navigation.Designer.NavigationLanguageDomainModel), "Navigation.Designer.GeneratedCode.DomainModelResx")]
  19. [DslDesign::DescriptionResource("Navigation.Designer.StateShape.Description", typeof(global::Navigation.Designer.NavigationLanguageDomainModel), "Navigation.Designer.GeneratedCode.DomainModelResx")]
  20. [DslModeling::DomainModelOwner(typeof(global::Navigation.Designer.NavigationLanguageDomainModel))]
  21. [global::System.CLSCompliant(true)]
  22. [DslModeling::DomainObjectId("9f74225c-a664-4930-a0fe-46845216068a")]
  23. public partial class StateShape : DslDiagrams::NodeShape
  24. {
  25. #region DiagramElement boilerplate
  26. private static DslDiagrams::StyleSet classStyleSet;
  27. private static global::System.Collections.Generic.IList<DslDiagrams::ShapeField> shapeFields;
  28. private static global::System.Collections.Generic.IList<DslDiagrams::Decorator> decorators;
  29. /// <summary>
  30. /// Per-class style set for this shape.
  31. /// </summary>
  32. protected override DslDiagrams::StyleSet ClassStyleSet
  33. {
  34. get
  35. {
  36. if (classStyleSet == null)
  37. {
  38. classStyleSet = CreateClassStyleSet();
  39. }
  40. return classStyleSet;
  41. }
  42. }
  43. /// <summary>
  44. /// Per-class ShapeFields for this shape.
  45. /// </summary>
  46. public override global::System.Collections.Generic.IList<DslDiagrams::ShapeField> ShapeFields
  47. {
  48. get
  49. {
  50. if (shapeFields == null)
  51. {
  52. shapeFields = CreateShapeFields();
  53. }
  54. return shapeFields;
  55. }
  56. }
  57. /// <summary>
  58. /// Event fired when decorator initialization is complete for this shape type.
  59. /// </summary>
  60. public static event global::System.EventHandler DecoratorsInitialized;
  61. /// <summary>
  62. /// List containing decorators used by this type.
  63. /// </summary>
  64. public override global::System.Collections.Generic.IList<DslDiagrams::Decorator> Decorators
  65. {
  66. get
  67. {
  68. if(decorators == null)
  69. {
  70. decorators = CreateDecorators();
  71. // fire this event to allow the diagram to initialize decorator mappings for this shape type.
  72. if(DecoratorsInitialized != null)
  73. {
  74. DecoratorsInitialized(this, global::System.EventArgs.Empty);
  75. }
  76. }
  77. return decorators;
  78. }
  79. }
  80. /// <summary>
  81. /// Finds a decorator associated with StateShape.
  82. /// </summary>
  83. public static DslDiagrams::Decorator FindStateShapeDecorator(string decoratorName)
  84. {
  85. if(decorators == null) return null;
  86. return DslDiagrams::ShapeElement.FindDecorator(decorators, decoratorName);
  87. }
  88. /// <summary>
  89. /// Shape instance initialization.
  90. /// </summary>
  91. public override void OnInitialize()
  92. {
  93. base.OnInitialize();
  94. // Create host shapes for outer decorators.
  95. foreach(DslDiagrams::Decorator decorator in this.Decorators)
  96. {
  97. if(decorator.RequiresHost)
  98. {
  99. decorator.ConfigureHostShape(this);
  100. }
  101. }
  102. }
  103. #endregion
  104. #region Shape size
  105. /// <summary>
  106. /// Default size for this shape.
  107. /// </summary>
  108. public override DslDiagrams::SizeD DefaultSize
  109. {
  110. get
  111. {
  112. return new DslDiagrams::SizeD(2, 0.75);
  113. }
  114. }
  115. #endregion
  116. #region Shape styles
  117. /// <summary>
  118. /// Initializes style set resources for this shape type
  119. /// </summary>
  120. /// <param name="classStyleSet">The style set for this shape class</param>
  121. protected override void InitializeResources(DslDiagrams::StyleSet classStyleSet)
  122. {
  123. base.InitializeResources(classStyleSet);
  124. // Outline pen settings for this shape.
  125. DslDiagrams::PenSettings outlinePen = new DslDiagrams::PenSettings();
  126. outlinePen.Color = global::System.Drawing.Color.FromArgb(255, 113, 111, 110);
  127. outlinePen.Width = 0.01F;
  128. classStyleSet.OverridePen(DslDiagrams::DiagramPens.ShapeOutline, outlinePen);
  129. // Fill brush settings for this shape.
  130. DslDiagrams::BrushSettings backgroundBrush = new DslDiagrams::BrushSettings();
  131. backgroundBrush.Color = global::System.Drawing.Color.FromArgb(255, 242, 239, 229);
  132. classStyleSet.OverrideBrush(DslDiagrams::DiagramBrushes.ShapeBackground, backgroundBrush);
  133. }
  134. /// <summary>
  135. /// Indicates whether this shape displays a background gradient.
  136. /// </summary>
  137. public override bool HasBackgroundGradient
  138. {
  139. get
  140. {
  141. return true;
  142. }
  143. }
  144. /// <summary>
  145. /// Indicates the direction of the gradient.
  146. /// </summary>
  147. public override global::System.Drawing.Drawing2D.LinearGradientMode BackgroundGradientMode
  148. {
  149. get
  150. {
  151. return global::System.Drawing.Drawing2D.LinearGradientMode.Horizontal;
  152. }
  153. }
  154. #endregion
  155. #region Decorators
  156. /// <summary>
  157. /// Initialize the collection of shape fields associated with this shape type.
  158. /// </summary>
  159. protected override void InitializeShapeFields(global::System.Collections.Generic.IList<DslDiagrams::ShapeField> shapeFields)
  160. {
  161. base.InitializeShapeFields(shapeFields);
  162. DslDiagrams::TextField field1 = new DslDiagrams::TextField("KeyDecorator");
  163. field1.DefaultText = global::Navigation.Designer.NavigationLanguageDomainModel.SingletonResourceManager.GetString("StateShapeKeyDecoratorDefaultText");
  164. field1.DefaultFocusable = true;
  165. field1.DefaultAutoSize = true;
  166. field1.AnchoringBehavior.MinimumHeightInLines = 1;
  167. field1.AnchoringBehavior.MinimumWidthInCharacters = 1;
  168. field1.DefaultAccessibleState = global::System.Windows.Forms.AccessibleStates.Invisible;
  169. shapeFields.Add(field1);
  170. DslDiagrams::TextField field2 = new DslDiagrams::TextField("PageDecorator");
  171. field2.DefaultText = global::Navigation.Designer.NavigationLanguageDomainModel.SingletonResourceManager.GetString("StateShapePageDecoratorDefaultText");
  172. field2.DefaultFocusable = true;
  173. field2.DefaultAutoSize = true;
  174. field2.AnchoringBehavior.MinimumHeightInLines = 1;
  175. field2.AnchoringBehavior.MinimumWidthInCharacters = 1;
  176. field2.DefaultAccessibleState = global::System.Windows.Forms.AccessibleStates.Invisible;
  177. shapeFields.Add(field2);
  178. DslDiagrams::ImageField field3 = new DslDiagrams::ImageField("InitialDecorator");
  179. field3.DefaultImage = DslDiagrams::ImageHelper.GetImage(global::Navigation.Designer.NavigationLanguageDomainModel.SingletonResourceManager.GetObject("StateShapeInitialDecoratorDefaultImage"));
  180. shapeFields.Add(field3);
  181. DslDiagrams::TextField field4 = new DslDiagrams::TextField("RouteDecorator");
  182. field4.DefaultText = global::Navigation.Designer.NavigationLanguageDomainModel.SingletonResourceManager.GetString("StateShapeRouteDecoratorDefaultText");
  183. field4.DefaultFocusable = true;
  184. field4.DefaultAutoSize = true;
  185. field4.AnchoringBehavior.MinimumHeightInLines = 1;
  186. field4.AnchoringBehavior.MinimumWidthInCharacters = 1;
  187. field4.DefaultAccessibleState = global::System.Windows.Forms.AccessibleStates.Invisible;
  188. shapeFields.Add(field4);
  189. }
  190. /// <summary>
  191. /// Initialize the collection of decorators associated with this shape type. This method also
  192. /// creates shape fields for outer decorators, because these are not part of the shape fields collection
  193. /// associated with the shape, so they must be created here rather than in InitializeShapeFields.
  194. /// </summary>
  195. protected override void InitializeDecorators(global::System.Collections.Generic.IList<DslDiagrams::ShapeField> shapeFields, global::System.Collections.Generic.IList<DslDiagrams::Decorator> decorators)
  196. {
  197. base.InitializeDecorators(shapeFields, decorators);
  198. DslDiagrams::ShapeField field1 = DslDiagrams::ShapeElement.FindShapeField(shapeFields, "KeyDecorator");
  199. DslDiagrams::Decorator decorator1 = new DslDiagrams::ShapeDecorator(field1, DslDiagrams::ShapeDecoratorPosition.InnerTopCenter, DslDiagrams::PointD.Empty);
  200. decorators.Add(decorator1);
  201. DslDiagrams::ShapeField field2 = DslDiagrams::ShapeElement.FindShapeField(shapeFields, "PageDecorator");
  202. DslDiagrams::Decorator decorator2 = new DslDiagrams::ShapeDecorator(field2, DslDiagrams::ShapeDecoratorPosition.Center, DslDiagrams::PointD.Empty);
  203. decorators.Add(decorator2);
  204. DslDiagrams::ShapeField field3 = DslDiagrams::ShapeElement.FindShapeField(shapeFields, "InitialDecorator");
  205. DslDiagrams::Decorator decorator3 = new DslDiagrams::ShapeDecorator(field3, DslDiagrams::ShapeDecoratorPosition.InnerTopLeft, DslDiagrams::PointD.Empty);
  206. decorators.Add(decorator3);
  207. DslDiagrams::ShapeField field4 = DslDiagrams::ShapeElement.FindShapeField(shapeFields, "RouteDecorator");
  208. DslDiagrams::Decorator decorator4 = new DslDiagrams::ShapeDecorator(field4, DslDiagrams::ShapeDecoratorPosition.InnerBottomCenter, DslDiagrams::PointD.Empty);
  209. decorators.Add(decorator4);
  210. }
  211. /// <summary>
  212. /// Ensure outer decorators are placed appropriately. This is called during view fixup,
  213. /// after the shape has been associated with the model element.
  214. /// </summary>
  215. public override void OnBoundsFixup(DslDiagrams::BoundsFixupState fixupState, int iteration, bool createdDuringViewFixup)
  216. {
  217. base.OnBoundsFixup(fixupState, iteration, createdDuringViewFixup);
  218. if(iteration == 0)
  219. {
  220. foreach(DslDiagrams::Decorator decorator in this.Decorators)
  221. {
  222. if(decorator.RequiresHost)
  223. {
  224. decorator.RepositionHostShape(decorator.GetHostShape(this));
  225. }
  226. }
  227. }
  228. }
  229. #endregion
  230. #region Constructors, domain class Id
  231. /// <summary>
  232. /// StateShape domain class Id.
  233. /// </summary>
  234. public static readonly new global::System.Guid DomainClassId = new global::System.Guid(0x9f74225c, 0xa664, 0x4930, 0xa0, 0xfe, 0x46, 0x84, 0x52, 0x16, 0x06, 0x8a);
  235. /// <summary>
  236. /// Constructor
  237. /// </summary>
  238. /// <param name="store">Store where new element is to be created.</param>
  239. /// <param name="propertyAssignments">List of domain property id/value pairs to set once the element is created.</param>
  240. public StateShape(DslModeling::Store store, params DslModeling::PropertyAssignment[] propertyAssignments)
  241. : this(store != null ? store.DefaultPartitionForClass(DomainClassId) : null, propertyAssignments)
  242. {
  243. }
  244. /// <summary>
  245. /// Constructor
  246. /// </summary>
  247. /// <param name="partition">Partition where new element is to be created.</param>
  248. /// <param name="propertyAssignments">List of domain property id/value pairs to set once the element is created.</param>
  249. public StateShape(DslModeling::Partition partition, params DslModeling::PropertyAssignment[] propertyAssignments)
  250. : base(partition, propertyAssignments)
  251. {
  252. }
  253. #endregion
  254. }
  255. }