Пример #1
0
 public ConnectorDisplayContext(IConnector item, string displayType, SocketDisplayContext context) : base(context.Connector)
 {
     ConnectorContent = item;
     RenderConnector  = true;
     SocketContext    = context;
     RightField       = new Lazy <SocketEndpoint>(() => new SocketEndpoint(ConnectorContent.RightContent, displayType));
 }
 protected override void Displaying(SocketDisplayContext context) {
     // TODO: Optionally expose a unified feed comprised of all applicable connector types.
     // TODO: We could feasibly want to register the feed on other display types
     if (context.Left.DisplayType == "Detail") {
         var settings = context.Connector.PartDefinition.Settings.GetModel<AggregationTypePartSettings>();
         if (settings != null && settings.ExposeFeed) {
             _feedManager.Register(context.Left.ContentItem.GetTitle() + " - " + context.SocketMetadata.SocketTitle, "rss", new RouteValueDictionary { { "id", context.Left.ContentItem.Id }, { "connector", context.Connector.Name } });
         }
     }
 }
Пример #3
0
        protected override void Preparing(SocketDisplayContext context) {

            context.ModelContext.With<DrillFilterData>(df => {
                if (context.Connector.Name == df.DrillType) {
                    context.Paradigms.Add("DrillSummary");
                    if (df.Id.HasValue) {
                        context.ModelContext.Paradigms.Add("DrillDetail");
                    }
                }
                else {
                    context.Paradigms.Add("DrillExclude");
                }
            });

        }
Пример #4
0
        protected override void Displaying(SocketDisplayContext context)
        {
            // Set a paradigm for empty sockets
            if (context.Query.TotalCount == 0)
            {
                context.Paradigms.Add("Empty");
                if (!context.Paradigms.Has("ShowEmpty")) {
                    context.RenderSocket = false;
                }
                // TODO: A pure-placement method didn't work because Displaying happens after Placement. But we don't want to execute the count for every single connector type
                // because a lot will already be decided against in advance. Either a) cache the current count on SocketsPartRecord or b) find another way, e.g. a delegate that
                // will only run if placement hasn't already been denied.
//                context.Paradigms.Add("Empty");
            }

            // Do some default display type mapping
            // TODO: Could be done in placement now?
            if (String.IsNullOrWhiteSpace(context.Connector.DisplayType))
            {
                switch (context.Left.DisplayType)
                {
                    case "Detail":
                        context.Connector.DisplayType = "Summary";
                        break;
                    case "Summary":
                        context.Connector.DisplayType = "SummaryTiny";
                        context.Paradigms.Add("ConnectorsFlatten");
                        break;
                    case "SummaryAdmin":
                        context.Connector.DisplayType = "Link";
                        context.Paradigms.Add("ConnectorsFlatten");
                        break;
                    case "SummaryTiny":
                        // Prevent further recursion by default
                        context.RenderSocket = false;
                        break;
                    case "Link":
                        // Prevent further recursion by default
                        context.RenderSocket = false;
                        break;
                    default:
                        // Any other situtations we don't understand, just use links.
                        context.Connector.DisplayType = "Link";
                        break;
                }
            }
        }
Пример #5
0
        protected override void Preparing(SocketDisplayContext context)
        {
            if (context.Left.DisplayType == "Detail")
            {
                var clipPart = context.Connector.Definition.Parts.FirstOrDefault(p => p.PartDefinition.Name == "PaperclipPart");
                if (clipPart != null)
                {
                    // Get actual part model from item
                    var settings = clipPart.Settings.GetModel<PaperclipTypePartSettings>();
                    if (!String.IsNullOrWhiteSpace(settings.DefaultPlacement))
                    {
                        context.LayoutPlacement = settings.DefaultPlacement;
                    }

                    if (!String.IsNullOrWhiteSpace(settings.DefaultDisplayType))
                    {
                        context.Connector.DisplayType = settings.DefaultDisplayType;
                    }

                }
            }
        }
