public dynamic BuildDisplay(IContent content, string displayType = "", string groupId = "")
        {
            var shape = _origami.ContentShape(content, displayType);

            _origami.Build(_origami.ContentBuilder(content).WithDisplayType(String.IsNullOrWhiteSpace(displayType)?"Detail":displayType).WithGroup(groupId), shape);
            return(shape);
        }
Esempio n. 2
0
        protected override ModelDriverResult Build(ConnectorEventContext model, dynamic shapeHelper, ModelShapeContext context)
        {
            return(Combined(
                       ModelShape("Connectors_Connector", () => {
                var builder = _origami.ContentBuilder(model.ConnectorContent).WithDisplayType(context.DisplayType).WithParent(context).WithMode("Display");
                builder.Context.CustomContext[typeof(SocketParentContext)] = new SocketParentContext(model)
                {
                    ModelContext = context
                };
                var shape = _origami.ContentShape(model.ConnectorContent.ContentItem, context.DisplayType, prefix: context.Prefix);
                _origami.Build(builder, shape);
                return shape;
            }),
                       ModelShape("Connectors_Right", () => {
                var builder = _origami.ContentBuilder(model.Right.Content).WithDisplayType(context.DisplayType).WithParent(context).WithMode("Display");
                builder.Context.CustomContext[typeof(SocketParentContext)] = new SocketParentContext(model)
                {
                    ModelContext = context
                };
                var shape = _origami.ContentShape(model.Right.Content.ContentItem, context.DisplayType, prefix: context.Prefix);
                _origami.Build(builder, shape);
                return shape;
            })
//                ModelShape("Connectors_Left", () => {
//                  var builder = _origami.ContentBuilder(model.ConnectorContent).WithDisplayType(context.DisplayType).WithParent(context);
//            })
                       ));
        }
 public void Subscribe(RootBuilder describe)
 {
     describe.Scope("Content", mix => {
         mix.Factory <RootShape, dynamic>((context) => _origami.ContentShape(context.Get <Model, object>() as IContent, context.Get <ShapeMetadataFactory, ShapeMetadata>().DisplayType));
         mix.Factory <ModelBuilder, ModelShapeBuilder>((context) => _origami.ContentBuilder(context.Get <Model, object>() as IContent).WithDisplayType(context.Get <ShapeMetadataFactory, ShapeMetadata>().DisplayType));
         mix.Parameter <int>("contentId", (mix2) => {
             mix2.Factory <Model, object>((ctx) => _contentManager.Get(mix2.Get(ctx), VersionOptions.Published));
         });
     });
 }
Esempio n. 4
0
        public ModelShapeBuilder Builder(IContent model, CompositionContext context)
        {
            var paradigms = context.Get <ContentList, ParadigmsContext>();
            var builder   = _origami.ContentBuilder(model).WithDisplayType(context.Get <ContentList, ShapeMetadata>().DisplayType);

            if (paradigms != null)
            {
                builder.WithParadigms(paradigms);
            }
            return(builder);
        }
Esempio n. 5
0
        protected override DriverResult Display(ConnectorPart part, string displayType, dynamic shapeHelper)
        {
            // TODO: Right now this has become irrelevant but it could be useful in some circumstances...
            return(ContentShape("Parts_Connector", () => {
                var rightItem = part.RightContent;
                if (rightItem == null)
                {
                    // TODO: Notify this error? It will be logged as-is
                    throw new Exception("Connection with invalid right item");
                }

                return _origami.Build(
                    _origami.ContentBuilder(rightItem).WithDisplayType(displayType),
                    _origami.ContentShape(rightItem, displayType));
            }));
        }