public static ModelShapeBuilder WithParent(this ModelShapeBuilder builder, ModelShapeContext parent) { if (parent == null) { builder.Context.ParentContext = null; builder.Context.CustomContext = null; } else { builder.Context.ParentContext = parent; builder.Context.CustomContext = parent.CustomContext; } return(builder); }
public void Build(ModelShapeBuilder builder, dynamic root) { var context = builder.Context; context.Shape = root; BindPlacement(context, context.DisplayType, context.Stereotype, builder.ContentType); foreach (var driver in Drivers) { var result = driver.Run(context); // Null check for driver result if (result != null) { result.Apply(context); } } // Chain sub results? // They are applied to the same base object (as opposed to rendering an entirely new shape with its own zones) foreach (var chain in context.ChainedResults) { var newRoot = chain.Root ?? root; Build( Builder(chain.Model) // TODO: Could be nice to chain from displays to editors and back; assuming updater is available // To do that we could pass a whole new Builder into context instead of this hack? .WithMode(context.Mode) .WithUpdater(context.Updater, chain.Prefix) .WithDisplayType(chain.DisplayType ?? context.DisplayType) .WithStereotype(context.Stereotype) .WithContentType(builder.ContentType) .WithParent(context) .WithParadigms(context.Paradigms) , newRoot); // Fire an event so parent shape can perform work after the update chain.OnCompleted(context); } // Invoke Updated event now all drivers have been executed if (context.Updater != null) { context.InvokeUpdated(); } // Done }
public void Build(ModelShapeBuilder builder, dynamic root) { var context = builder.Context; context.Shape = root; BindPlacement(context, context.DisplayType, context.Stereotype, builder.ContentType); foreach (var driver in Drivers) { var result = driver.Run(context); // Null check for driver result if (result != null) { result.Apply(context); } } // Chain sub results? // They are applied to the same base object (as opposed to rendering an entirely new shape with its own zones) foreach (var chain in context.ChainedResults) { var newRoot = chain.Root ?? root; Build( Builder(chain.Model) // TODO: Could be nice to chain from displays to editors and back; assuming updater is available // To do that we could pass a whole new Builder into context instead of this hack? .WithMode(context.Mode) .WithUpdater(context.Updater,chain.Prefix) .WithDisplayType(chain.DisplayType??context.DisplayType) .WithStereotype(context.Stereotype) .WithContentType(builder.ContentType) .WithParent(context) .WithParadigms(context.Paradigms) ,newRoot); // Fire an event so parent shape can perform work after the update chain.OnCompleted(context); } // Invoke Updated event now all drivers have been executed if (context.Updater != null) { context.InvokeUpdated(); } // Done }
public static ModelShapeBuilder WithGroup(this ModelShapeBuilder builder, string groupId) { builder.Context.GroupId = groupId; return(builder); }
public static ModelShapeBuilder WithParadigms(this ModelShapeBuilder builder, ParadigmsContext paradigms) { builder.Context.Paradigms = new ParadigmsContext(paradigms); return(builder); }
public static ModelShapeBuilder WithParadigms(this ModelShapeBuilder builder, IEnumerable <String> paradigms) { builder.Context.Paradigms.Add(paradigms); return(builder); }
public static ModelShapeBuilder WithParadigms(this ModelShapeBuilder builder, params string[] paradigms) { builder.Context.Paradigms.Add(paradigms); return(builder); }
public static ModelShapeBuilder WithContentType(this ModelShapeBuilder builder, string contentType) { builder.ContentType = contentType; return(builder); }
public static ModelShapeBuilder WithStereotype(this ModelShapeBuilder builder, string stereotype) { builder.Context.Stereotype = stereotype; return(builder); }
public static ModelShapeBuilder WithDisplayType(this ModelShapeBuilder builder, string displayType) { builder.Context.DisplayType = displayType; return(builder); }
public static ModelShapeBuilder WithUpdater(this ModelShapeBuilder builder, IUpdateModel updater, string prefix) { builder.Context.Updater = updater; builder.Context.Prefix = prefix; return(builder); }
public static ModelShapeBuilder WithMode(this ModelShapeBuilder builder, string mode) { builder.Context.Mode = mode; return(builder); }