Пример #6
0
        protected override void Displaying(SocketDisplayContext context)
        {
            if (context.RootModel.DisplayType == "Detail")
            {
                switch (context.Connector.Name)
                {
                    case "CountryToTown":
                        context.Left.DisplayType = context.Connector.DisplayType = "Directory";
                        // TODO: In migration add to settings
                        context.Paradigms.Add("Count");
                        break;
                    case "TownToAddress":
                        context.Left.DisplayType = context.Connector.DisplayType = "Listing";
                        // TODO: In migration add to settings
                        context.Paradigms.Add("Collapse");
                        break;
                }
            }

            // From DirectoryController, we get a bunch of Address items in Summary mode
            if (context.RootModel.DisplayType == "Summary")
            {
                switch (context.Connector.Name)
                {
                    case "AddressToUser":
                        context.Left.DisplayType = context.Connector.DisplayType = "Listing";
                        break;
                    case "AddressToTown":
                        context.Left.DisplayType = context.Connector.DisplayType = "Listing";
                        break;
                }
            }

            if (context.RootModel.DisplayType == "Listing")
            {
                // ...
            }
        }
Пример #7
0
 void ISocketHandler.Updated(SocketDisplayContext context)
 {
     Updated(context);
 }
Пример #8
0
 void ISocketHandler.Editor(SocketDisplayContext context)
 {
     Editor(context);
 }
Пример #9
0
 void ISocketHandler.Displaying(SocketDisplayContext context)
 {
     Displaying(context);
 }
Пример #10
0
 void ISocketHandler.Preparing(SocketDisplayContext context)
 {
     Preparing(context);
 }
Пример #11
0
 protected virtual void Updated(SocketDisplayContext context) { }
Пример #12
0
 protected virtual void Preparing(SocketDisplayContext context)
 {
 }
Пример #13
0
 protected virtual void Updated(SocketDisplayContext context)
 {
 }
Пример #14
0
 protected override void Displaying(SocketDisplayContext context) {
  
 }
Пример #15
0
 void ISocketHandler.Updated(SocketDisplayContext context)
 {
     Updated(context);
 }
Пример #16
0
 void ISocketHandler.Editor(SocketDisplayContext context)
 {
     Editor(context);
 }
Пример #17
0
 void ISocketHandler.Displaying(SocketDisplayContext context)
 {
     Displaying(context);
 }
Пример #18
0
 void ISocketHandler.Preparing(SocketDisplayContext context)
 {
     Preparing(context);
 }
Пример #19
0
 public ConnectorDisplayContext(IConnector item, string displayType, SocketDisplayContext context) : base(context.Connector) {
     ConnectorContent = item;
     RenderConnector = true;
     SocketContext = context;
     RightField = new Lazy<SocketEndpoint>(() => new SocketEndpoint(ConnectorContent.RightContent, displayType));
 }
Пример #20
0
 protected virtual void Displaying(SocketDisplayContext context)
 {
 }
Пример #21
0
 protected virtual void Editor(SocketDisplayContext context)
 {
 }
Пример #22
0
 protected override void Preparing(SocketDisplayContext context) {
     if (context.ModelContext.Mode == "Display" && context.Paradigms.Has("Navigation") && context.ModelContext.DisplayType=="Navigation") {
         context.Connector.DisplayType = "Navigation";
     }
 }
Пример #23
0
 protected virtual void Preparing(SocketDisplayContext context) { }
Пример #24
0
        protected override void Editing(SocketDisplayContext context)
        {
            context.Left.DisplayType="Editor";
            context.Connector.DisplayType = "EditorConnector";

            if (context.Query.TotalCount == 0) {
                context.Paradigms.Add("Empty");
            }
            
            // Check box list or drop down list?
            context.Paradigms.Add(context.Connector.Settings.AllowMany ? "Many" : "One");
            context.Paradigms.Add(context.Connector.Settings.AllowDuplicates ? "DuplicatesPossible" : "Unique");

            // Outright hide editor. Typically used when we have an inverse connector and we only
            // actually want to work with one end of the connector in UI.
            if (context.Paradigms.Has("Hidden")) {
                context.RenderSocket = false;
            }
        }
Пример #25
0
 protected virtual void Displaying(SocketDisplayContext context) { }
Пример #26
0
 public SocketsDriverResult(string shapeType, string prefix, Framework.SocketDisplayContext socketContext, Func<SocketDisplayContext, ModelShapeContext, dynamic> factory)
     : base(shapeType,prefix,(c)=>factory(socketContext,c))
 {
     SocketContext = socketContext;
 }
Пример #27
0
 protected virtual void Editor(SocketDisplayContext context) { }