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 } });
         }
     }
 }
        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");
                }
            });

        }
        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;
                }
            }
        }
        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;
                    }

                }
            }
        }
        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);
 }
 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) { }